Hello!

Nixpkgs now has a Guile script under maintainers/scripts/gnu/gnupdate
that can be used to automatically update GNU packages in Nixpkgs.
Here’s what it does:

  1. Parse the output of “nix-instantiate --xml --strict --eval-only” on
     Nixpkgs (35 MiB worth of XML...) as SXML.

  2. Turn SXML into “SNix”, a form that is more easily processable from
     Scheme (e.g., <string> items are converted to Scheme strings).

  3. Traverse that SXML tree to identify GNU packages based on the
     contents of ‘meta.description’ and ‘meta.homepage’.

  4. For each GNU package, find out the latest release by looking for it
     on ftp.gnu.org or similar.

  5. When a new version is available, download it with
     ‘nix-prefetch-url’, using the same archive type as currently used
     by the Nix expression (e.g., if the Nix expression uses a tar.bz2
     file, get a tar.bz2 file, not a tar.gz).

  6. Check the GPG signature on that file (this assumes that the
     caller’s GPG keyring contains the public key).

  7. Run sed(1) on the file containing the Nix expression to replace the
     version number and hash.  (Current SVN trunk of Nix provides the
     necessary source location information in the XML output.)

After that one still needs to build the modified packages to make sure
they actually build before committing.

Items #1 and #2 are serious bottlenecks in terms of performance and
memory consumption.  Ideally, Eelco would provide us with a simple C API
to the evaluator that people could easily wrap in their favorite
language.  :-)  Nevertheless, it doesn’t matter so much if it’s slow.

Future work includes:

  * Adding support for projects that store releases in version-dependent
    sub-directories (this includes Gnash, IceCat, and MyServer).

  * Using SSAX to avoid the SXML phase altogether.

  * Possibly running ‘nix-build’ automatically for packages not in
    ‘stdenv’ and committing automatically if the build passes.

A bit of a sledgehammer, but lots of fun.  :-)

Thanks,
Ludo’.

Attachment: pgpTrMM43SezI.pgp
Description: PGP signature

_______________________________________________
nix-dev mailing list
nix-dev@cs.uu.nl
https://mail.cs.uu.nl/mailman/listinfo/nix-dev

Reply via email to