Skip to content

Commit

Permalink
common-updater-scripts/update-source-version: Fix on Nix 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgrf committed Oct 3, 2021
1 parent 8ae7cd8 commit 17d1890
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkgs/common-updater/scripts/update-source-version
Original file line number Diff line number Diff line change
Expand Up @@ -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 (+)
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 17d1890

Please sign in to comment.