Skip to content
Snippets Groups Projects
Unverified Commit c3f6f564 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

channels: Automatically add introduction for the official 'guix' channel.

This is useful when people run "guix time-machine -C channels.scm",
where 'channels.scm' misses channel introductions.

* guix/channels.scm (%default-channel-url): New variable.
(%default-channels): Use it.
(ensure-default-introduction): New procedure.
(latest-channel-instance): Call it.
parent a941e8fe
No related branches found
No related tags found
No related merge requests found
...@@ -148,18 +148,32 @@ (define %guix-channel-introduction ...@@ -148,18 +148,32 @@ (define %guix-channel-introduction
"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))) "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA")))
#f)) ;TODO: Add an intro signature so it can be exported. #f)) ;TODO: Add an intro signature so it can be exported.
(define %default-channel-url
;; URL of the default 'guix' channel.
"https://git.savannah.gnu.org/git/guix.git")
(define %default-channels (define %default-channels
;; Default list of channels. ;; Default list of channels.
(list (channel (list (channel
(name 'guix) (name 'guix)
(branch "master") (branch "master")
(url "https://git.savannah.gnu.org/git/guix.git") (url %default-channel-url)
(introduction %guix-channel-introduction)))) (introduction %guix-channel-introduction))))
(define (guix-channel? channel) (define (guix-channel? channel)
"Return true if CHANNEL is the 'guix' channel." "Return true if CHANNEL is the 'guix' channel."
(eq? 'guix (channel-name channel))) (eq? 'guix (channel-name channel)))
(define (ensure-default-introduction chan)
"If CHAN represents the \"official\" 'guix' channel and lacks an
introduction, add it."
(if (and (guix-channel? chan)
(not (channel-introduction chan))
(string=? (channel-url chan) %default-channel-url))
(channel (inherit chan)
(introduction %guix-channel-introduction))
chan))
(define-record-type <channel-instance> (define-record-type <channel-instance>
(channel-instance channel commit checkout) (channel-instance channel commit checkout)
channel-instance? channel-instance?
...@@ -385,7 +399,9 @@ (define (dot-git? file stat) ...@@ -385,7 +399,9 @@ (define (dot-git? file stat)
(and (string=? (basename file) ".git") (and (string=? (basename file) ".git")
(eq? 'directory (stat:type stat)))) (eq? 'directory (stat:type stat))))
(let-values (((checkout commit relation) (let-values (((channel)
(ensure-default-introduction channel))
((checkout commit relation)
(update-cached-checkout (channel-url channel) (update-cached-checkout (channel-url channel)
#:ref (channel-reference channel) #:ref (channel-reference channel)
#:starting-commit starting-commit))) #:starting-commit starting-commit)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment