summaryrefslogtreecommitdiff
path: root/guix/channels.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-01-10 18:57:01 +0100
committerLudovic Courtès <ludo@gnu.org>2021-02-01 17:32:35 +0100
commita47f16a874356ca6a1459176561ec7e66c00ba19 (patch)
tree51fc2acf5213de0b04153af09cda64c9e05c2d6f /guix/channels.scm
parent9272cc700efbc5b80f1d3e0d43017304f37a3aeb (diff)
channels: Add the channel name to channel sexps.
* guix/channels.scm (channel-instance->sexp): Add 'name'. (sexp->channel): Extract the name from SEXP, using the optional argument as a fallback.
Diffstat (limited to 'guix/channels.scm')
-rw-r--r--guix/channels.scm15
1 files changed, 11 insertions, 4 deletions
diff --git a/guix/channels.scm b/guix/channels.scm
index 65a0d849ec..6449221c3f 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -812,6 +812,7 @@ derivation."
(url ,(channel-url channel))
(branch ,(channel-branch channel))
(commit ,commit)
+ (name ,(channel-name channel))
,@(if intro
`((introduction
(channel-introduction
@@ -907,16 +908,22 @@ to 'latest-channel-instances'."
(channel-instances->derivation instances)))
(define* (sexp->channel sexp #:optional (name 'channel))
- "Read SEXP, a provenance sexp as created by 'channel-instance->sexp',
-and return a channel called NAME. Return #f if the sexp does not have the
-expected structure."
+ "Read SEXP, a provenance sexp as created by 'channel-instance->sexp'; use
+NAME as the channel name if SEXP does not specify it. Return #f if the sexp
+does not have the expected structure."
(match sexp
(('repository ('version 0)
('url url)
('branch branch)
('commit commit)
rest ...)
- (channel (name name)
+ ;; Historically channel sexps did not include the channel name. It's OK
+ ;; for channels created by 'channel-instances->manifest' because the
+ ;; entry name is the channel name, but it was missing for entries created
+ ;; by 'manifest-entry-with-provenance'.
+ (channel (name (match (assq 'name rest)
+ (#f name)
+ (('name name) name)))
(url url)
(commit commit)
(introduction