mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
common-updater-scripts/update-source-version: Fix on Nix 2.4
This commit is contained in:
parent
8ae7cd8a93
commit
17d18904e2
@ -188,7 +188,9 @@ tempHash=$(printf '%0*d' "$hashLength" 0)
|
||||
if [[ -n "$sri" ]]; then
|
||||
# SRI hashes only support base64
|
||||
# SRI hashes need to declare the hash type as part of the hash
|
||||
tempHash="$(nix to-sri --type "$oldHashAlgo" "$tempHash")"
|
||||
tempHash="$(nix hash to-sri --type "$oldHashAlgo" "$tempHash" 2>/dev/null \
|
||||
|| nix to-sri --type "$oldHashAlgo" "$tempHash" 2>/dev/null)" \
|
||||
|| die "Failed to convert hash to SRI representation!"
|
||||
fi
|
||||
|
||||
# Escape regex metacharacter that are allowed in hashes (+)
|
||||
@ -232,7 +234,9 @@ if [[ -z "$newHash" ]]; then
|
||||
|
||||
if [[ -n "$sri" ]]; then
|
||||
# nix-build preserves the hashing scheme so we can just convert the result to SRI using the old type
|
||||
newHash="$(nix to-sri --type "$oldHashAlgo" "$newHash")"
|
||||
newHash="$(nix hash to-sri --type "$oldHashAlgo" "$newHash" 2>/dev/null \
|
||||
|| nix to-sri --type "$oldHashAlgo" "$newHash" 2>/dev/null)" \
|
||||
|| die "Failed to convert hash to SRI representation!"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user