describe: Make sure package-channels always returns a list.

* guix/describe.scm (package-channels): Return an empty list if the file
origin could not be determined.
This commit is contained in:
Mathieu Othacehe 2021-02-25 10:24:11 +01:00
parent b6c7e5af02
commit 4dfce0115f
No known key found for this signature in database
GPG Key ID: 8354763531769CA6
1 changed files with 10 additions and 10 deletions

View File

@ -156,16 +156,16 @@ not be determined."
(let ((file (if (string-prefix? "/" file)
file
(search-path %load-path file))))
(and file
(string-prefix? (%store-prefix) file)
(filter-map
(lambda (entry)
(let ((item (manifest-entry-item entry)))
(and (or (string-prefix? item file)
(string=? "guix" (manifest-entry-name entry)))
(manifest-entry-channel entry))))
(current-profile-entries)))))))
(if (and file
(string-prefix? (%store-prefix) file))
(filter-map
(lambda (entry)
(let ((item (manifest-entry-item entry)))
(and (or (string-prefix? item file)
(string=? "guix" (manifest-entry-name entry)))
(manifest-entry-channel entry))))
(current-profile-entries))
'())))))
(define (package-provenance package)
"Return the provenance of PACKAGE as an sexp for use as the 'provenance'