(address . guix-patches@gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
Hi there!
Here’s a simple but oft-requested feature (I remember discussing
with Pierre and Simon a year ago at the Guix Days about ways to
implement it—time flies!): these patches provide ‘guix package
--export-manifest’ and ‘--export-channels’. These options spit
a manifest and a channel spec, respectively, with the goal of
helping users who wish to migrate to the declarative model.
‘--export-manifest’ honors transformations: if entries in the
profile have associated transformations, those are preserved in
the generated manifest. It also honors version specifiers (to
some extent); for example, if you have guile@2.2 in your profile,
it’ll put “guile@2.2” in the manifest, where “2.2” is the
shortest prefix to disambiguate it from the other available
versions of “guile”.
‘--export-channels’ does what you expect. When several commits
of the same channel were used to build your profile, it picks
the last one and adds the other one in a comment.
There’s a catch though: it’s easy to get a large number of
commits. For example, my main profile contains ~300 packages.
I usually upgrade everything at once, so you’d expect to see
a single commit for the ‘guix’ channel. But that’s not the
case: when running ‘guix upgrade’, entries that do not need
to be upgraded are left unchanged, and thus they carry their
original commit. For my profile, the result is:
Toggle snippet (36 lines)
$ guix package --export-channels
;; This channel file can be passed to 'guix pull -C' or to
;; 'guix time-machine -C' to obtain the Guix revision that was
;; used to populate this profile.
(list
;; Note: these other commits were also used to install some of the packages in this profile:
;; "458cb25b9e7e7c954f468023abea2bebb5d8c75b"
;; "4969b51d175497bfcc354c91803e9d70542b7113"
;; "3d85c3ec652feb22824f355538b51e6955ded361"
;; "3462678bc346c2f6ea81245d6842264b6dccd945"
;; "74eeb11daee906cb012f10b6bb3afd254f9ea5c2"
;; "e1f5c2292b88525414b5d0336a00bfa6741d4f14"
;; "3bdb2a026bc9d3967a31a2ccbcd670c018f85d3d"
;; "bf986c3e4325594c1c6a43cf0b67b92262842863"
;; "7607ace5091aea0157ba5c8a508129cc5fc4f931"
;; "98b89f432103b66efacee0bcba41a94148b8e870"
;; "7090159c23d6345992ab976d71fefeb1583cfcdf"
;; "c6872990b51971922f3064cba54ab752fcdc1559"
;; "6ee7468758d7c043692ae8c0b5e130fa4eabe94c"
;; "9744cc7b4636fafb772c94adb8f05961b5b39f16"
;; "d8feee9f18ede0d1ea4d0e4876f09a0dab770295"
;; "b76b1d3fb65fec98b96a2b4cfa984316dd956a29"
(channel
(name 'guix)
(url "/home/ludo/src/guix")
(commit
"c6ca0fceb715340cfb2ba01bfec128aa8d385b92")
(introduction
(make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"
(openpgp-fingerprint
"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))))
)
The long commit list doesn’t look great, but in fact the chosen
commit is almost certainly good enough.
I looked into ‘guix package’ to see if we could update provenance
data for manifest entries that are not upgraded because they’re
already up-to-date (so that we end up with fewer different commits),
and it’s tricky to do that, and maybe not desirable. So I left it
at that.
Anyway, for me the goal of these options is not “disassemble” the
profile and provide its exact source code, but rather to help
migrate to the declarative model. I think it does a good job
at that.
Thoughts?
Ludo’.
Ludovic Courtès (8):
profiles: Add 'manifest->code'.
utils: Add 'version-unique-prefix'.
guix package: Add '--export-manifest'.
channels: Factorize 'manifest-entry-channel' and channel
serialization.
channels: Add the channel name to channel sexps.
guix describe: Use 'manifest-entry-channel'.
channels: Add 'channel->code'.
guix package: Add '--export-channels'.
build-aux/build-self.scm | 3 +
doc/guix.texi | 45 +++++++++++++
guix/build/profiles.scm | 6 +-
guix/channels.scm | 134 ++++++++++++++++++++++++++------------
guix/describe.scm | 34 +++++++++-
guix/profiles.scm | 86 +++++++++++++++++++++++-
guix/scripts/describe.scm | 52 +++++----------
guix/scripts/package.scm | 118 ++++++++++++++++++++++++++++++++-
guix/utils.scm | 35 +++++++++-
tests/guix-package.sh | 10 ++-
tests/profiles.scm | 30 ++++++++-
tests/utils.scm | 8 ++-
12 files changed, 471 insertions(+), 90 deletions(-)
--
2.30.0