summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-09-27 11:44:56 +0200
committerLudovic Courtès <ludo@gnu.org>2016-09-27 11:44:56 +0200
commit8a54c0ec694ad6e22b155d167552b8fd0914e82d (patch)
tree77b8e9800e67aef7f73a2009ee1eb68c8f6e1612
parent3c185b24f593c982aeb33996324fa6878c6ed21b (diff)
downloadguix-8a54c0ec694ad6e22b155d167552b8fd0914e82d.tar.gz
guix build: Gracefully handle packages without source for '-S'.
Fixes <http://bugs.gnu.org/22836>.
Reported by Ricardo Wurmus <rekado@elephly.net>.

* guix/scripts/build.scm (options->derivations): Gracefully
handle (package-source p) = #f.
-rw-r--r--guix/scripts/build.scm12
1 files changed, 10 insertions, 2 deletions
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index a9f649d2ee..b64138ec0e 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -595,8 +595,16 @@ build."
                        (#f
                         (list (package->derivation store p system)))
                        (#t
-                        (let ((s (package-source p)))
-                          (list (package-source-derivation store s))))
+                        (match (package-source p)
+                          (#f
+                           (format (current-error-port)
+                                   (_ "~a: warning: \
+package '~a' has no source~%")
+                                   (location->string (package-location p))
+                                   (package-name p))
+                           '())
+                          (s
+                           (list (package-source-derivation store s)))))
                        (proc
                         (map (cut package-source-derivation store <>)
                              (proc p))))))