cassandra: Add updateScript

This commit is contained in:
Robert Hensing 2022-02-23 15:31:16 +01:00
parent bc50e0ec12
commit ab55499253
4 changed files with 45 additions and 3 deletions

View file

@ -1,5 +1,4 @@
{ callPackage, ... } @ args:
callPackage ./generic.nix (args // {
version = "3.0.26";
sha256 = "09wim1w2yizcqpja62jk64fhaw3jgnrgrjlrm4kgmcc3g3bsmw6i";

View file

@ -1,5 +1,4 @@
{ callPackage, ... } @ args:
callPackage ./generic.nix (args // {
version = "3.11.12";
sha256 = "16j58l7r47qrfh8q7fm92y935ykgvnbj3qn984c42qda15x92hkw";

View file

@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
src = fetchurl {
inherit sha256;
url = "mirror://apache/cassandra/${version}/apache-${pname}-${version}-bin.tar.gz";
url = "mirror://apache/cassandra/${version}/apache-cassandra-${version}-bin.tar.gz";
};
nativeBuildInputs = [ makeWrapper coreutils ];
@ -113,6 +113,8 @@ stdenv.mkDerivation rec {
assert test.testPackage.version == version;
test;
};
updateScript = ./update.sh;
};
meta = with lib; {

View file

@ -0,0 +1,42 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash
#!nix-shell -p git
cd "$(dirname "$0")"
set -eux -o pipefail
tmp="$(mktemp -d)"
cleanup() {
rm -rf "$tmp"
}
trap cleanup EXIT
# get numeric-only versions, sort them latest first
git ls-remote --tags https://github.com/apache/cassandra \
| awk '{ if (match($0, /refs.tags.cassandra-([0-9.]*)$/, m)) print m[1] }' \
| sort -V \
| tac >$tmp/versions
version="$(grep -E '3[.]11[.]' <$tmp/versions | head -n 1)"
hash="$(nix-prefetch-url "mirror://apache/cassandra/${version}/apache-cassandra-${version}-bin.tar.gz")"
cat >3.11.nix <<EOF
# GENERATED BY update.sh
{ callPackage, ... } @ args:
callPackage ./generic.nix (args // {
version = "$version";
sha256 = "$hash";
generation = "3_11";
})
EOF
version="$(grep -E '3[.]0[.]' <$tmp/versions | head -n 1)"
hash="$(nix-prefetch-url "mirror://apache/cassandra/${version}/apache-cassandra-${version}-bin.tar.gz")"
cat >3.0.nix <<EOF
# GENERATED BY update.sh
{ callPackage, ... } @ args:
callPackage ./generic.nix (args // {
version = "$version";
sha256 = "$hash";
generation = "3_0";
})
EOF