guix build: Gracefully handle type errors in -e and -f.
* guix/scripts/build.scm (options->things-to-build)[validate-type]: New procedure. [ensure-list]: Use it.
This commit is contained in:
parent
ee2a7e3fd2
commit
20464dde13
|
@ -404,10 +404,16 @@ must be one of 'package', 'all', or 'transitive'~%")
|
||||||
(define (options->things-to-build opts)
|
(define (options->things-to-build opts)
|
||||||
"Read the arguments from OPTS and return a list of high-level objects to
|
"Read the arguments from OPTS and return a list of high-level objects to
|
||||||
build---packages, gexps, derivations, and so on."
|
build---packages, gexps, derivations, and so on."
|
||||||
(define ensure-list
|
(define (validate-type x)
|
||||||
(match-lambda
|
(unless (or (package? x) (derivation? x) (gexp? x) (procedure? x))
|
||||||
((x ...) x)
|
(leave (_ "~s: not something we can build~%") x)))
|
||||||
(x (list x))))
|
|
||||||
|
(define (ensure-list x)
|
||||||
|
(let ((lst (match x
|
||||||
|
((x ...) x)
|
||||||
|
(x (list x)))))
|
||||||
|
(for-each validate-type lst)
|
||||||
|
lst))
|
||||||
|
|
||||||
(append-map (match-lambda
|
(append-map (match-lambda
|
||||||
(('argument . (? string? spec))
|
(('argument . (? string? spec))
|
||||||
|
|
Loading…
Reference in New Issue