diff options
| -rw-r--r-- | doc/guix.texi | 3 | ||||
| -rw-r--r-- | guix/scripts/archive.scm | 8 | ||||
| -rw-r--r-- | guix/scripts/build.scm | 8 | ||||
| -rw-r--r-- | guix/scripts/environment.scm | 9 | ||||
| -rw-r--r-- | guix/scripts/package.scm | 8 | ||||
| -rw-r--r-- | guix/scripts/system.scm | 8 | ||||
| -rw-r--r-- | tests/guix-package.sh | 13 |
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 | ||
| 2805 | These options are appended to the ones passed on the command line. | 2805 | These options are parsed independently, and the result is appended to |
| 2806 | the 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" | |||
| 289 | export GUIX_PACKAGE_PATH | 289 | export GUIX_PACKAGE_PATH |
| 290 | guix package -A emacs-foo-bar | grep 42 | 290 | guix package -A emacs-foo-bar | grep 42 |
| 291 | guix package -i emacs-foo-bar-42 -n | 291 | guix package -i emacs-foo-bar-42 -n |
| 292 | unset GUIX_PACKAGE_PATH | ||
| 293 | |||
| 294 | # Using 'GUIX_BUILD_OPTIONS'. | ||
| 295 | |||
| 296 | available="`guix package -A | sort`" | ||
| 297 | GUIX_BUILD_OPTIONS="--dry-run" | ||
| 298 | export 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. | ||
| 302 | available2="`guix package -A | sort`" | ||
| 303 | test "$available2" = "$available" | ||
| 304 | guix package -I | ||
