maintainers/scripts/update.nix: allow updating package collections

This commit is contained in:
Jan Tojnar 2018-03-01 02:24:26 +01:00
parent f929f38d5e
commit cb5c630db2
No known key found for this signature in database
GPG key ID: 7FAB2A15F7A607A4

View file

@ -1,5 +1,6 @@
{ package ? null
, maintainer ? null
, path ? null
}:
# TODO: add assert statements
@ -49,6 +50,14 @@ let
(name: pkg: pkg)
pkgs;
packagesWithUpdateScript = path:
let
attrSet = pkgs.lib.attrByPath (pkgs.lib.splitString "." path) null pkgs;
in
packagesWith (name: pkg: builtins.hasAttr "updateScript" pkg)
(name: pkg: pkg)
attrSet;
packageByName = name:
let
package = pkgs.lib.attrByPath (pkgs.lib.splitString "." name) null pkgs;
@ -65,6 +74,8 @@ let
[ (packageByName package) ]
else if maintainer != null then
packagesWithUpdateScriptAndMaintainer maintainer
else if path != null then
packagesWithUpdateScript path
else
builtins.throw "No arguments provided.\n\n${helpText}";
@ -78,7 +89,11 @@ let
% nix-shell maintainers/scripts/update.nix --argstr package garbas
to run update script for specific package.
to run update script for specific package, or
% nix-shell maintainers/scripts/update.nix --argstr path gnome3
to run update script for all package under an attribute path.
'';
runUpdateScript = package: ''