lol

maintainers/scripts/haskell: add unbreak.nu script

The new script runs through all packages marked as broken in
broken.yaml, tries to build them, and removes them from the file if they
do.

authored by

Wolfgang Walther and committed by
sternenseemann
13517dc5 e2f714df

+31
+31
maintainers/scripts/haskell/unbreak.nu
··· 1 + #! /usr/bin/env nix-shell 2 + #! nix-shell -i nu -p nushell flock gnused -I nixpkgs=. 3 + 4 + # This script tests to build all packages listed in broken.yaml, expecting a build failure. 5 + # It will remove all packages that build fine from the list. 6 + 7 + # Attention: For unknown reasons, the script can't be easily cancelled and needs to be killed manually if it shouldn't run to completion. 8 + 9 + use std log 10 + 11 + let broken_config = "pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml" 12 + 13 + def is-broken [package : string]: nothing -> bool { 14 + let res = with-env { NIXPKGS_ALLOW_BROKEN: "1" } { 15 + # rather high timeout of half an hour, just to prevent never-ending builds 16 + ^nix-build --no-out-link -j 1 --cores 1 --timeout 1800 -A $"haskellPackages.($package)" | complete 17 + } 18 + if $res.exit_code == 0 { 19 + log warning $"($package) is not broken anymore!" 20 + return false 21 + } else { 22 + log info $"($package) is still broken." 23 + log debug $"($package) build log:\n($res.stderr)" 24 + return true 25 + } 26 + } 27 + 28 + def main [] { 29 + $broken_config | open | get broken-packages 30 + | par-each {|package| if not (is-broken $package) { ^flock -x $broken_config -c $"sed -i -e '/^ - ($package) /d' ($broken_config)" }} 31 + }