From e628b43a9c2aff685e420028b58a4376e3117c8a Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 24 Sep 2022 14:52:38 +0200 Subject: [PATCH 1/3] common-updater-scripts: fix silent error on 404 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When TOFU was unable to download the file, there would be no hash in the fetch log, causing the grep to fail. Since the script is set to errexit, it would terminate the processing without any output. Let’s instead print the fetch log. --- pkgs/common-updater/scripts/update-source-version | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/common-updater/scripts/update-source-version b/pkgs/common-updater/scripts/update-source-version index 12a63fa92605..75ad6e7a5cf5 100755 --- a/pkgs/common-updater/scripts/update-source-version +++ b/pkgs/common-updater/scripts/update-source-version @@ -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)" \ From a5af361af4d6cda34611bde73e51e1d7bb438827 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 24 Sep 2022 14:58:58 +0200 Subject: [PATCH 2/3] gnome.updateScript: Support freezing up to an explicit version libgweather released version 4 after releasing version 40, we need to ignore the latter. --- pkgs/desktops/gnome/update.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/desktops/gnome/update.nix b/pkgs/desktops/gnome/update.nix index f5db71174ad8..e945e005d48d 100644 --- a/pkgs/desktops/gnome/update.nix +++ b/pkgs/desktops/gnome/update.nix @@ -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 From 34d4ea2781a4d70aa71b6768280c2bf6af081953 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 27 Sep 2022 02:13:47 +0200 Subject: [PATCH 3/3] libgweather: Fix update script downloading wrong version Previous maintainer released version 40 but the current maintainer decided that it was a bad idea and continued with version 4. This was confusing our update script. --- pkgs/development/libraries/libgweather/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/libgweather/default.nix b/pkgs/development/libraries/libgweather/default.nix index cae2095f8ebd..bc9a04685840 100644 --- a/pkgs/development/libraries/libgweather/default.nix +++ b/pkgs/development/libraries/libgweather/default.nix @@ -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"; }; };