diff options
| author | Nicolas Graves <ngraves@ngraves.fr> | 2026-01-24 01:14:53 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-05-07 17:35:32 +0200 |
| commit | 8a505cfd48264973f1208ffe04894af12074b8c7 (patch) | |
| tree | 87556102717bdde4e00ce79d0bd8f1aab5695341 /doc | |
| parent | 10bf5b6c2975088828c0b151d17cbb3e451d300c (diff) | |
style: Add ‘remove-input’ and related styling rules.
* guix/scripts/style.scm (input-matches?, package-list->string,
%field-accessors, remove-from-package-field, transform-package-field):
Add variables.
(%options): Add options --remove-input, --remove-native-input,
--remove-propagated-input, and --parameter.
(guix-style): Implement those options. To keep ony one autoload, use
specification->package+output rather than specification->package.
* tests/style.scm ("remove-input, single input removed",
"remove-input, one of multiple inputs removed",
"remove-input, middle input removed from list",
"remove-input, non-existent input unchanged",
"remove-input, input with output specifier",
"remove-native-input, single input removed",
"remove-native-input, one of multiple inputs removed",
"remove-native-input, does not affect inputs field",
"remove-propagated-input, single input removed",
"remove-propagated-input, one of multiple inputs removed",
"remove-propagated-input, does not affect other fields",
"remove-input from all three fields independently",
"remove-input, dry-run does not modify file"): New tests.
("url-fetch->git-fetch, preserved field"): Drop the use of %patch-path
and %package-module-path, which are not necessary because of -L.
Change the mocked procedure from specification->package to
specification->package+output, as in the implementation.
* doc/guix.texi (Invoking guix style): Add description for guix style
-S remove-*input rules.
Change-Id: I449c87930310a73ad316b4cb5db72d0906ea495d
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #5862
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/guix.texi | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 70677e24446..45edf34a78a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -16137,6 +16137,29 @@ rebuild of the affected packages. Furthermore, if a package definition | |||
| 16137 | happens to be using G-expressions already, @command{guix style} leaves | 16137 | happens to be using G-expressions already, @command{guix style} leaves |
| 16138 | it unchanged. | 16138 | it unchanged. |
| 16139 | 16139 | ||
| 16140 | @item remove-input | ||
| 16141 | @itemx remove-native-input | ||
| 16142 | @itemx remove-propagated-input | ||
| 16143 | These styling rules remove an input from the given package(s). | ||
| 16144 | |||
| 16145 | Removing these packages respects the package syntax, doesn't affect | ||
| 16146 | margin comments or parentheses, and will put all remaining inputs on a | ||
| 16147 | single line if there are less than three. | ||
| 16148 | |||
| 16149 | This is a focused styling rule for use in teams, when updating | ||
| 16150 | build-systems, or removing unwanted development inputs from | ||
| 16151 | native-inputs. | ||
| 16152 | |||
| 16153 | To remove package @var{whatnot} from all inputs, use the | ||
| 16154 | @code{--parameter} option: | ||
| 16155 | |||
| 16156 | @example | ||
| 16157 | guix style -S remove-input --parameter=@var{whatnot} | ||
| 16158 | @end example | ||
| 16159 | |||
| 16160 | It is also possible to do that for a collection of packages by appending | ||
| 16161 | them to the above invocation. | ||
| 16162 | |||
| 16140 | @item git-source | 16163 | @item git-source |
| 16141 | If the @code{home-page} is a Git repository (as per | 16164 | If the @code{home-page} is a Git repository (as per |
| 16142 | @code{git-repository-url?}), and the actual Git repository is tagged | 16165 | @code{git-repository-url?}), and the actual Git repository is tagged |
