1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 19:51:17 +00:00

gnome.updateScript: Use experimental support for custom commit messages

This commit is contained in:
Jan Tojnar 2022-02-16 18:52:36 +01:00
parent 3cce255fc1
commit 5b8320d446
2 changed files with 15 additions and 7 deletions

View file

@ -147,7 +147,7 @@ let
to run update script for specific package, or
% nix-shell maintainers/scripts/update.nix --arg predicate '(path: pkg: builtins.isList pkg.updateScript && builtins.length pkg.updateScript >= 1 && (let script = builtins.head pkg.updateScript; in builtins.isAttrs script && script.name == "gnome-update-script"))'
% nix-shell maintainers/scripts/update.nix --arg predicate '(path: pkg: pkg.updateScript.name or null == "gnome-update-script")'
to run update script for all packages matching given predicate, or

View file

@ -3,10 +3,10 @@
let
python = python3.withPackages (p: [ p.requests p.libversion ]);
package = lib.attrByPath (lib.splitString "." attrPath) (throw "Cannot find attribute ${attrPath}.") pkgs;
packageVersion = lib.getVersion package;
upperBoundFlag =
let
package = lib.attrByPath (lib.splitString "." attrPath) (throw "Cannot find attribute ${attrPath}.") pkgs;
packageVersion = lib.getVersion package;
versionComponents = lib.versions.splitVersion packageVersion;
minorVersion = lib.versions.minor packageVersion;
minorAvailable = builtins.length versionComponents > 1 && builtins.match "[0-9]+" minorVersion != null;
@ -16,11 +16,19 @@ let
updateScript = writeScript "gnome-update-script" ''
#!${stdenv.shell}
set -o errexit
package_name="$1"
attr_path="$2"
version_policy="$3"
attr_path="$1"
package_name="$2"
package_version="$3"
version_policy="$4"
PATH=${lib.makeBinPath [ common-updater-scripts python ]}
latest_tag=$(python "${./find-latest-version.py}" "$package_name" "$version_policy" "stable" ${upperBoundFlag})
update-source-version "$attr_path" "$latest_tag"
echo '[ { "commitBody": "https://gitlab.gnome.org/GNOME/'$package_name'/-/compare/'$package_version'...'$latest_tag'" } ]'
'';
in [ updateScript packageName attrPath versionPolicy ]
in {
name = "gnome-update-script";
command = [ updateScript attrPath packageName packageVersion versionPolicy ];
supportedFeatures = [
"commit"
];
}