|
|
|
@ -4,11 +4,21 @@ set -eu -o pipefail |
|
|
|
|
|
|
|
|
|
tmpfile=$(mktemp "update-stackage.XXXXXXX") |
|
|
|
|
# shellcheck disable=SC2064 |
|
|
|
|
|
|
|
|
|
config_file="pkgs/development/haskell-modules/configuration-hackage2nix.yaml" |
|
|
|
|
|
|
|
|
|
trap "rm ${tmpfile} ${tmpfile}.new" 0 |
|
|
|
|
touch "$tmpfile" "$tmpfile.new" # Creating files here so that trap creates no errors. |
|
|
|
|
|
|
|
|
|
curl -L -s "https://stackage.org/nightly/cabal.config" >"$tmpfile" |
|
|
|
|
old_version=$(grep " # Stackage Nightly" $config_file | sed -E 's/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/\1/') |
|
|
|
|
version=$(sed -rn "s/^--.*http:..(www.)?stackage.org.snapshot.nightly-//p" "$tmpfile") |
|
|
|
|
|
|
|
|
|
if [[ "$old_version" == "$version" ]]; then |
|
|
|
|
echo "No new stackage version" |
|
|
|
|
exit 0 # Nothing to do |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# Create a simple yaml version of the file. |
|
|
|
|
sed -r \ |
|
|
|
|
-e '/^--/d' \ |
|
|
|
@ -43,14 +53,18 @@ sed -r \ |
|
|
|
|
# Drop the previous configuration ... |
|
|
|
|
# shellcheck disable=SC1004 |
|
|
|
|
sed -e '/ # Stackage Nightly/,/^$/c \TODO\ |
|
|
|
|
' -i pkgs/development/haskell-modules/configuration-hackage2nix.yaml |
|
|
|
|
' -i $config_file |
|
|
|
|
|
|
|
|
|
# ... and replace it with the new one. |
|
|
|
|
sed -e "/TODO/r $tmpfile" \ |
|
|
|
|
-e "s/TODO/ # Stackage Nightly $version/" \ |
|
|
|
|
-i pkgs/development/haskell-modules/configuration-hackage2nix.yaml |
|
|
|
|
-i $config_file |
|
|
|
|
|
|
|
|
|
if [[ "${1:-}" == "--do-commit" ]]; then |
|
|
|
|
git add pkgs/development/haskell-modules/configuration-hackage2nix.yaml |
|
|
|
|
git commit -m "configuration-hackage2nix.yaml: Changing Stackage pin to Nightly $version" |
|
|
|
|
git add $config_file |
|
|
|
|
git commit -F - << EOF |
|
|
|
|
Stackage Nightly: $old_version -> $version |
|
|
|
|
|
|
|
|
|
This commit has been generated by maintainers/scripts/haskell/update-stackage.sh |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|