From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 16 13:30:06 2021 Received: (at submit) by debbugs.gnu.org; 16 Jan 2021 18:30:06 +0000 Received: from localhost ([127.0.0.1]:44009 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0qKs-0002Mh-CA for submit@debbugs.gnu.org; Sat, 16 Jan 2021 13:30:06 -0500 Received: from lists.gnu.org ([209.51.188.17]:57778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0qKr-0002MZ-97 for submit@debbugs.gnu.org; Sat, 16 Jan 2021 13:30:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0qKr-00026V-2G for guix-patches@gnu.org; Sat, 16 Jan 2021 13:30:05 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57074) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0qKq-0004So-Qv; Sat, 16 Jan 2021 13:30:04 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=36368 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l0qKq-0004pQ-3L; Sat, 16 Jan 2021 13:30:04 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH 0/8] Exporting a manifest and channels from a profile Date: Sat, 16 Jan 2021 19:29:57 +0100 Message-Id: <20210116182957.31075-1-ludo@gnu.org> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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: --8<---------------cut here---------------start------------->8--- $ 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")))) ) --8<---------------cut here---------------end--------------->8--- 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