nuclei: 3.3.5 -> 3.3.6 (#358083)
[NixPkgs.git] / maintainers / scripts / haskell / mark-broken.sh
blob9aa9433b8023a2fe1027ba6a4d73880ee66b793a
1 #! /usr/bin/env nix-shell
2 #! nix-shell -i bash -p coreutils git -I nixpkgs=.
4 # This script uses the data pulled with
5 # maintainers/scripts/haskell/hydra-report.hs get-report to produce a list of
6 # failing builds that get written to the hackage2nix config. Then
7 # hackage-packages.nix gets regenerated and transitive-broken packages get
8 # marked as dont-distribute in the config as well.
9 # This should disable builds for most failing jobs in the haskell-updates jobset.
11 set -euo pipefail
13 do_commit=false
14 mark_broken_list_flags=""
16 for arg in "$@"; do
17 case "$arg" in
18 --do-commit)
19 do_commit=true
21 --no-request-logs)
22 mark_broken_list_flags="$mark_broken_list_flags $arg"
25 echo "$0: unknown flag: $arg"
26 exit 100
28 esac
29 done
31 broken_config="pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml"
33 tmpfile=$(mktemp)
34 trap "rm ${tmpfile}" 0
36 echo "Remember that you need to manually run 'maintainers/scripts/haskell/hydra-report.hs get-report' sometime before running this script."
37 echo "Generating a list of broken builds and displaying for manual confirmation ..."
38 maintainers/scripts/haskell/hydra-report.hs mark-broken-list $mark_broken_list_flags | sort -i > "$tmpfile"
40 $EDITOR "$tmpfile"
42 tail -n +3 "$broken_config" >> "$tmpfile"
44 cat > "$broken_config" << EOF
45 broken-packages:
46 # These packages don't compile.
47 EOF
49 # clear environment here to avoid things like allowing broken builds in
50 sort -iu "$tmpfile" >> "$broken_config"
51 clear="env -u HOME -u NIXPKGS_CONFIG"
52 $clear maintainers/scripts/haskell/regenerate-hackage-packages.sh
53 evalline=$(maintainers/scripts/haskell/hydra-report.hs eval-info)
55 if $do_commit; then
56 git add $broken_config
57 git add pkgs/development/haskell-modules/configuration-hackage2nix/transitive-broken.yaml
58 git add pkgs/development/haskell-modules/hackage-packages.nix
59 git commit -F - << EOF
60 haskellPackages: mark builds failing on hydra as broken
62 This commit has been generated by maintainers/scripts/haskell/mark-broken.sh based on
63 $evalline
64 from the haskell-updates jobset on hydra under https://hydra.nixos.org/jobset/nixpkgs/haskell-updates
65 EOF