gnome.updateScript: Support freezing up to an explicit version

libgweather released version 4 after releasing version 40,
we need to ignore the latter.
This commit is contained in:
Jan Tojnar 2022-09-24 14:58:58 +02:00
parent e628b43a9c
commit a5af361af4

View file

@ -12,7 +12,13 @@ let
minorAvailable = builtins.length versionComponents > 1 && builtins.match "[0-9]+" minorVersion != null; minorAvailable = builtins.length versionComponents > 1 && builtins.match "[0-9]+" minorVersion != null;
nextMinor = builtins.fromJSON minorVersion + 1; nextMinor = builtins.fromJSON minorVersion + 1;
upperBound = "${lib.versions.major packageVersion}.${builtins.toString nextMinor}"; 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" '' updateScript = writeScript "gnome-update-script" ''
#!${bash}/bin/bash #!${bash}/bin/bash
set -o errexit set -o errexit