summaryrefslogtreecommitdiff
path: root/guix-build.in
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-11-07 23:41:59 +0100
committerLudovic Courtès <ludo@gnu.org>2012-11-07 23:44:38 +0100
commit912209ee61ced92c3246da78ed9991781fa6bf2d (patch)
treefa52b575a5bcbefc8e03591e3679fb2181a8949b /guix-build.in
parenteeaf44276cb50fb341d80faa650fb62fd1cf2dbe (diff)
downloadpatches-912209ee61ced92c3246da78ed9991781fa6bf2d.tar
patches-912209ee61ced92c3246da78ed9991781fa6bf2d.tar.gz
guix-build: Error out when `-S' used for source-less package.
* guix-build.in (derivations-from-package-expressions): Leave with an error message when SOURCE? is #t and P has no source. * tests/guix-build.sh: Add test.
Diffstat (limited to 'guix-build.in')
-rw-r--r--guix-build.in15
1 files changed, 9 insertions, 6 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))))
;;;