guix-commits
[Top][All Lists]
Advanced

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

02/04: ui: Honor --no-* options passed via $GUIX_BUILD_OPTIONS.


From: Ludovic Courtès
Subject: 02/04: ui: Honor --no-* options passed via $GUIX_BUILD_OPTIONS.
Date: Wed, 25 Feb 2015 23:04:42 +0000

civodul pushed a commit to branch master
in repository guix.

commit cf6ce3e6ef96abc36a40293b2d9f732d462d2a94
Author: Ludovic Courtès <address@hidden>
Date:   Thu Feb 26 00:00:04 2015 +0100

    ui: Honor --no-* options passed via $GUIX_BUILD_OPTIONS.
    
    Reported by Alex Kost <address@hidden>
    at <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00702.html>.
    
    * guix/ui.scm (parse-command-line)[parse-options-from]: Add 'seeds'
      parameter.
      Thread the result of the first 'parse-options-from' call to the
      second.
---
 guix/ui.scm  |   10 +++++++---
 tests/ui.scm |    9 +++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index 09cb6f4..9558d38 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -769,7 +769,7 @@ Command-line options take precedence those passed via 
'GUIX_BUILD_OPTIONS'.
 
 ARGUMENT-HANDLER is called for non-option arguments, like the 'operand-proc'
 parameter of 'args-fold'."
-  (define (parse-options-from args)
+  (define (parse-options-from args seeds)
     ;; Actual parsing takes place here.
     (apply args-fold* args options
            (lambda (opt name arg . rest)
@@ -777,8 +777,12 @@ parameter of 'args-fold'."
            argument-handler
            seeds))
 
-  (append (parse-options-from args)
-          (parse-options-from (environment-build-options))))
+  (call-with-values
+      (lambda ()
+        (parse-options-from (environment-build-options) seeds))
+    (lambda seeds
+      ;; ARGS take precedence over what the environment variable specifies.
+      (parse-options-from args seeds))))
 
 (define (show-guix-usage)
   (format (current-error-port)
diff --git a/tests/ui.scm b/tests/ui.scm
index c71fc71..1478fe2 100644
--- a/tests/ui.scm
+++ b/tests/ui.scm
@@ -82,6 +82,15 @@ interface, and powerful string processing.")
                         %standard-build-options
                         (list '()))))
 
+(test-equal "parse-command-line and --no options"
+  '((argument . "foo")
+    (substitutes? . #f))                          ;takes precedence
+
+  (with-environment-variable "GUIX_BUILD_OPTIONS" "--no-substitutes"
+    (parse-command-line '("foo")
+                        %standard-build-options
+                        (list '((substitutes? . #t))))))
+
 (test-assert "fill-paragraph"
   (every (lambda (column)
            (every (lambda (width)



reply via email to

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