summaryrefslogtreecommitdiffstats
path: root/maintainers/scripts/update.nix
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2019-04-12 19:32:44 +0200
committerJan Tojnar <jtojnar@gmail.com>2020-09-20 20:11:22 +0200
commit1efc042d92c0f20be6261be73e462789596fff09 (patch)
tree5eb9104f3710c720de30c294310f9a6f916debc8 /maintainers/scripts/update.nix
parentd351cea9f3a041c88d79fe9be5467bc7faabb4a4 (diff)
maintainers/scripts/update.nix: Add support for auto-commiting changes
Update scripts can now declare features using passthru.updateScript = { command = [ ../../update.sh pname ]; supportedFeatures = [ "commit" ]; }; A `commit` feature means that when the update script finishes successfully, it will print a JSON list like the following: [ { "attrPath": "volume_key", "oldVersion": "0.3.11", "newVersion": "0.3.12", "files": [ "/path/to/nixpkgs/pkgs/development/libraries/volume-key/default.nix" ] } ] and data from that will be used when update.nix is run with --argstr commit true to create commits. We will create a new git worktree for each thread in the pool and run the update script there. Then we will commit the change and cherry pick it in the main repo, releasing the worktree for a next change.
Diffstat (limited to 'maintainers/scripts/update.nix')
-rwxr-xr-xmaintainers/scripts/update.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/maintainers/scripts/update.nix b/maintainers/scripts/update.nix
index 9568c6cbbccd..e11e2450bd0a 100755
--- a/maintainers/scripts/update.nix
+++ b/maintainers/scripts/update.nix
@@ -4,6 +4,7 @@
, max-workers ? null
, include-overlays ? false
, keep-going ? null
+, commit ? null
}:
# TODO: add assert statements
@@ -132,19 +133,26 @@ let
--argstr keep-going true
to continue running when a single update fails.
+
+ You can also make the updater automatically commit on your behalf from updateScripts
+ that support it by adding
+
+ --argstr commit true
'';
packageData = package: {
name = package.name;
pname = lib.getName package;
- updateScript = map builtins.toString (lib.toList package.updateScript);
+ updateScript = map builtins.toString (lib.toList (package.updateScript.command or package.updateScript));
+ supportedFeatures = package.updateScript.supportedFeatures or [];
};
packagesJson = pkgs.writeText "packages.json" (builtins.toJSON (map packageData packages));
optionalArgs =
lib.optional (max-workers != null) "--max-workers=${max-workers}"
- ++ lib.optional (keep-going == "true") "--keep-going";
+ ++ lib.optional (keep-going == "true") "--keep-going"
+ ++ lib.optional (commit == "true") "--commit";
args = [ packagesJson ] ++ optionalArgs;