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