From 7763af845d5906cde5ff62fbd2c598231402f41c Mon Sep 17 00:00:00 2001 From: teutat3s Date: Mon, 17 Jul 2023 21:10:27 +0200 Subject: [PATCH] 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 --- README.md | 11 +++++++ node/erpnext-app.nix | 5 +-- node/frappe-app.nix | 5 +-- python/bench.nix | 4 +-- python/erpnext.nix | 48 ++++++++++++++++------------- python/frappe.nix | 7 ++--- srcs/pin.nix | 14 +++++---- srcs/update.sh | 71 ++++++++++++++++++++++++++++++++++++++++++ update.sh | 73 ++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 201 insertions(+), 37 deletions(-) create mode 100755 srcs/update.sh create mode 100644 update.sh diff --git a/README.md b/README.md index bd54b6c..de48121 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,17 @@ nix build --json .#run-erpnext \ | 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 +``` + ### NixOS VM Initial setup: ``` diff --git a/node/erpnext-app.nix b/node/erpnext-app.nix index 4357496..eea59ec 100644 --- a/node/erpnext-app.nix +++ b/node/erpnext-app.nix @@ -10,17 +10,18 @@ let pinData = import ../srcs/pin.nix; inherit (pinData) erpnextVersion; inherit (pinData.hashes) erpnextSrcHash; + inherit (pinData.hashes) erpnextYarnHash; src = fetchFromGitHub { owner = "frappe"; repo = "erpnext"; rev = "v${erpnextVersion}"; - hash = erpnextSrcHash; + sha256 = erpnextSrcHash; }; offlineCache = fetchYarnDeps { yarnLock = "${src}/yarn.lock"; - sha256 = "sha256-Vho4BSbxcsVYExLvUaeoc3xIpbXoCUP/4jw4RwGnWGY="; + sha256 = erpnextYarnHash; }; mkApp = import ./mk-app.nix { diff --git a/node/frappe-app.nix b/node/frappe-app.nix index 117d6fb..45eb127 100644 --- a/node/frappe-app.nix +++ b/node/frappe-app.nix @@ -10,17 +10,18 @@ let pinData = import ../srcs/pin.nix; inherit (pinData) frappeVersion; inherit (pinData.hashes) frappeSrcHash; + inherit (pinData.hashes) frappeYarnHash; src = fetchFromGitHub { owner = "frappe"; repo = "frappe"; rev = "v${frappeVersion}"; - hash = frappeSrcHash; + sha256 = frappeSrcHash; }; offlineCache = fetchYarnDeps { yarnLock = "${src}/yarn.lock"; - sha256 = "sha256-PBdMUz9gJIoQaqQYbdk+xnd8CyZPmdeyz/9WznCb4Ss="; + sha256 = frappeYarnHash; }; mkApp = import ./mk-app.nix { inherit path runCommand nodejs yarn nodePackages; diff --git a/python/bench.nix b/python/bench.nix index a0f3a9a..638a9be 100644 --- a/python/bench.nix +++ b/python/bench.nix @@ -22,13 +22,13 @@ let in buildPythonPackage rec { pname = "frappe-bench"; - version = "5.16.2"; + version = benchVersion; src = fetchFromGitHub { owner = "frappe"; repo = "bench"; rev = "v${benchVersion}"; - hash = benchSrcHash; + sha256 = benchSrcHash; }; format = "pyproject"; diff --git a/python/erpnext.nix b/python/erpnext.nix index 0a66505..27f665a 100644 --- a/python/erpnext.nix +++ b/python/erpnext.nix @@ -1,20 +1,22 @@ { lib , buildPythonPackage -, pythonRelaxDepsHook , fetchFromGitHub +, pythonRelaxDepsHook -, taxjar -, gocardless-pro -, plaid-python -, unidecode +# Core dependencies , pycountry -, python-youtube -, tweepy -, redisearch -, googlemaps , python-stdnum -, frappe -, bench +, unidecode +, redisearch +, rapidfuzz + +# Integration dependencies +, gocardless-pro +, googlemaps +, plaid-python +, python-youtube +, taxjar +, tweepy }: let pinData = import ../srcs/pin.nix; @@ -29,7 +31,7 @@ buildPythonPackage rec { owner = "frappe"; repo = pname; rev = "v${erpnextVersion}"; - hash = erpnextSrcHash; + sha256 = erpnextSrcHash; }; format = "flit"; @@ -37,20 +39,24 @@ buildPythonPackage rec { nativeBuildInputs = [ pythonRelaxDepsHook ]; pythonRelaxDeps = [ "pycountry" + "rapidfuzz" "Unidecode" ]; propagatedBuildInputs = [ - taxjar - gocardless-pro - plaid-python - unidecode + # Core dependencies pycountry - python-youtube - tweepy - redisearch - googlemaps python-stdnum - frappe + unidecode + redisearch + rapidfuzz + + # Integration dependencies + gocardless-pro + googlemaps + plaid-python + python-youtube + taxjar + tweepy ]; } diff --git a/python/frappe.nix b/python/frappe.nix index 12636bd..40a1d49 100644 --- a/python/frappe.nix +++ b/python/frappe.nix @@ -3,7 +3,7 @@ , pythonRelaxDepsHook , fetchFromGitHub - # core dependencies +# Core dependencies , babel , click , filelock @@ -70,9 +70,8 @@ , xlrd , zxcvbn , markdownify -, bench - # integration dependencies +# Integration dependencies , boto3 , dropbox , google-api-python-client @@ -94,7 +93,7 @@ buildPythonPackage rec { owner = pname; repo = pname; rev = "v${frappeVersion}"; - hash = frappeSrcHash; + sha256 = frappeSrcHash; }; format = "flit"; diff --git a/srcs/pin.nix b/srcs/pin.nix index 7388e3c..cdfe786 100644 --- a/srcs/pin.nix +++ b/srcs/pin.nix @@ -1,10 +1,12 @@ { - frappeVersion = "14.37.0"; - erpnextVersion = "14.26.0"; - benchVersion = "5.16.2"; + benchVersion = "5.16.4"; + erpnextVersion = "14.30.6"; + frappeVersion = "14.40.3"; hashes = { - "benchSrcHash" = "sha256-SF/RwY54OKXTDIYz4LsQIR03QoCKPIGey60DO8TdonY="; - "erpnextSrcHash" = "sha256-hPOgHADkrylc6OCbDyXCQfSYe5wliIhNcXpLE0hxmJ0="; - "frappeSrcHash" = "sha256-f0BkNByKtqXaG6L4+llwy9kmI8gbjvZdKzkzrbA6PI4="; + "benchSrcHash" = "nIEFTCiyjfkCtpeeoQY+9zfoHQXZ5NOgXgLaz5ki150="; + "erpnextSrcHash" = "E+1vW73a3dp0YIVM0Ybt55DEi/7kDIKB4xTac+D49l4="; + "erpnextYarnHash" = "0rjqlw0lff1wwbzl62g8nnjlhz3km2km3vqj2dccawpi4q2kh6jn"; + "frappeSrcHash" = "byzPj4kJRgU1Fs5wyr9FZU2NyoxX0qePNY/KicEvGcY="; + "frappeYarnHash" = "0az1kdqcwmpzryrdg6ag4q5pqxy67vcns654d888l9307x9lq5rw"; }; } diff --git a/srcs/update.sh b/srcs/update.sh new file mode 100755 index 0000000..4b3d313 --- /dev/null +++ b/srcs/update.sh @@ -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 diff --git a/update.sh b/update.sh new file mode 100644 index 0000000..4a84c94 --- /dev/null +++ b/update.sh @@ -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