diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2020-08-27 00:32:49 -0400 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2020-09-01 00:48:11 -0400 |
commit | a02ad4592cc085ca488a5c4c4c352dba5eaa645b (patch) | |
tree | 40e8f35d421f53bcbc555ad4f9bb6efd541d9a99 | |
parent | 1c4b3512db48a34aa5e7993167aa70a3124cdf34 (diff) | |
download | guix-a02ad4592cc085ca488a5c4c4c352dba5eaa645b.tar guix-a02ad4592cc085ca488a5c4c4c352dba5eaa645b.tar.gz |
gexp: computed-file: Prevent mistakenly overriding default option values.
In order to do so, default to an empty options list, and expose options whose
default values are sensitive directly as keyword arguments.
* guix/gexp.scm (computed-file): Extract the LOCAL-BUILD? parameter from the
OPTIONS parameter to make it a stand-alone keyword argument. Introduce an
OPTIONS* binding which is obtained by combining the LOCAL-BUILD? keyword and
its value with OPTIONS.
* doc/guix.texi (G-Expressions): Adjust doc.
Suggested-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r-- | doc/guix.texi | 8 | ||||
-rw-r--r-- | guix/gexp.scm | 11 |
2 files changed, 12 insertions, 7 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 56b1cd8976..b1b0ab37d4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -8327,10 +8327,12 @@ This is the declarative counterpart of @code{text-file}. @end deffn @deffn {Scheme Procedure} computed-file @var{name} @var{gexp} @ - [#:options '(#:local-build? #t)] + [#:local-build? #t] + [#:options '()] Return an object representing the store item @var{name}, a file or -directory computed by @var{gexp}. @var{options} -is a list of additional arguments to pass to @code{gexp->derivation}. +directory computed by @var{gexp}. When @var{local-build?} is true (the +default), the derivation is built locally. @var{options} is a list of +additional arguments to pass to @code{gexp->derivation}. This is the declarative counterpart of @code{gexp->derivation}. @end deffn diff --git a/guix/gexp.scm b/guix/gexp.scm index 67b6121313..9d3c52e783 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; Copyright © 2018 Jan Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2019, 2020 Mathieu Othacehe <m.othacehe@gmail.com> +;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -504,13 +505,15 @@ This is the declarative counterpart of 'text-file'." (options computed-file-options)) ;list of arguments (define* (computed-file name gexp - #:key guile (options '(#:local-build? #t))) + #:key guile (local-build? #t) (options '())) "Return an object representing the store item NAME, a file or directory -computed by GEXP. OPTIONS is a list of additional arguments to pass -to 'gexp->derivation'. +computed by GEXP. When LOCAL-BUILD? is #t (the default), it ensures the +corresponding derivation is built locally. OPTIONS may be used to pass +additional arguments to 'gexp->derivation'. This is the declarative counterpart of 'gexp->derivation'." - (%computed-file name gexp guile options)) + (let ((options* `(#:local-build? ,local-build? ,@options))) + (%computed-file name gexp guile options*))) (define-gexp-compiler (computed-file-compiler (file <computed-file>) system target) |