channels: Gracefully report the lack of a 'guix' channel.

* guix/channels.scm (channel-instance-derivations): Raise an '&message'
condition when CORE-INSTANCE is #f.
This commit is contained in:
Ludovic Courtès 2019-01-20 18:11:11 +01:00
parent acefa7408b
commit ab6025b52c
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 16 additions and 0 deletions

View File

@ -28,10 +28,15 @@
#:use-module (guix derivations) #:use-module (guix derivations)
#:use-module (guix store) #:use-module (guix store)
#:use-module (guix i18n) #:use-module (guix i18n)
#:use-module ((guix utils)
#:select (source-properties->location
&error-location))
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (srfi srfi-2) #:use-module (srfi srfi-2)
#:use-module (srfi srfi-9) #:use-module (srfi srfi-9)
#:use-module (srfi srfi-11) #: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 self) (whole-package make-config.scm)
#:autoload (guix inferior) (gexp->derivation-in-inferior) ;FIXME: circular dep #:autoload (guix inferior) (gexp->derivation-in-inferior) ;FIXME: circular dep
#:use-module (ice-9 match) #:use-module (ice-9 match)
@ -345,6 +350,17 @@ INSTANCES."
(build-channel-instance instance core deps))) (build-channel-instance instance core deps)))
instance)) 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)) (mapm %store-monad instance->derivation instances))
(define (whole-package-for-legacy name modules) (define (whole-package-for-legacy name modules)