about summary refs log tree commit diff
path: root/nixpkgs/maintainers/scripts/haskell/mark-broken.sh
blob: 9aa9433b8023a2fe1027ba6a4d73880ee66b793a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils git -I nixpkgs=.

# This script uses the data pulled with
# maintainers/scripts/haskell/hydra-report.hs get-report to produce a list of
# failing builds that get written to the hackage2nix config. Then
# hackage-packages.nix gets regenerated and transitive-broken packages get
# marked as dont-distribute in the config as well.
# This should disable builds for most failing jobs in the haskell-updates jobset.

set -euo pipefail

do_commit=false
mark_broken_list_flags=""

for arg in "$@"; do
    case "$arg" in
        --do-commit)
            do_commit=true
            ;;
        --no-request-logs)
            mark_broken_list_flags="$mark_broken_list_flags $arg"
            ;;
        *)
            echo "$0: unknown flag: $arg"
            exit 100
            ;;
    esac
done

broken_config="pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml"

tmpfile=$(mktemp)
trap "rm ${tmpfile}" 0

echo "Remember that you need to manually run 'maintainers/scripts/haskell/hydra-report.hs get-report' sometime before running this script."
echo "Generating a list of broken builds and displaying for manual confirmation ..."
maintainers/scripts/haskell/hydra-report.hs mark-broken-list $mark_broken_list_flags | sort -i > "$tmpfile"

$EDITOR "$tmpfile"

tail -n +3 "$broken_config" >> "$tmpfile"

cat > "$broken_config" << EOF
broken-packages:
  # These packages don't compile.
EOF

# clear environment here to avoid things like allowing broken builds in
sort -iu "$tmpfile" >> "$broken_config"
clear="env -u HOME -u NIXPKGS_CONFIG"
$clear maintainers/scripts/haskell/regenerate-hackage-packages.sh
evalline=$(maintainers/scripts/haskell/hydra-report.hs eval-info)

if $do_commit; then
git add $broken_config
git add pkgs/development/haskell-modules/configuration-hackage2nix/transitive-broken.yaml
git add pkgs/development/haskell-modules/hackage-packages.nix
git commit -F - << EOF
haskellPackages: mark builds failing on hydra as broken

This commit has been generated by maintainers/scripts/haskell/mark-broken.sh based on
$evalline
from the haskell-updates jobset on hydra under https://hydra.nixos.org/jobset/nixpkgs/haskell-updates
EOF
fi