3 # This script is meant to be used to mark failing hydra builds as broken in the meta attrs
4 # To use the script, you should pass the list of failing attrs as arguments to the script.
6 # Example: `cat failing-attrs | xargs ./pkgs/common-updater/scripts/mark-broken`
8 # Generating a list of failing attrs: (this should be improved at a later date)
9 # - Go to the most recent hydra evaluation with all builds completed
10 # - Select the "builds still failing" tab
11 # - Highlight and select all packages, should be prefixed with `nixpkgs.`
12 # - Use regex and editor foo to leave only the attr names
13 # - Use the above example command to then execute the script
16 # - The `denyFileList` and `denyAttrList` will likely need to be updated slightly
17 # to align with the conventions used in nixpkgs at execution time
18 # - Any attrs which failed for any reason will be written to `failed-marks.txt`.
19 # Those attrs will likely need manual attention as disablement will likely be conditional.
21 scriptName
=mark-broken
# do not use the .wrapped name
28 echo $attr >> failed-marks.txt
32 echo "Usage: $scriptName <attrs>"
35 if (( "${#@}" < 1 )); then
36 echo "$scriptName: Too few arguments"
41 # in case we resolve to an auto-generated file, just skip these entries
43 node-packages.nix
# node, it will mark all node packages as broken
44 generic-builder.nix
# haskell, it will mark all haskell packages as broken
47 # ignore older versions of parameterized packages sets, these likely need
48 # to be conditionally disabled
55 function attemptToMarkBroken
() {
58 # skip likely to be noisy attrs
59 for badAttr
in ${denyAttrList[@]};do
60 if [[ $attr =~
$badAttr ]]; then
61 failMark
$attr "attr contained $badAttr, skipped."
66 nixFile
=$
(nix-instantiate
--eval --json -E "with import ./. {}; (builtins.unsafeGetAttrPos \"description\" $attr.meta).file" 2>/dev
/null | jq
-r .
)
67 if [[ ! -f "$nixFile" ]]; then
68 failMark
$attr "Couldn't locate correct file"
72 # skip files which are auto-generated
73 for filename
in ${denyFileList[@]};do
74 if [[ "$filename" == $
(basename $nixFile) ]]; then
75 failMark
$attr "filename matched $filename, skipped."
80 # Insert broken attribute
81 sed -i.bak
"$nixFile" -r \
82 -e "/^\s*broken\s*=.*$/d" \
83 -e "s/(\s*)meta\s*=.*\{/&\n\1 broken = true;/"
85 if cmp -s "$nixFile" "$nixFile.bak"; then
86 mv "$nixFile.bak" "$nixFile"
87 failMark
$attr "Does it have a meta attribute?"
91 # broken should evaluate to true in any case now
92 markedSuccessfully
=$
(nix-instantiate
--eval -E "with import ./. {}; $attr.meta.broken")
93 if [[ "$markedSuccessfully" != "true" ]]; then
94 mv "$nixFile.bak" "$nixFile"
95 failMark
$attr "$attr.meta.broken doesn't evaluate to true."
103 attemptToMarkBroken
$attr