Skip to content

Commit

Permalink
gnome.updateScript: Use experimental support for custom commit messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jtojnar committed Feb 21, 2022
1 parent 3cce255 commit 5b8320d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion maintainers/scripts/update.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 14 additions & 6 deletions pkgs/desktops/gnome/update.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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"
];
}

0 comments on commit 5b8320d

Please sign in to comment.