Update bench, erpnext, frappe versions

bench: 5.16.2 -> 5.16.4
https://github.com/frappe/bench/releases/tag/v5.16.4

erpnext: 14.26.0 -> 14.30.6
https://github.com/frappe/erpnext/releases/tag/v14.30.6
Use new relaxed dependency: rapidfuzz

frappe: 14.37.0 -> 14.40.3
https://github.com/frappe/frappe/releases/tag/v14.40.3

Add update.sh script to quickly update all versions in pin.nix

Sort erpnext dependencies like upstream

Update Readme with docs how to use update.sh script
This commit is contained in:
teutat3s 2023-07-17 21:10:27 +02:00
parent 446a2b6dea
commit 7763af845d
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
9 changed files with 201 additions and 37 deletions

View file

@ -20,6 +20,17 @@ nix build --json .#run-erpnext \
| cachix push pub-solar | cachix push pub-solar
``` ```
### Updating `bench`, `erpnext`, `frappe` versions and hashes
Versions and hashes are in `srcs/pin.nix`. To quickly update those to the
latest version, run:
```
cd srcs
./update.sh
# If you need specific versions, specify them as arguments
./update.sh <bench_version> <erpnext_version> <frappe_version>
```
### NixOS VM ### NixOS VM
Initial setup: Initial setup:
``` ```

View file

@ -10,17 +10,18 @@ let
pinData = import ../srcs/pin.nix; pinData = import ../srcs/pin.nix;
inherit (pinData) erpnextVersion; inherit (pinData) erpnextVersion;
inherit (pinData.hashes) erpnextSrcHash; inherit (pinData.hashes) erpnextSrcHash;
inherit (pinData.hashes) erpnextYarnHash;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "frappe"; owner = "frappe";
repo = "erpnext"; repo = "erpnext";
rev = "v${erpnextVersion}"; rev = "v${erpnextVersion}";
hash = erpnextSrcHash; sha256 = erpnextSrcHash;
}; };
offlineCache = fetchYarnDeps { offlineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock"; yarnLock = "${src}/yarn.lock";
sha256 = "sha256-Vho4BSbxcsVYExLvUaeoc3xIpbXoCUP/4jw4RwGnWGY="; sha256 = erpnextYarnHash;
}; };
mkApp = import ./mk-app.nix { mkApp = import ./mk-app.nix {

View file

@ -10,17 +10,18 @@ let
pinData = import ../srcs/pin.nix; pinData = import ../srcs/pin.nix;
inherit (pinData) frappeVersion; inherit (pinData) frappeVersion;
inherit (pinData.hashes) frappeSrcHash; inherit (pinData.hashes) frappeSrcHash;
inherit (pinData.hashes) frappeYarnHash;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "frappe"; owner = "frappe";
repo = "frappe"; repo = "frappe";
rev = "v${frappeVersion}"; rev = "v${frappeVersion}";
hash = frappeSrcHash; sha256 = frappeSrcHash;
}; };
offlineCache = fetchYarnDeps { offlineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock"; yarnLock = "${src}/yarn.lock";
sha256 = "sha256-PBdMUz9gJIoQaqQYbdk+xnd8CyZPmdeyz/9WznCb4Ss="; sha256 = frappeYarnHash;
}; };
mkApp = import ./mk-app.nix { mkApp = import ./mk-app.nix {
inherit path runCommand nodejs yarn nodePackages; inherit path runCommand nodejs yarn nodePackages;

View file

@ -22,13 +22,13 @@ let
in in
buildPythonPackage rec { buildPythonPackage rec {
pname = "frappe-bench"; pname = "frappe-bench";
version = "5.16.2"; version = benchVersion;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "frappe"; owner = "frappe";
repo = "bench"; repo = "bench";
rev = "v${benchVersion}"; rev = "v${benchVersion}";
hash = benchSrcHash; sha256 = benchSrcHash;
}; };
format = "pyproject"; format = "pyproject";

View file

@ -1,20 +1,22 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, pythonRelaxDepsHook
, fetchFromGitHub , fetchFromGitHub
, pythonRelaxDepsHook
, taxjar # Core dependencies
, gocardless-pro
, plaid-python
, unidecode
, pycountry , pycountry
, python-youtube
, tweepy
, redisearch
, googlemaps
, python-stdnum , python-stdnum
, frappe , unidecode
, bench , redisearch
, rapidfuzz
# Integration dependencies
, gocardless-pro
, googlemaps
, plaid-python
, python-youtube
, taxjar
, tweepy
}: }:
let let
pinData = import ../srcs/pin.nix; pinData = import ../srcs/pin.nix;
@ -29,7 +31,7 @@ buildPythonPackage rec {
owner = "frappe"; owner = "frappe";
repo = pname; repo = pname;
rev = "v${erpnextVersion}"; rev = "v${erpnextVersion}";
hash = erpnextSrcHash; sha256 = erpnextSrcHash;
}; };
format = "flit"; format = "flit";
@ -37,20 +39,24 @@ buildPythonPackage rec {
nativeBuildInputs = [ pythonRelaxDepsHook ]; nativeBuildInputs = [ pythonRelaxDepsHook ];
pythonRelaxDeps = [ pythonRelaxDeps = [
"pycountry" "pycountry"
"rapidfuzz"
"Unidecode" "Unidecode"
]; ];
propagatedBuildInputs = [ propagatedBuildInputs = [
taxjar # Core dependencies
gocardless-pro
plaid-python
unidecode
pycountry pycountry
python-youtube
tweepy
redisearch
googlemaps
python-stdnum python-stdnum
frappe unidecode
redisearch
rapidfuzz
# Integration dependencies
gocardless-pro
googlemaps
plaid-python
python-youtube
taxjar
tweepy
]; ];
} }

