civodul pushed a commit to branch master
in repository guix.
commit c9fbd40785a99e13a59d8e530830ce85220a9871
Author: Ludovic Courtès <[email protected]>
AuthorDate: Fri Jul 8 12:31:25 2022 +0200
channels: Emit version 3 profiles.
Fixes <https://issues.guix.gnu.org/56441>.
Reported by zimoun <[email protected]>.
Fixes a bug introduced in 4ff12d1de7cd617b791996ee7ca1240660b4c20e with
version 4 of the manifest format. A new 'guix time-machine' would
create a v4 manifest; when targeting an old revision (v3),
'generate-package-cache' would fail to read that manifest and abort.
Furthermore, an old Guix living in a new profile with a v4 manifest
would be unable to describe itself via (guix describe).
* guix/channels.scm (package-cache-file): Add 'format-version' field to
PROFILE.
(channel-instances->derivation): Pass #:format-version to
'profile-derivation'.
---
guix/channels.scm | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/guix/channels.scm b/guix/channels.scm
index ce1a60436f..689b30e0eb 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2018, 2019, 2020, 2021 Ludovic Courtès <[email protected]>
+;;; Copyright © 2018-2022 Ludovic Courtès <[email protected]>
;;; Copyright © 2018 Ricardo Wurmus <[email protected]>
;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <[email protected]>
;;; Copyright © 2021 Brice Waegeneire <[email protected]>
@@ -896,7 +896,12 @@ specified."
(define (package-cache-file manifest)
"Build a package cache file for the instance in MANIFEST. This is meant to
be used as a profile hook."
- (let ((profile (profile (content manifest) (hooks '()))))
+ ;; Note: Emit a profile in format version 3, which was introduced in 2017
+ ;; and is readable by Guix since before version 1.0. This ensures that the
+ ;; Guix in MANIFEST is able to read the manifest file created for its own
+ ;; profile below. See <https://issues.guix.gnu.org/56441>.
+ (let ((profile (profile (content manifest) (hooks '())
+ (format-version 3))))
(define build
#~(begin
(use-modules (gnu packages))
@@ -937,8 +942,12 @@ be used as a profile hook."
"Return the derivation of the profile containing INSTANCES, a list of
channel instances."
(mlet %store-monad ((manifest (channel-instances->manifest instances)))
+ ;; Emit a profile in format version so that, if INSTANCES denotes an old
+ ;; Guix, it can still read that profile, for instance for the purposes of
+ ;; 'guix describe'.
(profile-derivation manifest
- #:hooks %channel-profile-hooks)))
+ #:hooks %channel-profile-hooks
+ #:format-version 3)))
(define latest-channel-instances*
(store-lift latest-channel-instances))