hackage2nix: Split configuration, auto disable hydra builds
We split configuration-hackage2nix.yaml into multiple files. We bump cabal2nix-unstable to get support for multiple config files in hackage2nix. * The file main.yaml is only supposed to be edited by humans. * The file stackage.yaml is only supposed to be updated by the update-stackage.sh * The file broken.yaml can be edited by humans, but probably future helpers will want to insert broken packages into this file based on hydra reports. * The file transitive-broken.yaml is newly introduced to be generated by regenerate-transitive-broken-packages.sh regenerate-transitive-broken-packages.sh makes a nix query (in transitive-broken-packages.nix) which evaluates all haskellPackages once with and once without "allowBroken" this way it get's a list of packages which are broken by some transitive dependency, but does not disable packages which have eval errors not caused by a broken package.
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
#! /usr/bin/env bash
|
||||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p nix curl jq nix-prefetch-github git gnused gnugrep -I nixpkgs=.
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
tmpfile=$(mktemp "update-stackage.XXXXXXX")
|
||||
# shellcheck disable=SC2064
|
||||
|
||||
config_file="pkgs/development/haskell-modules/configuration-hackage2nix.yaml"
|
||||
stackage_config="pkgs/development/haskell-modules/configuration-hackage2nix/stackage.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/')
|
||||
old_version=$(grep "# Stackage Nightly" $stackage_config | 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
|
||||
@@ -29,6 +30,13 @@ sed -r \
|
||||
-e '/^$/d' \
|
||||
< "${tmpfile}" | sort --ignore-case >"${tmpfile}.new"
|
||||
|
||||
cat > $stackage_config << EOF
|
||||
# Stackage Nightly $version
|
||||
# This file is auto-generated by
|
||||
# maintainers/scripts/haskell/update-stackage.sh
|
||||
default-package-overrides:
|
||||
EOF
|
||||
|
||||
# Drop restrictions on some tools where we always want the latest version.
|
||||
sed -r \
|
||||
-e '/ cabal-install /d' \
|
||||
@@ -48,17 +56,7 @@ sed -r \
|
||||
-e '/ ShellCheck /d' \
|
||||
-e '/ stack /d' \
|
||||
-e '/ weeder /d' \
|
||||
< "${tmpfile}.new" > "${tmpfile}"
|
||||
|
||||
# Drop the previous configuration ...
|
||||
# shellcheck disable=SC1004
|
||||
sed -e '/ # Stackage Nightly/,/^$/c \TODO\
|
||||
' -i $config_file
|
||||
|
||||
# ... and replace it with the new one.
|
||||
sed -e "/TODO/r $tmpfile" \
|
||||
-e "s/TODO/ # Stackage Nightly $version/" \
|
||||
-i $config_file
|
||||
< "${tmpfile}.new" >> $stackage_config
|
||||
|
||||
if [[ "${1:-}" == "--do-commit" ]]; then
|
||||
git add $config_file
|
||||
|
||||
Reference in New Issue
Block a user