View file

@ -3,7 +3,7 @@
, pythonRelaxDepsHook , pythonRelaxDepsHook
, fetchFromGitHub , fetchFromGitHub
# core dependencies # Core dependencies
, babel , babel
, click , click
, filelock , filelock
@ -70,9 +70,8 @@
, xlrd , xlrd
, zxcvbn , zxcvbn
, markdownify , markdownify
, bench
# integration dependencies # Integration dependencies
, boto3 , boto3
, dropbox , dropbox
, google-api-python-client , google-api-python-client
@ -94,7 +93,7 @@ buildPythonPackage rec {
owner = pname; owner = pname;
repo = pname; repo = pname;
rev = "v${frappeVersion}"; rev = "v${frappeVersion}";
hash = frappeSrcHash; sha256 = frappeSrcHash;
}; };
format = "flit"; format = "flit";

View file

@ -1,10 +1,12 @@
{ {
frappeVersion = "14.37.0"; benchVersion = "5.16.4";
erpnextVersion = "14.26.0"; erpnextVersion = "14.30.6";
benchVersion = "5.16.2"; frappeVersion = "14.40.3";
hashes = { hashes = {
"benchSrcHash" = "sha256-SF/RwY54OKXTDIYz4LsQIR03QoCKPIGey60DO8TdonY="; "benchSrcHash" = "nIEFTCiyjfkCtpeeoQY+9zfoHQXZ5NOgXgLaz5ki150=";
"erpnextSrcHash" = "sha256-hPOgHADkrylc6OCbDyXCQfSYe5wliIhNcXpLE0hxmJ0="; "erpnextSrcHash" = "E+1vW73a3dp0YIVM0Ybt55DEi/7kDIKB4xTac+D49l4=";
"frappeSrcHash" = "sha256-f0BkNByKtqXaG6L4+llwy9kmI8gbjvZdKzkzrbA6PI4="; "erpnextYarnHash" = "0rjqlw0lff1wwbzl62g8nnjlhz3km2km3vqj2dccawpi4q2kh6jn";
"frappeSrcHash" = "byzPj4kJRgU1Fs5wyr9FZU2NyoxX0qePNY/KicEvGcY=";
"frappeYarnHash" = "0az1kdqcwmpzryrdg6ag4q5pqxy67vcns654d888l9307x9lq5rw";
}; };
} }

71
srcs/update.sh Executable file
View file

