Skip to content
Snippets Groups Projects
Unverified Commit a02ad459 authored by Maxim Cournoyer's avatar Maxim Cournoyer
Browse files

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: default avatarLudovic Courtès <ludo@gnu.org>
parent 1c4b3512
No related branches found
No related tags found
No related merge requests found
...@@ -8327,10 +8327,12 @@ This is the declarative counterpart of @code{text-file}. ...@@ -8327,10 +8327,12 @@ This is the declarative counterpart of @code{text-file}.
@end deffn @end deffn
   
@deffn {Scheme Procedure} computed-file @var{name} @var{gexp} @ @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 Return an object representing the store item @var{name}, a file or
directory computed by @var{gexp}. @var{options} directory computed by @var{gexp}. When @var{local-build?} is true (the
is a list of additional arguments to pass to @code{gexp->derivation}. 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}. This is the declarative counterpart of @code{gexp->derivation}.
@end deffn @end deffn
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2018 Jan Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2018 Jan Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2019, 2020 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2019, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
...@@ -504,13 +505,15 @@ (define-record-type <computed-file> ...@@ -504,13 +505,15 @@ (define-record-type <computed-file>
(options computed-file-options)) ;list of arguments (options computed-file-options)) ;list of arguments
(define* (computed-file name gexp (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 "Return an object representing the store item NAME, a file or directory
computed by GEXP. OPTIONS is a list of additional arguments to pass computed by GEXP. When LOCAL-BUILD? is #t (the default), it ensures the
to 'gexp->derivation'. corresponding derivation is built locally. OPTIONS may be used to pass
additional arguments to 'gexp->derivation'.
This is the declarative counterpart of '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>) (define-gexp-compiler (computed-file-compiler (file <computed-file>)
system target) system target)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment