Merge pull request #193119 from jtojnar/updatescript-residue
Backport updateScript fixes from GNOME branch
This commit is contained in:
commit
cd0b791eaa
3 changed files with 15 additions and 3 deletions
|
@ -237,9 +237,13 @@ fi
|
|||
if [[ -z "$newHash" ]]; then
|
||||
nix-build $systemArg --no-out-link -A "$attr.$sourceKey" 2>"$attr.fetchlog" >/dev/null || true
|
||||
# FIXME: use nix-build --hash here once https://github.com/NixOS/nix/issues/1172 is fixed
|
||||
newHash=$(sed '1,/hash mismatch in fixed-output derivation/d' "$attr.fetchlog" | grep --perl-regexp --only-matching 'got: +.+[:-]\K.+')
|
||||
newHash=$(
|
||||
sed '1,/hash mismatch in fixed-output derivation/d' "$attr.fetchlog" \
|
||||
| grep --perl-regexp --only-matching 'got: +.+[:-]\K.+' \
|
||||
|| true # handled below
|
||||
)
|
||||
|
||||
if [[ -n "$sri" ]]; then
|
||||
if [[ -n "$newHash" && -n "$sri" ]]; then
|
||||
# nix-build preserves the hashing scheme so we can just convert the result to SRI using the old type
|
||||
newHash="$(nix --extra-experimental-features nix-command hash to-sri --type "$oldHashAlgo" "$newHash" 2>/dev/null \
|
||||
|| nix to-sri --type "$oldHashAlgo" "$newHash" 2>/dev/null)" \
|
||||
|
|
|
@ -12,7 +12,13 @@ let
|
|||
minorAvailable = builtins.length versionComponents > 1 && builtins.match "[0-9]+" minorVersion != null;
|
||||
nextMinor = builtins.fromJSON minorVersion + 1;
|
||||
upperBound = "${lib.versions.major packageVersion}.${builtins.toString nextMinor}";
|
||||
in lib.optionals (freeze && minorAvailable) [ upperBound ];
|
||||
in
|
||||
if builtins.isBool freeze then
|
||||
lib.optionals (freeze && minorAvailable) [ upperBound ]
|
||||
else if builtins.isString freeze then
|
||||
[ freeze ]
|
||||
else
|
||||
throw "“freeze” argument needs to be either a boolean, or a version string.";
|
||||
updateScript = writeScript "gnome-update-script" ''
|
||||
#!${bash}/bin/bash
|
||||
set -o errexit
|
||||
|
|
|
@ -74,6 +74,8 @@ stdenv.mkDerivation rec {
|
|||
updateScript = gnome.updateScript {
|
||||
packageName = pname;
|
||||
versionPolicy = "odd-unstable";
|
||||
# Version 40.alpha preceded version 4.0.
|
||||
freeze = "40.alpha";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue