3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #139913 from samuelgrf/common-updater-scripts-fixes

common-updater-scripts: fixes
This commit is contained in:
Jan Tojnar 2021-10-09 18:19:35 +02:00 committed by GitHub
commit df315b7b80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View file

@ -1,4 +1,4 @@
#! /bin/sh
#!/usr/bin/env bash
# lists all available versions listed for a package in a site (http)

View file

@ -1,4 +1,4 @@
#! /bin/sh -x
#!/usr/bin/env bash
# lists all available tags from a git repository

View file

@ -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