summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-01-20 18:11:11 +0100
committerLudovic Courtès <ludo@gnu.org>2019-01-20 18:11:11 +0100
commitab6025b52cec792312d465107e9b86d7900c5f93 (patch)
treedc9518895bafc5f88649e8f138899e0c2929ede4
parentacefa7408b2f573e6a14acd5f55b652b7c8806b4 (diff)
downloadguix-ab6025b52cec792312d465107e9b86d7900c5f93.tar.gz
channels: Gracefully report the lack of a 'guix' channel.
* guix/channels.scm (channel-instance-derivations): Raise an '&message'
condition when CORE-INSTANCE is #f.
-rw-r--r--guix/channels.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/guix/channels.scm b/guix/channels.scm
index eb56c821e5..e588d86b4b 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -28,10 +28,15 @@
   #:use-module (guix derivations)
   #:use-module (guix store)
   #:use-module (guix i18n)
+  #:use-module ((guix utils)
+                #:select (source-properties->location
+                          &error-location))
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-2)
   #:use-module (srfi srfi-9)
   #:use-module (srfi srfi-11)
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:autoload   (guix self) (whole-package make-config.scm)
   #:autoload   (guix inferior) (gexp->derivation-in-inferior) ;FIXME: circular dep
   #:use-module (ice-9 match)
@@ -345,6 +350,17 @@ INSTANCES."
                    (build-channel-instance instance core deps)))
              instance))
 
+  (unless core-instance
+    (let ((loc (and=> (any (compose channel-location channel-instance-channel)
+                           instances)
+                      source-properties->location)))
+      (raise (apply make-compound-condition
+                    (condition
+                     (&message (message "'guix' channel is lacking")))
+                    (if loc
+                        (list (condition (&error-location (location loc))))
+                        '())))))
+
   (mapm %store-monad instance->derivation instances))
 
 (define (whole-package-for-legacy name modules)