9 inherit (lib) makeBinPath;
10 filename = lib.strings.replaceStrings [ "_" ] [ "." ] generation + ".json";
11 regex = lib.strings.replaceStrings [ "_" ] [ "[.]" ] generation;
13 writeScript "update-cassandra_${generation}" ''
16 test -d pkgs -a -d nixos -a -d lib || {
17 echo >&2 "$0 expects to be run in a nixpkgs checkout"
20 cd pkgs/servers/nosql/cassandra
21 PATH="${makeBinPath [git gnupg]}:$PATH"
29 # get numeric-only versions, sort them latest first
30 git ls-remote --tags https://github.com/apache/cassandra \
31 | awk '{ if (match($0, /refs.tags.cassandra-([0-9.]*)$/, m)) print m[1] }' \
35 version="$(grep -E '^${regex}' <$tmp/versions | head -n 1)"
36 path="cassandra/$version/apache-cassandra-$version-bin.tar.gz"
37 curl "https://downloads.apache.org/$path" >$tmp/src.tar.gz
38 curl "https://downloads.apache.org/$path.asc" >$tmp/src.tar.gz.asc
40 # See https://downloads.apache.org/cassandra/KEYS
41 # Make sure that any new key corresponds to someone on the project
42 for key in A4C465FEA0C552561A392A61E91335D77E3E87CB; do
43 gpg --trustdb-name "$tmp/trust.db" --batch --recv-keys "$key"
44 echo "$key:5:" | gpg --trustdb-name "$tmp/trust.db" --batch --import-ownertrust
46 gpg --trustdb-name "$tmp/trust.db" --batch --verify --trust-model direct $tmp/src.tar.gz.asc $tmp/src.tar.gz
48 hash="$(nix-prefetch-url "file://$tmp/src.tar.gz")"
49 cat >${filename} <<EOF
51 "version": "$version",