summaryrefslogtreecommitdiff
path: root/guix/ui.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-01-24 22:50:40 +0100
committerLudovic Courtès <ludo@gnu.org>2015-01-24 22:57:49 +0100
commitf304c9c237aca7e9007d6e0cefd6ed858c5a9e47 (patch)
treeba6720f7db2bd14590d2aa89fa28245ff7ee40a0 /guix/ui.scm
parentda74bc7886cba77192260d84b2dd57466e4b5354 (diff)
derivations: Raise an error for references to non-existent outputs.
Fixes <http://bugs.gnu.org/19630>. Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>. * guix/derivations.scm (&derivation-error, &derivation-missing-output-error): New error conditions. (derivation->output-path): Raise a '&derivation-missing-output-error' if OUTPUT is not an output of DRV. * guix/ui.scm (call-with-error-handling): Add case for 'derivation-missing-output-error?'. (show-what-to-build): Check whether (derivation-outputs drv) is empty. * tests/packages.scm ("reference to non-existent output"): Add test.
Diffstat (limited to 'guix/ui.scm')
-rw-r--r--guix/ui.scm9
1 files changed, 6 insertions, 3 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index e1e75d8556..04c50f4827 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -249,6 +249,10 @@ interpreted."
;; FIXME: Server-provided error messages aren't i18n'd.
(leave (_ "build failed: ~a~%")
(nix-protocol-error-message c)))
+ ((derivation-missing-output-error? c)
+ (leave (_ "reference to invalid output '~a' of derivation '~a'~%")
+ (derivation-missing-output c)
+ (derivation-file-name (derivation-error-derivation c))))
((message-condition? c)
;; Normally '&message' error conditions have an i18n'd message.
(leave (_ "~a~%")
@@ -309,9 +313,8 @@ available for download."
(const #f)))
(define (built-or-substitutable? drv)
- (let ((out (derivation->output-path drv)))
- ;; If DRV has zero outputs, OUT is #f.
- (or (not out)
+ (or (null? (derivation-outputs drv))
+ (let ((out (derivation->output-path drv))) ;XXX: assume "out" exists
(or (valid-path? store out)
(substitutable? out)))))