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'.
This commit is contained in:
parent
9562a2eb61
commit
8a154c2915
@ -122,15 +122,24 @@ lives in, or the empty list if this is not applicable."
|
|||||||
(mlambda ()
|
(mlambda ()
|
||||||
"Return the list of channels currently available, including the 'guix'
|
"Return the list of channels currently available, including the 'guix'
|
||||||
channel. Return the empty list if this information is missing."
|
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)
|
(match (current-profile-entries)
|
||||||
(()
|
(()
|
||||||
;; As a fallback, if we're not running from a profile, use 'guix'
|
;; As a fallback, if we're not running from a profile, use 'guix'
|
||||||
;; channel metadata from (guix config).
|
;; channel metadata from (guix config).
|
||||||
(match (channel-metadata)
|
(build-time-metadata))
|
||||||
(#f '())
|
|
||||||
(sexp (or (and=> (sexp->channel sexp 'guix) list) '()))))
|
|
||||||
(entries
|
(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)
|
(define (package-path-entries)
|
||||||
"Return two values: the list of package path entries to be added to the
|
"Return two values: the list of package path entries to be added to the
|
||||||
|
@ -301,4 +301,11 @@ text. The hyperlink links to a web view of COMMIT, when available."
|
|||||||
(channels
|
(channels
|
||||||
(display-profile-info #f format channels))))
|
(display-profile-info #f format channels))))
|
||||||
(profile
|
(profile
|
||||||
(display-profile-info (canonicalize-profile profile) format))))))
|
;; For the current profile, resort to 'current-channels', which has a
|
||||||
|
;; fallback to metadata from (guix config) in case PROFILE lacks it.
|
||||||
|
(let ((channels (if (and (current-profile)
|
||||||
|
(string=? profile (current-profile)))
|
||||||
|
(current-channels)
|
||||||
|
(profile-channels profile))))
|
||||||
|
(display-profile-info (canonicalize-profile profile)
|
||||||
|
format channels)))))))
|
||||||
|
Loading…
Reference in New Issue
Block a user