From 4daf81e448799eb72d367e4ea1ea40c7acc71830 Mon Sep 17 00:00:00 2001 From: Muse Sweep Date: Thu, 22 Oct 2026 10:45:23 -0500 Subject: [PATCH 1/2] update-nixpkgs-inputs: exit non-zero when an input update fails (#598) main() counted failed nix flake update runs in the summary but always exited 0, so && chains, CI and cron callers proceeded as if the inputs were updated. Exit 1 after all summaries print when any input failed. The .sh wrapper's || python3 fallback would then have re-run the whole update after a genuine failure; scope it to the cannot-execute exits (126/127, e.g. uv missing for the env -S shebang) and propagate the script's exit status. --- scripts/update-nixpkgs-inputs.py | 12 ++++++++++++ scripts/update-nixpkgs-inputs.sh | 13 +++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/scripts/update-nixpkgs-inputs.py b/scripts/update-nixpkgs-inputs.py index 7e0620c705..e1d569ea04 100755 --- a/scripts/update-nixpkgs-inputs.py +++ b/scripts/update-nixpkgs-inputs.py @@ -313,6 +313,18 @@ def main(): if len(refs) > 1: print_combined_summary(all_ref_data) + # A run that failed to update any input is a failure, even though the + # summaries above printed normally: callers (&& chains, CI, cron) must + # not proceed as if the inputs were updated. + failed_total = sum( + 1 + for rd in all_ref_data + for r in rd["results"] + if r["status"] == "failed" + ) + if failed_total: + sys.exit(1) + if __name__ == "__main__": main() diff --git a/scripts/update-nixpkgs-inputs.sh b/scripts/update-nixpkgs-inputs.sh index a2e2eae9cd..eaba340f01 100755 --- a/scripts/update-nixpkgs-inputs.sh +++ b/scripts/update-nixpkgs-inputs.sh @@ -1,6 +1,15 @@ #!/usr/bin/env bash -# Wrapper: tries uv (via .py shebang) first, falls back to python3 +# Wrapper: tries uv (via .py shebang) first, falls back to python3 only +# when the script cannot be executed at all (exit 126/127, e.g. uv is +# missing) — never after a genuine update failure, which would re-run +# the whole update and mask the first run's results. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT="$SCRIPT_DIR/update-nixpkgs-inputs.py" -"$SCRIPT" "$@" || python3 "$SCRIPT" "$@" +"$SCRIPT" "$@" +status=$? +if [ "$status" -eq 126 ] || [ "$status" -eq 127 ]; then + python3 "$SCRIPT" "$@" + status=$? +fi +exit "$status" From 28554d2ea21e04d2dd4909fc037e2c8bbeab69ee Mon Sep 17 00:00:00 2001 From: Muse Sweep Date: Thu, 22 Oct 2026 10:48:39 -0500 Subject: [PATCH 2/2] treefmt: ruff-format the exit-code tally (#598) --- scripts/update-nixpkgs-inputs.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/update-nixpkgs-inputs.py b/scripts/update-nixpkgs-inputs.py index e1d569ea04..5483459320 100755 --- a/scripts/update-nixpkgs-inputs.py +++ b/scripts/update-nixpkgs-inputs.py @@ -317,10 +317,7 @@ def main(): # summaries above printed normally: callers (&& chains, CI, cron) must # not proceed as if the inputs were updated. failed_total = sum( - 1 - for rd in all_ref_data - for r in rd["results"] - if r["status"] == "failed" + 1 for rd in all_ref_data for r in rd["results"] if r["status"] == "failed" ) if failed_total: sys.exit(1)