mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
common-updater-scripts: fix silent error on 404
When TOFU was unable to download the file, there would be no hash in the fetch log, causing the grep to fail. Since the script is set to errexit, it would terminate the processing without any output. Let’s instead print the fetch log.
This commit is contained in:
parent
fde244a8c7
commit
e628b43a9c
@ -237,9 +237,13 @@ fi
|
||||
if [[ -z "$newHash" ]]; then
|
||||
nix-build $systemArg --no-out-link -A "$attr.$sourceKey" 2>"$attr.fetchlog" >/dev/null || true
|
||||
# FIXME: use nix-build --hash here once https://github.com/NixOS/nix/issues/1172 is fixed
|
||||
newHash=$(sed '1,/hash mismatch in fixed-output derivation/d' "$attr.fetchlog" | grep --perl-regexp --only-matching 'got: +.+[:-]\K.+')
|
||||
newHash=$(
|
||||
sed '1,/hash mismatch in fixed-output derivation/d' "$attr.fetchlog" \
|
||||
| grep --perl-regexp --only-matching 'got: +.+[:-]\K.+' \
|
||||
|| true # handled below
|
||||
)
|
||||
|
||||
if [[ -n "$sri" ]]; then
|
||||
if [[ -n "$newHash" && -n "$sri" ]]; then
|
||||
# nix-build preserves the hashing scheme so we can just convert the result to SRI using the old type
|
||||
newHash="$(nix --extra-experimental-features nix-command hash to-sri --type "$oldHashAlgo" "$newHash" 2>/dev/null \
|
||||
|| nix to-sri --type "$oldHashAlgo" "$newHash" 2>/dev/null)" \
|
||||
|
Loading…
Reference in New Issue
Block a user