guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/03: guix build: Gracefully handle type errors in -e and -f.


From: Ludovic Courtès
Subject: 02/03: guix build: Gracefully handle type errors in -e and -f.
Date: Sun, 13 Dec 2015 21:32:52 +0000

civodul pushed a commit to branch master
in repository guix.

commit 20464dde13dc540951edc035d1af5d9fd756f2d1
Author: Ludovic Courtès <address@hidden>
Date:   Sun Dec 13 21:13:16 2015 +0100

    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.
---
 guix/scripts/build.scm |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index debf7c2..a6596d0 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -404,10 +404,16 @@ must be one of 'package', 'all', or 'transitive'~%")
 (define (options->things-to-build opts)
   "Read the arguments from OPTS and return a list of high-level objects to
 build---packages, gexps, derivations, and so on."
-  (define ensure-list
-    (match-lambda
-      ((x ...) x)
-      (x       (list x))))
+  (define (validate-type x)
+    (unless (or (package? x) (derivation? x) (gexp? x) (procedure? x))
+      (leave (_ "~s: not something we can build~%") x)))
+
+  (define (ensure-list x)
+    (let ((lst (match x
+                 ((x ...) x)
+                 (x       (list x)))))
+      (for-each validate-type lst)
+      lst))
 
   (append-map (match-lambda
                 (('argument . (? string? spec))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]