nixpkgs/pkgs/misc/lilypond/update.sh
Samuel Tam 742ba56e7b
lilypond, lilypond-unstable: bump version, add passthru.updateScript (#207727)
* lilypond: add passthru.updateScript

* lilypond: 2.22.2 -> 2.24.0

* lilypond-unstable: 2.23.12 -> 2.25.1
2023-01-30 12:00:34 -05:00

26 lines
855 B
Bash
Executable File

#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i bash -p curl gnused nix
set -euo pipefail
if [ $# -gt 0 ] && [ "$1" = "unstable" ]; then
ATTR="lilypond-unstable"
FILE="$(dirname "${BASH_SOURCE[@]}")/unstable.nix"
QUERY="VERSION_DEVEL="
else
ATTR="lilypond"
FILE="$(dirname "${BASH_SOURCE[@]}")/default.nix"
QUERY="VERSION_STABLE="
fi
# update version
PREV=$(nix eval --raw -f default.nix $ATTR.version)
NEXT=$(curl -s 'https://gitlab.com/lilypond/lilypond/-/raw/master/VERSION' | grep "$QUERY" | cut -d= -f2)
sed -i "s|$PREV|$NEXT|" "$FILE"
echo "[{\"commitMessage\":\"$ATTR: $PREV -> $NEXT\"}]"
# update hash
PREV=$(nix eval --raw -f default.nix $ATTR.src.outputHash)
NEXT=$(nix hash to-sri --type sha256 $(nix-prefetch-url --type sha256 $(nix eval --raw -f default.nix $ATTR.src.url)))
sed -i "s|$PREV|$NEXT|" "$FILE"