guix-package: Gracefully report non-existing outputs.
* guix-package.in (guix-package)[find-package](ensure-output): New procedure. Use it to validate SUB-DRV.
This commit is contained in:
parent
0f5378ebc4
commit
aa92cf980c
|
@ -402,6 +402,14 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
|
||||||
;; sub-derivation name.
|
;; sub-derivation name.
|
||||||
(define request name)
|
(define request name)
|
||||||
|
|
||||||
|
(define (ensure-output p sub-drv)
|
||||||
|
(if (member sub-drv (package-outputs p))
|
||||||
|
p
|
||||||
|
(leave (_ "~a: error: package `~a' lacks output `~a'~%")
|
||||||
|
(location->string (package-location p))
|
||||||
|
(package-full-name p)
|
||||||
|
sub-drv)))
|
||||||
|
|
||||||
(let*-values (((name sub-drv)
|
(let*-values (((name sub-drv)
|
||||||
(match (string-rindex name #\:)
|
(match (string-rindex name #\:)
|
||||||
(#f (values name "out"))
|
(#f (values name "out"))
|
||||||
|
@ -411,7 +419,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
|
||||||
(package-name->name+version name)))
|
(package-name->name+version name)))
|
||||||
(match (find-packages-by-name name version)
|
(match (find-packages-by-name name version)
|
||||||
((p)
|
((p)
|
||||||
(list name (package-version p) sub-drv p))
|
(list name (package-version p) sub-drv (ensure-output p sub-drv)))
|
||||||
((p p* ...)
|
((p p* ...)
|
||||||
(format (current-error-port)
|
(format (current-error-port)
|
||||||
(_ "warning: ambiguous package specification `~a'~%")
|
(_ "warning: ambiguous package specification `~a'~%")
|
||||||
|
@ -420,7 +428,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
|
||||||
(_ "warning: choosing ~a from ~a~%")
|
(_ "warning: choosing ~a from ~a~%")
|
||||||
(package-full-name p)
|
(package-full-name p)
|
||||||
(location->string (package-location p)))
|
(location->string (package-location p)))
|
||||||
(list name (package-version p) sub-drv p))
|
(list name (package-version p) sub-drv (ensure-output p sub-drv)))
|
||||||
(()
|
(()
|
||||||
(leave (_ "~a: package not found~%") request)))))
|
(leave (_ "~a: package not found~%") request)))))
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,13 @@ fi
|
||||||
# Make sure the `:' syntax works.
|
# Make sure the `:' syntax works.
|
||||||
guix-package --bootstrap -i "binutils:lib" -p "$profile" -n
|
guix-package --bootstrap -i "binutils:lib" -p "$profile" -n
|
||||||
|
|
||||||
|
# Make sure nonexistent outputs are reported.
|
||||||
|
guix-package --bootstrap -i "guile-bootstrap:out" -p "$profile" -n
|
||||||
|
if guix-package --bootstrap -i "guile-bootstrap:does-not-exist" -p "$profile" -n;
|
||||||
|
then false; else true; fi
|
||||||
|
if guix-package --bootstrap -i "guile-bootstrap:does-not-exist" -p "$profile";
|
||||||
|
then false; else true; fi
|
||||||
|
|
||||||
# Check whether `--list-available' returns something sensible.
|
# Check whether `--list-available' returns something sensible.
|
||||||
guix-package -A 'gui.*e' | grep guile
|
guix-package -A 'gui.*e' | grep guile
|
||||||
|
|
||||||
|
@ -161,4 +168,5 @@ do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Extraneous argument.
|
# Extraneous argument.
|
||||||
! guix-package install foo-bar
|
if guix-package install foo-bar;
|
||||||
|
then false; else true; fi
|
||||||
|
|
Loading…
Reference in New Issue