From f304c9c237aca7e9007d6e0cefd6ed858c5a9e47 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 24 Jan 2015 22:50:40 +0100 Subject: derivations: Raise an error for references to non-existent outputs. Fixes . Reported by Ricardo Wurmus . * 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. --- tests/packages.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') diff --git a/tests/packages.scm b/tests/packages.scm index ef34e76380..65e5cc3cdd 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -268,6 +268,17 @@ (package-derivation %store p) #f))) +(test-assert "reference to non-existent output" + ;; See . + (let* ((dep (dummy-package "dep")) + (p (dummy-package "p" + (inputs `(("dep" ,dep "non-existent")))))) + (guard (c ((derivation-missing-output-error? c) + (and (string=? (derivation-missing-output c) "non-existent") + (equal? (package-derivation %store dep) + (derivation-error-derivation c))))) + (package-derivation %store p)))) + (test-assert "trivial" (let* ((p (package (inherit (dummy-package "trivial")) (build-system trivial-build-system) -- cgit 1.4.1