aboutsummaryrefslogtreecommitdiff
path: root/gnu/services.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-06-25 17:54:55 +0200
committerLudovic Courtès <ludo@gnu.org>2020-07-01 23:34:51 +0200
commiteb5cf39e66a51eb357ca0c08f4409d00ec3b24a9 (patch)
tree0748ab8b9c0b983fa4c6a677dcff386fc58a58fd /gnu/services.scm
parent6d39f0cb7791ff1a6feb0084dad9851a820a900c (diff)
downloadguix-eb5cf39e66a51eb357ca0c08f4409d00ec3b24a9.tar
guix-eb5cf39e66a51eb357ca0c08f4409d00ec3b24a9.tar.gz
services: provenance: Save channel introductions.
* gnu/services.scm (channel->code): Include CHANNEL's introduction, if any, unless CHANNEL is the singleton %DEFAULT-CHANNELS. (channel->sexp): Add comment. * guix/scripts/system.scm (sexp->channel): Change pattern to allow for extensibility.
Diffstat (limited to 'gnu/services.scm')
-rw-r--r--gnu/services.scm26
1 files changed, 22 insertions, 4 deletions
diff --git a/gnu/services.scm b/gnu/services.scm
index 27e5558231..f6dc56d940 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -31,6 +31,7 @@
#:use-module (guix sets)
#:use-module (guix ui)
#:use-module ((guix utils) #:select (source-properties->location))
+ #:autoload (guix openpgp) (openpgp-format-fingerprint)
#:use-module (guix modules)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
@@ -392,14 +393,31 @@ by the initrd once the root file system is mounted.")))
(define (channel->code channel)
"Return code to build CHANNEL, ready to be dropped in a 'channels.scm'
file."
- `(channel (name ',(channel-name channel))
- (url ,(channel-url channel))
- (branch ,(channel-branch channel))
- (commit ,(channel-commit channel))))
+ ;; Since the 'introduction' field is backward-incompatible, and since it's
+ ;; optional when using the "official" 'guix channel, include it if and only
+ ;; if we're referring to a different channel.
+ (let ((intro (and (not (equal? (list channel) %default-channels))
+ (channel-introduction channel))))
+ `(channel (name ',(channel-name channel))
+ (url ,(channel-url channel))
+ (branch ,(channel-branch channel))
+ (commit ,(channel-commit channel))
+ ,@(if intro
+ `((introduction
+ (make-channel-introduction
+ ,(channel-introduction-first-signed-commit intro)
+ (openpgp-fingerprint
+ ,(openpgp-format-fingerprint
+ (channel-introduction-first-commit-signer
+ intro))))))
+ '()))))
(define (channel->sexp channel)
"Return an sexp describing CHANNEL. The sexp is _not_ code and is meant to
be parsed by tools; it's potentially more future-proof than code."
+ ;; TODO: Add CHANNEL's introduction. Currently we can't do that because
+ ;; older 'guix system describe' expect exactly name/url/branch/commit
+ ;; without any additional fields.
`(channel (name ,(channel-name channel))
(url ,(channel-url channel))
(branch ,(channel-branch channel))