summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/guix.texi3
-rw-r--r--guix/scripts/archive.scm8
-rw-r--r--guix/scripts/build.scm8
-rw-r--r--guix/scripts/environment.scm9
-rw-r--r--guix/scripts/package.scm8
-rw-r--r--guix/scripts/system.scm8
-rw-r--r--tests/guix-package.sh13
7 files changed, 46 insertions, 11 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index e804d79ed0b..1d4a012b167 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2802,7 +2802,8 @@ below:
2802$ export GUIX_BUILD_OPTIONS="--no-substitutes -c 2 -L /foo/bar" 2802$ export GUIX_BUILD_OPTIONS="--no-substitutes -c 2 -L /foo/bar"
2803@end example 2803@end example
2804 2804
2805These options are appended to the ones passed on the command line. 2805These options are parsed independently, and the result is appended to
2806the parsed command-line options.
2806@end defvr 2807@end defvr
2807 2808
2808 2809
diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm
index 29a3ad15a74..781ffc5f588 100644
--- a/guix/scripts/archive.scm
+++ b/guix/scripts/archive.scm
@@ -293,8 +293,12 @@ the input port."
293(define (guix-archive . args) 293(define (guix-archive . args)
294 (define (parse-options) 294 (define (parse-options)
295 ;; Return the alist of option values. 295 ;; Return the alist of option values.
296 (args-fold* (append args (environment-build-options)) 296 (append (parse-options-from args)
297 %options 297 (parse-options-from (environment-build-options))))
298
299 (define (parse-options-from args)
300 ;; Actual parsing takes place here.
301 (args-fold* args %options
298 (lambda (opt name arg result) 302 (lambda (opt name arg result)
299 (leave (_ "~A: unrecognized option~%") name)) 303 (leave (_ "~A: unrecognized option~%") name))
300 (lambda (arg result) 304 (lambda (arg result)
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 76a743f0b35..26e9f42774f 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -401,8 +401,12 @@ arguments with packages that use the specified source."
401(define (guix-build . args) 401(define (guix-build . args)
402 (define (parse-options) 402 (define (parse-options)
403 ;; Return the alist of option values. 403 ;; Return the alist of option values.
404 (args-fold* (append args (environment-build-options)) 404 (append (parse-options-from args)
405 %options 405 (parse-options-from (environment-build-options))))
406
407 (define (parse-options-from args)
408 ;; Actual parsing takes place here.
409 (args-fold* args %options
406 (lambda (opt name arg result) 410 (lambda (opt name arg result)
407 (leave (_ "~A: unrecognized option~%") name)) 411 (leave (_ "~A: unrecognized option~%") name))
408 (lambda (arg result) 412 (lambda (arg result)
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index a309dfa362f..c388b0c52c2 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -213,8 +213,13 @@ packages."
213;; Entry point. 213;; Entry point.
214(define (guix-environment . args) 214(define (guix-environment . args)
215 (define (parse-options) 215 (define (parse-options)
216 (args-fold* (append args (environment-build-options)) 216 ;; Return the alist of option values.
217 %options 217 (append (parse-options-from args)
218 (parse-options-from (environment-build-options))))
219
220 (define (parse-options-from args)
221 ;; Actual parsing takes place here.
222 (args-fold* args %options
218 (lambda (opt name arg result) 223 (lambda (opt name arg result)
219 (leave (_ "~A: unrecognized option~%") name)) 224 (leave (_ "~A: unrecognized option~%") name))
220 (lambda (arg result) 225 (lambda (arg result)
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 9ff4d17bf44..21dc66cb750 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -668,8 +668,12 @@ removed from MANIFEST."
668(define (guix-package . args) 668(define (guix-package . args)
669 (define (parse-options) 669 (define (parse-options)
670 ;; Return the alist of option values. 670 ;; Return the alist of option values.
671 (args-fold* (append args (environment-build-options)) 671 (append (parse-options-from args)
672 %options 672 (parse-options-from (environment-build-options))))
673
674 (define (parse-options-from args)
675 ;; Actual parsing takes place here.
676 (args-fold* args %options
673 (lambda (opt name arg result arg-handler) 677 (lambda (opt name arg result arg-handler)
674 (leave (_ "~A: unrecognized option~%") name)) 678 (leave (_ "~A: unrecognized option~%") name))
675 (lambda (arg result arg-handler) 679 (lambda (arg result arg-handler)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index f2a25dd65ad..56228601cca 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -477,8 +477,12 @@ Build the operating system declared in FILE according to ACTION.\n"))
477(define (guix-system . args) 477(define (guix-system . args)
478 (define (parse-options) 478 (define (parse-options)
479 ;; Return the alist of option values. 479 ;; Return the alist of option values.
480 (args-fold* (append args (environment-build-options)) 480 (append (parse-options-from args)
481 %options 481 (parse-options-from (environment-build-options))))
482
483 (define (parse-options-from args)
484 ;; Actual parsing takes place here.
485 (args-fold* args %options
482 (lambda (opt name arg result) 486 (lambda (opt name arg result)
483 (leave (_ "~A: unrecognized option~%") name)) 487 (leave (_ "~A: unrecognized option~%") name))
484 (lambda (arg result) 488 (lambda (arg result)
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 3e0e36fa23c..f4e091a5a2c 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -289,3 +289,16 @@ GUIX_PACKAGE_PATH="$module_dir"
289export GUIX_PACKAGE_PATH 289export GUIX_PACKAGE_PATH
290guix package -A emacs-foo-bar | grep 42 290guix package -A emacs-foo-bar | grep 42
291guix package -i emacs-foo-bar-42 -n 291guix package -i emacs-foo-bar-42 -n
292unset GUIX_PACKAGE_PATH
293
294# Using 'GUIX_BUILD_OPTIONS'.
295
296available="`guix package -A | sort`"
297GUIX_BUILD_OPTIONS="--dry-run"
298export GUIX_BUILD_OPTIONS
299
300# Make sure $GUIX_BUILD_OPTIONS is not simply appended to the command-line,
301# which would break 'guix package -A' and similar.
302available2="`guix package -A | sort`"
303test "$available2" = "$available"
304guix package -I