guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/08: channels: Save and interpret 'introduction' field in provenance d


From: guix-commits
Subject: 04/08: channels: Save and interpret 'introduction' field in provenance data.
Date: Wed, 1 Jul 2020 17:48:54 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 471550c28cb425c15f8f5fa61fdeb885f479e2ae
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Thu Jun 25 17:36:03 2020 +0200

    channels: Save and interpret 'introduction' field in provenance data.
    
    With this change, profiles created by 'guix pull' & co. include channel
    introductions as part of the channel metadata of each manifest entry.
    
    * guix/channels.scm (channel-instances->manifest)[instance->entry]: Add
    'introduction' field when CHANNEL has an introduction.
    (profile-channels)[sexp->channel-introduction]: New procedure.
    Use it to initialize the 'introduction' field.
---
 guix/channels.scm | 36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/guix/channels.scm b/guix/channels.scm
index 922c99a..32ada7b 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -851,8 +851,9 @@ derivation."
   "Return a profile manifest with entries for all of INSTANCES, a list of
 channel instances."
   (define (instance->entry instance drv)
-    (let ((commit  (channel-instance-commit instance))
-          (channel (channel-instance-channel instance)))
+    (let* ((commit  (channel-instance-commit instance))
+           (channel (channel-instance-channel instance))
+           (intro   (channel-introduction channel)))
       (manifest-entry
         (name (symbol->string (channel-name channel)))
         (version (string-take commit 7))
@@ -867,7 +868,19 @@ channel instances."
                     (version 0)
                     (url ,(channel-url channel))
                     (branch ,(channel-branch channel))
-                    (commit ,commit))))))))
+                    (commit ,commit)
+                    ,@(if intro
+                          `((introduction
+                             (channel-introduction
+                              (version 0)
+                              (commit
+                               ,(channel-introduction-first-signed-commit
+                                 intro))
+                              (signer
+                               ,(openpgp-format-fingerprint
+                                 (channel-introduction-first-commit-signer
+                                  intro))))))
+                          '()))))))))
 
   (mlet* %store-monad ((derivations (channel-instance-derivations instances))
                        (entries ->  (map instance->entry instances 
derivations)))
@@ -935,17 +948,30 @@ to 'latest-channel-instances'."
 (define (profile-channels profile)
   "Return the list of channels corresponding to entries in PROFILE.  If
 PROFILE is not a profile created by 'guix pull', return the empty list."
+  (define sexp->channel-introduction
+    (match-lambda
+      (('channel-introduction ('version 0)
+                              ('commit commit) ('signer signer)
+                              _ ...)
+       (make-channel-introduction commit (openpgp-fingerprint signer)))
+      (x #f)))
+
   (filter-map (lambda (entry)
                 (match (assq 'source (manifest-entry-properties entry))
                   (('source ('repository ('version 0)
                                          ('url url)
                                          ('branch branch)
                                          ('commit commit)
-                                         _ ...))
+                                         rest ...))
                    (channel (name (string->symbol
                                    (manifest-entry-name entry)))
                             (url url)
-                            (commit commit)))
+                            (commit commit)
+                            (introduction
+                             (match (assq 'introduction rest)
+                               (#f #f)
+                               (('introduction intro)
+                                (sexp->channel-introduction intro))))))
 
                   ;; No channel information for this manifest entry.
                   ;; XXX: Pre-0.15.0 Guix did not provide that information,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]