diff options
author | Samuel Gräfenstein <git@samuelgrf.com> | 2021-10-01 18:37:21 +0200 |
---|---|---|
committer | Samuel Gräfenstein <git@samuelgrf.com> | 2021-10-03 20:24:12 +0200 |
commit | 17d18904e2bed21deea8f65cef27f741adb4ab08 (patch) | |
tree | 1e468e96859a66d7b482c651e4eca7531d3b6db4 | |
parent | 8ae7cd8a93ce916e13bf6bdd76bf5ff68f6e333c (diff) | |
download | nixpkgs-17d18904e2bed21deea8f65cef27f741adb4ab08.tar nixpkgs-17d18904e2bed21deea8f65cef27f741adb4ab08.tar.gz nixpkgs-17d18904e2bed21deea8f65cef27f741adb4ab08.tar.bz2 nixpkgs-17d18904e2bed21deea8f65cef27f741adb4ab08.tar.lz nixpkgs-17d18904e2bed21deea8f65cef27f741adb4ab08.tar.xz nixpkgs-17d18904e2bed21deea8f65cef27f741adb4ab08.tar.zst nixpkgs-17d18904e2bed21deea8f65cef27f741adb4ab08.zip |
common-updater-scripts/update-source-version: Fix on Nix 2.4
-rwxr-xr-x | pkgs/common-updater/scripts/update-source-version | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pkgs/common-updater/scripts/update-source-version b/pkgs/common-updater/scripts/update-source-version index d5c23466ee0..0ac6b3cf8c2 100755 --- a/pkgs/common-updater/scripts/update-source-version +++ b/pkgs/common-updater/scripts/update-source-version @@ -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 |