summary refs log tree commit diff
path: root/maintainers/scripts/update.nix
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2018-03-01 02:24:26 +0100
committerJan Tojnar <jtojnar@gmail.com>2018-03-01 02:53:00 +0100
commitcb5c630db2fde6b04fe955c4cdb2fcf24753662b (patch)
tree8a0adb130ed59986bce98f003580161282e74faa /maintainers/scripts/update.nix
parentf929f38d5e9e5d2ed7bc0c21e7336de85246c84b (diff)
downloadnixpkgs-cb5c630db2fde6b04fe955c4cdb2fcf24753662b.tar
nixpkgs-cb5c630db2fde6b04fe955c4cdb2fcf24753662b.tar.gz
nixpkgs-cb5c630db2fde6b04fe955c4cdb2fcf24753662b.tar.bz2
nixpkgs-cb5c630db2fde6b04fe955c4cdb2fcf24753662b.tar.lz
nixpkgs-cb5c630db2fde6b04fe955c4cdb2fcf24753662b.tar.xz
nixpkgs-cb5c630db2fde6b04fe955c4cdb2fcf24753662b.tar.zst
nixpkgs-cb5c630db2fde6b04fe955c4cdb2fcf24753662b.zip
maintainers/scripts/update.nix: allow updating package collections
Diffstat (limited to 'maintainers/scripts/update.nix')
-rwxr-xr-xmaintainers/scripts/update.nix17
1 files changed, 16 insertions, 1 deletions
diff --git a/maintainers/scripts/update.nix b/maintainers/scripts/update.nix
index 2c9c0b3bf45..7c54821f66c 100755
--- a/maintainers/scripts/update.nix
+++ b/maintainers/scripts/update.nix
@@ -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: ''