@ -0,0 +1,71 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github
if [ "$#" -gt 3 ] || [[ "$1" == -* ]]; then
echo "Regenerates packaging data for the ERPNext packages."
echo "Usage: $0 [git bench release tag] [git erpnext release tag] [git frappe release tag]"
exit 1
fi
bench_version="$1"
erpnext_version="$2"
frappe_version="$3"
set -euo pipefail
if [ -z "$bench_version" ]; then
bench_version="$(wget -q -O- "https://api.github.com/repos/frappe/bench/releases?per_page=1" | jq -r '.[0].tag_name')"
fi
if [ -z "$erpnext_version" ]; then
erpnext_version="$(wget -q -O- "https://api.github.com/repos/frappe/erpnext/releases?per_page=1" | jq -r '.[0].tag_name')"
fi
if [ -z "$frappe_version" ]; then
frappe_version="$(wget -q -O- "https://api.github.com/repos/frappe/frappe/releases?per_page=1" | jq -r '.[0].tag_name')"
fi
# strip leading "v"
bench_version="${bench_version#v}"
erpnext_version="${erpnext_version#v}"
frappe_version="${frappe_version#v}"
# Bench
bench_src_hash=$(nix-prefetch-github frappe bench --rev "v${bench_version}" | jq -r .sha256)
# Erpnext
erpnext_src="https://raw.githubusercontent.com/frappe/erpnext/v$erpnext_version"
erpnext_src_hash="$(nix-prefetch-github frappe erpnext --rev "v${erpnext_version}" | jq -r .sha256)"
erpnext_tmpdir=$(mktemp -d)
trap 'rm -rf "$erpnext_tmpdir"' EXIT
pushd "$erpnext_tmpdir"
wget -q "$erpnext_src/yarn.lock"
erpnext_yarn_hash=$(prefetch-yarn-deps yarn.lock)
popd
# Frappe
frappe_src="https://raw.githubusercontent.com/frappe/frappe/v$frappe_version"
frappe_src_hash="$(nix-prefetch-github frappe frappe --rev "v${frappe_version}" | jq -r .sha256)"
frappe_tmpdir=$(mktemp -d)
trap 'rm -rf "$frappe_tmpdir"' EXIT
pushd "$frappe_tmpdir"
wget -q "$frappe_src/yarn.lock"
frappe_yarn_hash=$(prefetch-yarn-deps yarn.lock)
popd
cat > pin.nix << EOF
{
benchVersion = "$bench_version";
erpnextVersion = "$erpnext_version";
frappeVersion = "$frappe_version";
hashes = {
"benchSrcHash" = "$bench_src_hash";
"erpnextSrcHash" = "$erpnext_src_hash";
"erpnextYarnHash" = "$erpnext_yarn_hash";
"frappeSrcHash" = "$frappe_src_hash";
"frappeYarnHash" = "$frappe_yarn_hash";
};
}
EOF

73
update.sh Normal file
View file

@ -0,0 +1,73 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=../../../../../ -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
echo "Regenerates packaging data for the ERPNext packages."
echo "Usage: $0 [git bench release tag] $1 [git erpnext release tag] $2 [git frappe release tag]"
exit 1
fi
bench_version="$1"
erpnext_version="$3"
frappe_version="$2"
set -euo pipefail
if [ -z "$bench_version" ]; then
bench_version="$(wget -q -O- "https://api.github.com/repos/frappe/bench/releases?per_page=1" | jq -r '.[0].tag_name')"
fi
if [ -z "$erpnext_version" ]; then
erpnext_version="$(wget -q -O- "https://api.github.com/repos/frappe/erpnext/releases?per_page=1" | jq -r '.[0].tag_name')"
fi
if [ -z "$frappe_version" ]; then
frappe_version="$(wget -q -O- "https://api.github.com/repos/frappe/frappe/releases?per_page=1" | jq -r '.[0].tag_name')"
fi
# strip leading "v"
bench_version="${bench_version#v}"
erpnext_version="${erpnext_version#v}"
frappe_version="${frappe_version#v}"
# Bench
bench_src_hash=$(nix-prefetch-github frappe bench --rev "v${bench_version}" | jq -r .sha256)
popd
# Erpnext
erpnext_src="https://raw.githubusercontent.com/frappe/erpnext/v$erpnext_version"
erpnext_src_hash="$(nix-prefetch-github frappe erpnext --rev "v${erpnext_version}" | jq -r .sha256)"
erpnext_tmpdir=$(mktemp -d)
trap 'rm -rf "$erpnext_tmpdir"' EXIT
pushd "$erpnext_tmpdir"
wget -q "$erpnext_src/yarn.lock"
erpnext_yarn_hash=$(prefetch-yarn-deps yarn.lock)
popd
# Frappe
frappe_src="https://raw.githubusercontent.com/frappe/frappe/v$frappe_version"
frappe_src_hash="$(nix-prefetch-github frappe frappe --rev "v${frappe_version}" | jq -r .sha256)"
frappe_tmpdir=$(mktemp -d)
trap 'rm -rf "$frappe_tmpdir"' EXIT
pushd "$frappe_tmpdir"
wget -q "$frappe_src/yarn.lock"
frappe_yarn_hash=$(prefetch-yarn-deps yarn.lock)
popd
cat > pin.nix << EOF
{
benchVersion = "$bench_version";
erpnextVersion = "$erpnext_version";
frappeVersion = "$frappe_version";
hashes = {
"benchSrcHash" = "$bench_src_hash";
"erpnextSrcHash" = "$erpnext_src_hash";
"erpnextYarnHash" = "$erpnext_yarn_hash";
"frappeSrcHash" = "$frappe_src_hash";
"frappeYarnHash" = "$frappe_yarn_hash";
};
}
EOF