depot/third_party/nixpkgs/pkgs/misc/lilypond/update.sh
Default email a0cb138ada Project import generated by Copybara.
GitOrigin-RevId: a100acd7bbf105915b0004427802286c37738fef
2023-02-02 18:25:31 +00:00

25 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"