diff options
author | Ludovic Courtès <ludo@gnu.org> | 2023-05-05 17:34:01 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2023-05-18 20:01:32 +0200 |
commit | ba5da5125a81307500982517e2f458d57b024668 (patch) | |
tree | 3497f027375eb532b004b838a0c88ed4dfceb3f0 /doc | |
parent | c1007786fdec6c749887bbd9bf8f46ff27e69055 (diff) | |
download | guix-patches-ba5da5125a81307500982517e2f458d57b024668.tar guix-patches-ba5da5125a81307500982517e2f458d57b024668.tar.gz |
style: Add 'arguments' styling rule.
* guix/scripts/style.scm (unquote->ungexp, gexpify-argument-value)
(quote-argument-value, gexpify-argument-tail)
(gexpify-package-arguments): New procedures.
(%gexp-keywords): New variable.
(%options): Add "arguments" case for 'styling-procedure.
(show-stylings): Update.
* tests/style.scm ("gexpify arguments, already gexpified")
("gexpify arguments, non-gexp arguments, margin comment")
("gexpify arguments, phases and flags")
("gexpify arguments, append arguments")
("gexpify arguments, substitute-keyword-arguments")
("gexpify arguments, append substitute-keyword-arguments"): New tests.
* doc/guix.texi (package Reference): For 'arguments', add compatibility
note and link to 'guix style'.
(Invoking guix style): Document the 'arguments' styling rule.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/guix.texi | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 5851af4092..b40870f42b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -7785,6 +7785,24 @@ The exact set of supported keywords depends on the build system @code{#:phases}. The @code{#:phases} keyword in particular lets you modify the set of build phases for your package (@pxref{Build Phases}). +@quotation Compatibility Note +Until version 1.3.0, the @code{arguments} field would typically use +@code{quote} (@code{'}) or @code{quasiquote} (@code{`}) and no +G-expressions, like so: + +@lisp +(package + ;; several fields omitted + (arguments ;old-style quoted arguments + '(#:tests? #f + #:configure-flags '("--enable-frobbing")))) +@end lisp + +To convert from that style to the one shown above, you can run +@code{guix style -S arguments @var{package}} (@pxref{Invoking guix +style}). +@end quotation + @item @code{inputs} (default: @code{'()}) @itemx @code{native-inputs} (default: @code{'()}) @itemx @code{propagated-inputs} (default: @code{'()}) @@ -14709,6 +14727,39 @@ Rewriting is done in a conservative way: preserving comments and bailing out if it cannot make sense of the code that appears in an inputs field. The @option{--input-simplification} option described below provides fine-grain control over when inputs should be simplified. + +@item arguments +Rewrite package arguments to use G-expressions (@pxref{G-Expressions}). +For example, consider this package definition: + +@lisp +(define-public my-package + (package + ;; @dots{} + (arguments ;old-style quoted arguments + '(#:make-flags '("V=1") + #:phases (modify-phases %standard-phases + (delete 'build)))))) +@end lisp + +@noindent +Running @command{guix style -S arguments} on this package would rewrite +its @code{arguments} field like to: + +@lisp +(define-public my-package + (package + ;; @dots{} + (arguments + (list #:make-flags #~'("V=1") + #:phases #~(modify-phases %standard-phases + (delete 'build)))))) +@end lisp + +Note that changes made by the @code{arguments} rule do not entail a +rebuild of the affected packages. Furthermore, if a package definition +happens to be using G-expressions already, @command{guix style} leaves +it unchanged. @end table @item --list-stylings |