summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-build.in15
-rw-r--r--tests/guix-build.sh7
2 files changed, 15 insertions, 7 deletions
diff --git a/guix-build.in b/guix-build.in
index c7bcb38975..3b1e6c3115 100644
--- a/guix-build.in
+++ b/guix-build.in
@@ -53,13 +53,16 @@ When SOURCE? is true, return the derivations of the package sources."
(let ((p (eval exp (current-module))))
(if (package? p)
(if source?
- (package-source-derivation %store (package-source p))
+ (let ((source (package-source p))
+ (loc (package-location p)))
+ (if source
+ (package-source-derivation %store source)
+ (leave (_ "~a:~a:~a: error: package `~a' has no source~%")
+ (location-file loc) (location-line loc)
+ (location-column loc) (package-name p))))
(package-derivation %store p system))
- (begin
- (format (current-error-port)
- (_ "expression `~s' does not evaluate to a package")
- exp)
- (exit 1)))))
+ (leave (_ "expression `~s' does not evaluate to a package~%")
+ exp))))
;;;
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index 4df5cc0790..7f0e624edb 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -23,7 +23,12 @@
guix-build --version
# Should fail.
-guix-build -e + || true
+if guix-build -e +;
+then false; else true; fi
+
+# Should fail because this is a source-less package.
+if guix-build -e '(@ (distro packages bootstrap) %bootstrap-glibc)' -S
+then false; else true; fi
# Should pass.
guix-build -e '(@@ (distro packages base) %bootstrap-guile)' | \