Commit graph

22 commits

Author SHA1 Message Date
Jan Tojnar
c21a85c6a0
maintainers/scripts/update.nix: auto-detect attrPath 2020-09-20 20:11:46 +02:00
Jan Tojnar
4a161ddb3b
maintainers/scripts/update.nix: support auto-committing by passing attrPath
Instead of having the updateScript support returning JSON object,
it should be sufficient to specify attrPath in passthru.updateScript.
It is much easier to use.

The former is now considered experimental.
2020-09-20 20:11:46 +02:00
Jan Tojnar
1efc042d92
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.
2020-09-20 20:11:22 +02:00
Jan Tojnar
5b3fe9f776
update.nix: Allow passing overlays
Previously, we relied on NIX_PATH for passing overlays but with flakes, we should pass them explicitly.
2020-07-07 21:29:32 +02:00
Jan Tojnar
3f3aeb7c85
maintainers/scripts/update.nix: refactor package collector
The `packagesWith` function expected an attrSet but `packagesWithUpdateScript`
could be passing it a derivation or a list when the attribute path
supplied by user through the `--argstr path` argument pointed to one.
It only worked because derivations are also attrSets and contain their
outputs as attributes, and did not work for lists at all.

Additionally, the improper handling would cause the `src` attribute
to be built in some rare cases (`mkYarnPackage` seems to trigger this).

Rewriting the `packagesWith` function to be inductive with a derivation
as a base case and attrSets and lists as inductive steps is much cleaner
and also fixes the unnecessary build.
2020-05-13 12:12:18 +02:00
Jan Tojnar
fab2ee8c10
maintainers/scripts/update.nix: derivation is the final station
It does not make sense to look for derivations within derivations,
not even when `recurseForDerivations` is true. Nix does not do that either:

ebc024df22/src/libexpr/get-drvs.cc (L346-L355)
2020-05-13 11:06:33 +02:00
Jan Tojnar
8f50956ee0
maintainers/scripts/update.nix: Import lib into scope
This will make it easier to change it if we want to decouple from pkgs.
2020-05-13 11:06:33 +02:00
Jan Tojnar
bacb0969f2
maintainers/scripts/update.nix: allow updating overlays 2020-02-19 21:06:42 +01:00
danbst
50db72d548 maintainers update.nix: fix typo in script help 2019-12-20 08:07:44 +02:00
worldofpeace
e716e86bed update.nix: fix eval 2019-11-25 15:08:59 -05:00
John Ericson
9b090ccbca treewide: Get rid of most parseDrvName without breaking compat
That is because this commit should be merged to both master and
release-19.09.
2019-11-24 17:22:28 +00:00
Jan Tojnar
e98c804cc9
maintainers/scripts/update.nix: Clean up
Make calling update.py a little nicer
2019-06-02 09:07:18 +02:00
Jan Tojnar
c3dd31f177
maintainers/scripts/update.nix: handle null paths
Previously we did not handle non-existant paths making the program crash.
Let’s show a proper error.
2019-06-02 09:03:41 +02:00
Jan Tojnar
36b2012447
maintainers/scripts/update.nix: ignore overlays
It makes little sense for update.nix to try to update overlays; for most people,
they will point to a read-only repository most of the cases.
2019-06-02 08:55:29 +02:00
Jan Tojnar
fa1bbe69fb
maintainers/scripts/update.nix: Do not store updateScripts
For update script parallelization, we have started calling builtins.toJSON
on updateScripts, which triggers evaluation of paths and therefore their copying
to Nix store. This breaks update scripts that assume that they exist in nixpkgs
like dwarf-fortress.

https://github.com/NixOS/nixpkgs/issues/61935

Let’s stringify the paths before JSONification to prevent the evaluation.
2019-06-02 08:10:17 +02:00
Jan Tojnar
59a94b57f0
update.nix: Run update scripts in parallel
To make updating large attribute sets faster, the update scripts
are now run in parallel.

Please note the following changes in semantics:

- The string passed to updateScript needs to be a path to an executable file.
- The updateScript can also be a list: the tail elements will then be passed
  to the head as command line arguments.
2018-12-01 19:17:13 +01:00
Matthew Bauer
124d47c65a meta: fix fallout from #36275 2018-03-18 00:16:43 -05:00
Jan Tojnar
2381bcd86f
maintainers/scripts/update.nix: use saner nubbing 2018-03-13 18:04:47 +01:00
Jan Tojnar
9b94dd0999
maintainers/scripts/update.nix: fix error message 2018-03-13 09:04:12 +01:00
Jan Tojnar
cb5c630db2
maintainers/scripts/update.nix: allow updating package collections 2018-03-01 02:53:00 +01:00
Jan Tojnar
f929f38d5e
maintainers/scripts/update.nix: deduplicate packages
Lot of my GNOME packages have several legacy aliases,
which causes them to be updated multiple times.

This patch uses lib.unique to remove the duplicates.
2018-03-01 02:53:00 +01:00
Rok Garbas
56cb5b7609 update.nix moved to maintainers/scripts/update.nix 2016-12-18 16:45:33 +01:00
Renamed from update.nix (Browse further)