chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / common-updater / scripts / mark-broken
blob7035bee18604f62289b3eb6b04098bcc3a2c715a
1 #!/usr/bin/env bash
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
15 # OTHER NOTES:
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
23 failMark() {
24 local attr=$1
25 shift 1
27 echo "$attr: $@" >&2
28 echo $attr >> failed-marks.txt
31 usage() {
32 echo "Usage: $scriptName <attrs>"
35 if (( "${#@}" < 1 )); then
36 echo "$scriptName: Too few arguments"
37 usage
38 exit 1
41 # in case we resolve to an auto-generated file, just skip these entries
42 denyFileList=(
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
49 denyAttrList=(
50 python27Packages
51 linuxPackages_
52 rubyPackages_
55 function attemptToMarkBroken() {
56 local attr=$1
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."
62 return
64 done
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"
69 return
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."
76 return
78 done
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?"
88 return
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."
96 return
99 rm -f "$nixFile.bak"
102 for attr in $@; do
103 attemptToMarkBroken $attr
104 done