summaryrefslogtreecommitdiff
path: root/guix/describe.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-05-09 17:22:24 +0200
committerLudovic Courtès <ludo@gnu.org>2021-05-09 23:46:46 +0200
commit8a154c29151fc445e8d0364f507f6e200de1e700 (patch)
treebca633357bf0f0648e35268db00f50b1800b37b8 /guix/describe.scm
parent9562a2eb6162ea6712fe31529c30002a83313dd8 (diff)
describe: Gracefully handle profiles that lack provenance info.
Fixes <https://bugs.gnu.org/48313>. Previously, 'current-channels' would return the empty list when 'current-profile' is true but the profile lacks provenance info. * guix/describe.scm (current-channels)[build-time-metadata]: New procedure. Call it when 'manifest-entry-channel' returns #f for all of ENTRIES. * guix/scripts/describe.scm (guix-describe): When PROFILE is true, pass third argument to 'display-profile-info'.
Diffstat (limited to 'guix/describe.scm')
-rw-r--r--guix/describe.scm17
1 files changed, 13 insertions, 4 deletions
diff --git a/guix/describe.scm b/guix/describe.scm
index 0683ad8a27..711b7b4290 100644
--- a/guix/describe.scm
+++ b/guix/describe.scm
@@ -122,15 +122,24 @@ lives in, or the empty list if this is not applicable."
(mlambda ()
"Return the list of channels currently available, including the 'guix'
channel. Return the empty list if this information is missing."
+ (define (build-time-metadata)
+ (match (channel-metadata)
+ (#f '())
+ (sexp (or (and=> (sexp->channel sexp 'guix) list) '()))))
+
(match (current-profile-entries)
(()
;; As a fallback, if we're not running from a profile, use 'guix'
;; channel metadata from (guix config).
- (match (channel-metadata)
- (#f '())
- (sexp (or (and=> (sexp->channel sexp 'guix) list) '()))))
+ (build-time-metadata))
(entries
- (filter-map manifest-entry-channel entries)))))
+ (match (filter-map manifest-entry-channel entries)
+ (()
+ ;; This profile lacks provenance metadata, so fall back to
+ ;; build-time metadata as returned by 'channel-metadata'.
+ (build-time-metadata))
+ (lst
+ lst))))))
(define (package-path-entries)
"Return two values: the list of package path entries to be added to the