guix package: '--show' errors when asked for a non-existent package.
Fixes <https://bugs.gnu.org/33323>. Reported by swedebugia <swedebugia@riseup.net>. * guix/scripts/package.scm (process-query): Call 'leave' when 'find-packages-by-name' returns the empty list. * tests/guix-package.sh: Test it.
This commit is contained in:
parent
9c001c07d4
commit
652163154c
|
@ -771,9 +771,13 @@ processed, #f otherwise."
|
||||||
(('show requested-name)
|
(('show requested-name)
|
||||||
(let-values (((name version)
|
(let-values (((name version)
|
||||||
(package-name->name+version requested-name)))
|
(package-name->name+version requested-name)))
|
||||||
|
(match (find-packages-by-name name version)
|
||||||
|
(()
|
||||||
|
(leave (G_ "~a~@[@~a~]: package not found~%") name version))
|
||||||
|
(packages
|
||||||
(leave-on-EPIPE
|
(leave-on-EPIPE
|
||||||
(for-each (cute package->recutils <> (current-output-port))
|
(for-each (cute package->recutils <> (current-output-port))
|
||||||
(find-packages-by-name name version)))
|
packages))))
|
||||||
#t))
|
#t))
|
||||||
|
|
||||||
(('search-paths kind)
|
(('search-paths kind)
|
||||||
|
|
|
@ -106,6 +106,10 @@ guix package --show=guile | grep "^name: guile"
|
||||||
# Ensure `--show' doesn't fail for packages with non-package inputs.
|
# Ensure `--show' doesn't fail for packages with non-package inputs.
|
||||||
guix package --show=texlive
|
guix package --show=texlive
|
||||||
|
|
||||||
|
# Fail for non-existent packages or package/version pairs.
|
||||||
|
if guix package --show=does-not-exist; then false; else true; fi
|
||||||
|
if guix package --show=emacs@42; then false; else true; fi
|
||||||
|
|
||||||
# Search.
|
# Search.
|
||||||
LC_MESSAGES=C
|
LC_MESSAGES=C
|
||||||
export LC_MESSAGES
|
export LC_MESSAGES
|
||||||
|
|
Loading…
Reference in New Issue