File tree Expand file tree Collapse file tree 3 files changed +75
-0
lines changed Expand file tree Collapse file tree 3 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env nix-shell
2+ #! nix-shell -i bash -p curl jq nix sd
3+
4+ set -e
5+
6+ dirname=" $( dirname " $0 " ) "
7+ rootDir=" $( git -C " $dirname " rev-parse --show-toplevel) "
8+ pname=" besu"
9+
10+ updateVersion () {
11+ local version=$1
12+ sd " version = \" [0-9.]*\" ;" " version = \" $version \" ;" " ${dirname} /default.nix"
13+ }
14+
15+ updateHash () {
16+ local version=$1
17+ local url=" https://hyperledger.jfrog.io/hyperledger/${pname} -binaries/${pname} /${version} /${pname} -${version} .tar.gz"
18+ local sriHash=$( nix store prefetch-file --json " $url " | jq -r .hash)
19+ sd ' hash = "[a-zA-Z0-9/+-=]*";' " hash = \" $sriHash \" ;" " ${dirname} /default.nix"
20+ }
21+
22+ currentVersion=$( nix derivation show " ${rootDir} #${pname} " | jq -r ' .[].env.version' )
23+ latestVersion=$( curl -s " https://hyperledger.jfrog.io/artifactory/api/search/latestVersion?g=org.hyperledger.besu.internal&a=besu" )
24+
25+ if [[ " $currentVersion " == " $latestVersion " ]]; then
26+ echo " ${pname} is up to date: ${currentVersion} "
27+ exit 0
28+ fi
29+
30+ echo " Updating ${pname} from ${currentVersion} to ${latestVersion} "
31+
32+ updateVersion " $latestVersion "
33+ updateHash " $latestVersion "
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ stdenv.mkDerivation rec {
2424 wrapProgram $out/bin/${ pname } --set JAVA_HOME "${ jre } "
2525 '' ;
2626
27+ passtrhu . updateScript = ./update.sh ;
28+
2729 meta = with lib ; {
2830 description = "Java Implementation of the Ethereum 2.0 Beacon Chain" ;
2931 homepage = "https://github.com/ConsenSys/teku" ;
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env nix-shell
2+ #! nix-shell -i bash -p curl jq nix sd
3+
4+ set -e
5+
6+ dirname=" $( dirname " $0 " ) "
7+ rootDir=" $( git -C " $dirname " rev-parse --show-toplevel) "
8+ pname=" teku"
9+
10+ updateVersion () {
11+ local version=$1
12+ sd " version = \" [0-9.]*\" ;" " version = \" $version \" ;" " ${dirname} /default.nix"
13+ }
14+
15+ updateHash () {
16+ local version=$1
17+ local url=" https://artifacts.consensys.net/public/${pname} /raw/names/${pname} .tar.gz/versions/${version} /${pname} -${version} .tar.gz"
18+
19+ local output=$( nix store prefetch-file --json " $url " )
20+ local sriHash=$( echo " $output " | jq -r .hash)
21+
22+ sd " \" hash\" = \" [a-zA-Z0-9\/+-=]*\" ;" " \" hash\" = \" $sriHash \" ;" " ${dirname} /default.nix"
23+ }
24+
25+ currentVersion=$( nix show-derivation " ${rootDir} #${pname} " | jq -r ' .[].env.version' )
26+ latestVersion=$( curl -s " https://api.github.com/repos/ConsenSys/teku/releases/latest" | jq -r ' .tag_name' )
27+
28+ # Optionally strip leading 'v' if present in the tag name
29+ latestVersion=${latestVersion# v}
30+
31+ if [[ " $currentVersion " == " $latestVersion " ]]; then
32+ echo " ${pname} is up to date: ${currentVersion} "
33+ exit 0
34+ fi
35+
36+ echo " Updating ${pname} from ${currentVersion} to ${latestVersion} "
37+
38+ updateVersion " $latestVersion "
39+ updateHash " $latestVersion "
40+
You can’t perform that action at this time.
0 commit comments