GNU bug report logs -
#63320
[PATCH 0/2] Rewrite 'arguments' to gexps with 'guix style -S arguments'
Previous Next
Reported by: Ludovic Courtès <ludo <at> gnu.org>
Date: Fri, 5 May 2023 21:31:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#63320: [PATCH 0/2] Rewrite 'arguments' to gexps with 'guix style -S arguments'
which was filed against the guix-patches package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 63320 <at> debbugs.gnu.org.
--
63320: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63320
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Hi,
Ludovic Courtès <ludo <at> gnu.org> skribis:
> When preparing <https://guix.gnu.org/en/blog/2021/the-big-change/>, I didn’t
> consider converting ‘arguments’ from sexps to gexps a priority. In practice,
> we’ve been doing that manually ever since but there’s a sort of a “contamination”
> aspect: due to inheritance, we often have to be careful enough to convert
> multiple packages at once or to not change anything, or we end up with gexp
> records inside sexps¹. Automation appears to be overdue.
>
> The attached patches add ‘guix style -S arguments’, which rewrites ‘arguments’
> from sexps to gexps. The change doesn’t involve any rebuild, so we could even
> run it en masse on the whole repo and be done with it.
Pushed as 2344ccee2f28f790fa0b69ecb1916c162c1f8c50, with Florian’s
news entry translation (I just realized I forgot to add you as
co-author, my apologies!).
I guess we should address the shortcomings I mentioned before we can run
it on the whole repo.
Thanks,
Ludo’.
[Message part 3 (message/rfc822, inline)]
Hello Guix!
When preparing <https://guix.gnu.org/en/blog/2021/the-big-change/>, I didn’t
consider converting ‘arguments’ from sexps to gexps a priority. In practice,
we’ve been doing that manually ever since but there’s a sort of a “contamination”
aspect: due to inheritance, we often have to be careful enough to convert
multiple packages at once or to not change anything, or we end up with gexp
records inside sexps¹. Automation appears to be overdue.
The attached patches add ‘guix style -S arguments’, which rewrites ‘arguments’
from sexps to gexps. The change doesn’t involve any rebuild, so we could even
run it en masse on the whole repo and be done with it.
Some caveats:
• The reader in (guix read-print) doesn’t support sexp comments (#;), which
are used in a couple of packages. Thus,
./pre-inst-env guix style -S arguments
which traverses all the packages eventually chokes on it.
• The pretty printer does not insert a newline after #:phases, which makes
the space for (modify-phases …) expressions sometimes too narrow. (This
is not new; try ‘./pre-inst-env guix style PACKAGE’.)
• More generally, the pretty printer’s output still has occasional glitches,
sufficiently that running ‘guix style -S arguments’ on the whole repo may
not be a good idea at the moment.
• Some modules lack #:use-module (guix gexp), but this has to be added
manually.
• We might want an optional conservative policy to leave arguments that
would not use gexps unchanged. For instance, we could leave
(arguments '(#:tests? #f)) unchanged instead of rewriting it to
(arguments (list #:tests? #f)).
Thoughts?
Ludo’.
¹ This is what prompted Chris to improve error detection:
<https://issues.guix.gnu.org/63263>.
Ludovic Courtès (2):
style: Add 'arguments' styling rule.
DRAFT news: Add entry to 'guix style -S arguments'.
doc/guix.texi | 51 ++++++++++++
etc/news.scm | 16 ++++
guix/scripts/style.scm | 173 ++++++++++++++++++++++++++++++++++++++++-
tests/style.scm | 136 ++++++++++++++++++++++++++++++++
4 files changed, 375 insertions(+), 1 deletion(-)
base-commit: 3c91f4ca490a7ac56dc0aebbca9c4bf4df201877
--
2.39.2
This bug report was last modified 2 years and 6 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.