summary refs log tree commit diff
path: root/guix-package.in
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-02-01 09:17:35 +0100
committerLudovic Courtès <ludo@gnu.org>2013-02-01 09:17:59 +0100
commitaa92cf980cab9f085df11c79c4b27d2b8b0d88aa (patch)
treec300c62dda2a7c4099268ea9d0a1bb1bb4bbdcb0 /guix-package.in
parent0f5378ebc4096b1d536f75c9867454215e8e06d6 (diff)
downloadguix-aa92cf980cab9f085df11c79c4b27d2b8b0d88aa.tar.gz
guix-package: Gracefully report non-existing outputs.
* guix-package.in (guix-package)[find-package](ensure-output): New
  procedure. Use it to validate SUB-DRV.
Diffstat (limited to 'guix-package.in')
-rw-r--r--guix-package.in12
1 files changed, 10 insertions, 2 deletions
diff --git a/guix-package.in b/guix-package.in
index 053f8fbf83..58164c6e46 100644
--- a/guix-package.in
+++ b/guix-package.in
@@ -402,6 +402,14 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
     ;; sub-derivation 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)
                    (match (string-rindex name #\:)
                      (#f    (values name "out"))
@@ -411,7 +419,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
                    (package-name->name+version name)))
       (match (find-packages-by-name name version)
         ((p)
-         (list name (package-version p) sub-drv p))
+         (list name (package-version p) sub-drv (ensure-output p sub-drv)))
         ((p p* ...)
          (format (current-error-port)
                  (_ "warning: ambiguous package specification `~a'~%")
@@ -420,7 +428,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
                  (_ "warning: choosing ~a from ~a~%")
                  (package-full-name 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)))))