diff --git a/scripts/update-nixpkgs-inputs.py b/scripts/update-nixpkgs-inputs.py index 7e0620c705..5483459320 100755 --- a/scripts/update-nixpkgs-inputs.py +++ b/scripts/update-nixpkgs-inputs.py @@ -313,6 +313,15 @@ 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"