@@ -37,6 +37,7 @@ (define-module (guix channels)
#:autoload (guix git-authenticate) (authenticate-repository)
#:autoload (guix openpgp) (openpgp-public-key-fingerprint
openpgp-format-fingerprint)
+ #:autoload (guix ui) (load* make-user-module)
#:use-module (guix base16)
#:use-module (guix records)
#:use-module (guix gexp)
@@ -111,7 +112,9 @@ (define-module (guix channels)
channel-news-entry-title
channel-news-entry-body
- channel-news-for-commit))
+ channel-news-for-commit
+
+ read-channels-file))
;;; Commentary:
;;;
@@ -1086,6 +1089,15 @@ (define* (channel->code channel #:key (include-introduction? #t))
intro))))))
'()))))
+(define (read-channels-file file)
+ "Return channel list read from FILE.
+
+The file shall have format produced by `guix describe --format=channels'."
+ (let ((result (load* file (make-user-module '((guix channels))))))
+ (if (and (list? result) (every channel? result))
+ result
+ (leave (G_ "'~a' did not return a list of channels~%") file))))
+
;;;
;;; News.
@@ -750,21 +750,15 @@ (define (channel-list opts)
(define global-file
(string-append %sysconfdir "/guix/channels.scm"))
- (define (load-channels file)
- (let ((result (load* file (make-user-module '((guix channels))))))
- (if (and (list? result) (every channel? result))
- result
- (leave (G_ "'~a' did not return a list of channels~%") file))))
-
(define channels
(cond (file
- (load-channels file))
+ (read-channels-file file))
((and (not ignore-channel-files?)
(file-exists? default-file))
- (load-channels default-file))
+ (read-channels-file default-file))
((and (not ignore-channel-files?)
(file-exists? global-file))
- (load-channels global-file))
+ (read-channels-file global-file))
(else
%default-channels)))