about summary refs log tree commit diff
path: root/nixpkgs/pkgs/common-updater
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-10-19 14:40:23 +0000
committerAlyssa Ross <hi@alyssa.is>2022-01-07 10:22:32 +0000
commitcc62bcb55359ba8c5e0fe3a48e778444c89060d8 (patch)
treeca0e21d44eaf8837b687395e614445f7761d7bbd /nixpkgs/pkgs/common-updater
parentd6625e8d25efd829c3cfa227d025ca4e606ae4b7 (diff)
parenta323570a264da96a0b0bcc1c9aa017794acdc752 (diff)
downloadnixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.tar
nixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.tar.gz
nixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.tar.bz2
nixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.tar.lz
nixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.tar.xz
nixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.tar.zst
nixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.zip
Merge commit 'a323570a264da96a0b0bcc1c9aa017794acdc752'
Diffstat (limited to 'nixpkgs/pkgs/common-updater')
-rwxr-xr-xnixpkgs/pkgs/common-updater/scripts/list-archive-two-level-versions2
-rwxr-xr-xnixpkgs/pkgs/common-updater/scripts/list-git-tags2
-rwxr-xr-xnixpkgs/pkgs/common-updater/scripts/update-source-version8
3 files changed, 8 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/common-updater/scripts/list-archive-two-level-versions b/nixpkgs/pkgs/common-updater/scripts/list-archive-two-level-versions
index e46652820ad2..36a051e97c91 100755
--- a/nixpkgs/pkgs/common-updater/scripts/list-archive-two-level-versions
+++ b/nixpkgs/pkgs/common-updater/scripts/list-archive-two-level-versions
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/usr/bin/env bash
 
 # lists all available versions listed for a package in a site (http)
 
diff --git a/nixpkgs/pkgs/common-updater/scripts/list-git-tags b/nixpkgs/pkgs/common-updater/scripts/list-git-tags
index ff09671c7cb0..d137552cdd66 100755
--- a/nixpkgs/pkgs/common-updater/scripts/list-git-tags
+++ b/nixpkgs/pkgs/common-updater/scripts/list-git-tags
@@ -1,4 +1,4 @@
-#! /bin/sh -x
+#!/usr/bin/env bash
 
 # lists all available tags from a git repository
 
diff --git a/nixpkgs/pkgs/common-updater/scripts/update-source-version b/nixpkgs/pkgs/common-updater/scripts/update-source-version
index d5c23466ee03..0ac6b3cf8c28 100755
--- a/nixpkgs/pkgs/common-updater/scripts/update-source-version
+++ b/nixpkgs/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