diff options
author | Malte Brandy <malte.brandy@maralorn.de> | 2021-05-03 22:52:32 +0200 |
---|---|---|
committer | Malte Brandy <malte.brandy@maralorn.de> | 2021-05-03 22:58:51 +0200 |
commit | 4dbda0125a3564dc5849789b48a03f0bc80b8a0a (patch) | |
tree | ab2359d2607707ab134f42f893b76213bbe338ed /maintainers | |
parent | 7a353215dc2bbae103dda03248bb6a2696dc5242 (diff) |
maintainers/scripts/haskell: Add --do-commit option
Diffstat (limited to 'maintainers')
-rwxr-xr-x | maintainers/scripts/haskell/regenerate-hackage-packages.sh | 5 | ||||
-rwxr-xr-x | maintainers/scripts/haskell/update-hackage.sh | 12 | ||||
-rwxr-xr-x | maintainers/scripts/haskell/update-stackage.sh | 5 |
3 files changed, 20 insertions, 2 deletions
diff --git a/maintainers/scripts/haskell/regenerate-hackage-packages.sh b/maintainers/scripts/haskell/regenerate-hackage-packages.sh index 79b93f5b7cb1b..2408d893dae1f 100755 --- a/maintainers/scripts/haskell/regenerate-hackage-packages.sh +++ b/maintainers/scripts/haskell/regenerate-hackage-packages.sh @@ -18,3 +18,8 @@ extractionDerivation='with import ./. {}; runCommand "unpacked-cabal-hashes" { } unpacked_hackage="$(nix-build -E "$extractionDerivation" --no-out-link)" hackage2nix --hackage "$unpacked_hackage" --preferred-versions <(for n in "$unpacked_hackage"/*/preferred-versions; do cat "$n"; echo; done) --nixpkgs "$PWD" --config pkgs/development/haskell-modules/configuration-hackage2nix.yaml + +if [[ "${1:-}" == "--do-commit" ]]; then + git add pkgs/development/haskell-modules/hackage-packages.nix + git commit -m "hackage-packages.nix: Regenerate based on current config" +fi diff --git a/maintainers/scripts/haskell/update-hackage.sh b/maintainers/scripts/haskell/update-hackage.sh index de4b3bc0448ec..a8ad8d9e2ecc9 100755 --- a/maintainers/scripts/haskell/update-hackage.sh +++ b/maintainers/scripts/haskell/update-hackage.sh @@ -7,7 +7,9 @@ set -euo pipefail pin_file=pkgs/data/misc/hackage/pin.json current_commit="$(jq -r .commit $pin_file)" -head_commit="$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/commercialhaskell/all-cabal-hashes/branches/hackage | jq -r .commit.sha)" +git_info="$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/commercialhaskell/all-cabal-hashes/branches/hackage)" +head_commit="$(echo "$git_info" | jq -r .commit.sha)" +commit_msg="$(echo "$git_info" | jq -r .commit.commit.message)" if [ "$current_commit" != "$head_commit" ]; then url="https://github.com/commercialhaskell/all-cabal-hashes/archive/$head_commit.tar.gz" @@ -16,6 +18,12 @@ if [ "$current_commit" != "$head_commit" ]; then --arg commit "$head_commit" \ --arg hash "$hash" \ --arg url "$url" \ - '{commit: $commit, url: $url, sha256: $hash}' \ + --arg commit_msg "$commit_msg" \ + '{commit: $commit, url: $url, sha256: $hash, msg: $commit_msg}' \ > $pin_file fi + +if [[ "${1:-}" == "--do-commit" ]]; then + git add pkgs/data/misc/hackage/pin.json + git commit -m "all-cabal-hashes: Changing pin to '$commit_msg'" +fi diff --git a/maintainers/scripts/haskell/update-stackage.sh b/maintainers/scripts/haskell/update-stackage.sh index 0e08c02bc2c6a..c3be3158b298a 100755 --- a/maintainers/scripts/haskell/update-stackage.sh +++ b/maintainers/scripts/haskell/update-stackage.sh @@ -49,3 +49,8 @@ sed -e '/ # Stackage Nightly/,/^$/c \TODO\ sed -e "/TODO/r $tmpfile" \ -e "s/TODO/ # Stackage Nightly $version/" \ -i pkgs/development/haskell-modules/configuration-hackage2nix.yaml + +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" +fi |