unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#49169] [PATCH 00/11] Removing input labels from package definitions
@ 2021-06-22  9:02 Ludovic Courtès
  2021-06-22  9:08 ` [bug#49169] [PATCH 01/11] records: Support field sanitizers Ludovic Courtès
                   ` (3 more replies)
  0 siblings, 4 replies; 40+ messages in thread
From: Ludovic Courtès @ 2021-06-22  9:02 UTC (permalink / raw)
  To: 49169; +Cc: Ludovic Courtès

Hello Guix!

This patch series does the ground work to remove input labels
from package definitions.  In other words:

  (package
    ;; …
    (inputs `(("libunistring" ,libunistring)
              ("libffi" ,libffi))))

becomes:

  (package
    ;; …
    (inputs (list libunistring libffi)))

Note that it does not change the value returned by ‘package-inputs’
& co.: that still includes input labels.  Likewise, build-side code
does not see any difference (there are still input alists).

Previous discussions at:

  https://lists.gnu.org/archive/html/guix-devel/2021-05/msg00343.html
  https://lists.gnu.org/archive/html/guix-devel/2021-06/msg00072.html

The main change is the addition of ‘guix style’, based on the script
I posted earlier.  ‘guix style’ is able to systematically preserve
comments (margin comments and line comments).  It recognizes and
“translates” several common idioms.

In the long term, the goal is to remove input labels also from
APIs like ‘package-inputs’.  With an eye on this, I introduced the
‘modify-inputs’ macro as a replacement for idioms such as:

  `(("guile" ,guile-2.2)
    ,@(alist-delete "guile" (package-inputs foo)))

which becomes:

  (modify-inputs (package-inputs foo)
    (replace "guile" guile-2.2))

Code that uses ‘modify-inputs’ does not assume that ‘package-inputs’
returns an alist.  Thus, when we eventually change that, that code
won’t need to be changed.  (‘guix style’ performs this translation,
too.)

‘guix style’ processes all 17K packages in ~3mn, leading to this:

  447 files changed, 33385 insertions(+), 44079 deletions(-)

This does not incur a single rebuild.  Some packages are not
handled by ‘guix style’ because the code pattern is not
recognized or because input labels don’t match package names
(often for no good reason).  I don’t know what fraction of
the packages is left behind; I’d guess less than a third of them.

At this stage we have everything to start the migration and to
even complete it rather quickly.  What’s needed now is to look
at corner cases and idioms that have no obvious translation in
the new style.  But you can help!

  1. Check out the ‘wip-simplified-packages’ branch (based
     on ‘core-updates’).

  2. Run ‘./pre-inst-env guix style’ (you can also list package
     names) and see whether your favorite packages are handled.

  3. If you see packages not handled by ‘guix style’, try to
     convert them by hand.  If you find an idiom that you don’t
     know how to “translate”, let’s discuss it!

Thanks in advance! :-)

Ludo’.

Ludovic Courtès (11):
  records: Support field sanitizers.
  packages: Allow inputs to be plain package lists.
  lint: Add 'input-labels' checker.
  packages: Add 'lookup-package-input' & co.
  packages: Add 'modify-inputs'.
  gnu: Change inputs of core packages to plain lists.
  utils: 'edit-expression' no longer leaks file ports.
  utils: Add 'go-to-location' with source location caching.
  utils: 'edit-expression' modifies the file only if necessary.
  utils: 'edit-expression' copies part of the original source map.
  Add 'guix style'.

 Makefile.am            |   2 +
 doc/guix.texi          | 174 +++++++++++++--
 gnu/packages/base.scm  |  48 ++---
 gnu/packages/guile.scm | 103 +++------
 gnu/packages/mes.scm   |  25 +--
 guix/lint.scm          |  36 ++++
 guix/packages.scm      | 145 ++++++++++++-
 guix/records.scm       |  65 ++++--
 guix/scripts/style.scm | 475 +++++++++++++++++++++++++++++++++++++++++
 guix/utils.scm         | 151 ++++++++++---
 po/guix/POTFILES.in    |   1 +
 tests/lint.scm         |  14 ++
 tests/packages.scm     |  86 ++++----
 tests/records.scm      |  38 ++++
 tests/style.scm        | 328 ++++++++++++++++++++++++++++
 15 files changed, 1455 insertions(+), 236 deletions(-)
 create mode 100644 guix/scripts/style.scm
 create mode 100644 tests/style.scm


base-commit: d1827d5c636adb395153a4ed6064629ed5b7664b
-- 
2.32.0





^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2021-07-12  8:48 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22  9:02 [bug#49169] [PATCH 00/11] Removing input labels from package definitions Ludovic Courtès
2021-06-22  9:08 ` [bug#49169] [PATCH 01/11] records: Support field sanitizers Ludovic Courtès
2021-06-22  9:08   ` [bug#49169] [PATCH 02/11] packages: Allow inputs to be plain package lists Ludovic Courtès
2021-06-22  9:08   ` [bug#49169] [PATCH 03/11] lint: Add 'input-labels' checker Ludovic Courtès
2021-06-22  9:08   ` [bug#49169] [PATCH 04/11] packages: Add 'lookup-package-input' & co Ludovic Courtès
2021-06-22  9:08   ` [bug#49169] [PATCH 05/11] packages: Add 'modify-inputs' Ludovic Courtès
2021-06-22  9:08   ` [bug#49169] [PATCH 06/11] gnu: Change inputs of core packages to plain lists Ludovic Courtès
2021-06-22  9:08   ` [bug#49169] [PATCH 07/11] utils: 'edit-expression' no longer leaks file ports Ludovic Courtès
2021-06-22  9:08   ` [bug#49169] [PATCH 08/11] utils: Add 'go-to-location' with source location caching Ludovic Courtès
2021-06-22  9:08   ` [bug#49169] [PATCH 09/11] utils: 'edit-expression' modifies the file only if necessary Ludovic Courtès
2021-06-22  9:08   ` [bug#49169] [PATCH 10/11] utils: 'edit-expression' copies part of the original source map Ludovic Courtès
2021-06-22  9:08   ` [bug#49169] [PATCH 11/11] Add 'guix style' Ludovic Courtès
2021-06-22  9:09 ` [bug#49169] [PATCH 00/11] Removing input labels from package definitions Ludovic Courtès
2021-06-27 18:37   ` Christopher Baines
2021-06-28  9:54     ` Ludovic Courtès
2021-06-27 11:00 ` Ludovic Courtès
2021-06-30 20:48 ` [bug#49169] [PATCH v2 00/16] " Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 01/16] records: Support field sanitizers Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 02/16] packages: Allow inputs to be plain package lists Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 03/16] lint: Add 'input-labels' checker Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 04/16] packages: Add 'lookup-package-input' & co Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 05/16] packages: Add 'modify-inputs' Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 06/16] gnu: Change inputs of core packages to plain lists Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 07/16] utils: 'edit-expression' no longer leaks file ports Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 08/16] utils: Add 'go-to-location' with source location caching Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 09/16] utils: 'edit-expression' modifies the file only if necessary Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 10/16] utils: 'edit-expression' copies part of the original source map Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 11/16] Add 'guix style' Ludovic Courtès
2021-07-01 14:13     ` zimoun
2021-06-30 20:48   ` [bug#49169] [PATCH v2 12/16] packages: 'hidden-package' inherits the original package location Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 13/16] import: pypi: Emit new-style package inputs Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 14/16] import: cran: " Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 15/16] import: print: Emit new-style package inputs when possible Ludovic Courtès
2021-06-30 20:48   ` [bug#49169] [PATCH v2 16/16] import: elpa: Emit new-style package inputs Ludovic Courtès
2021-07-10  4:53   ` [bug#49169] [PATCH 00/11] Removing input labels from package definitions Sarah Morgensen via Guix-patches via
2021-07-10 13:45     ` Ludovic Courtès
2021-07-10 23:15     ` Ludovic Courtès
2021-07-12  6:15       ` Sarah Morgensen via Guix-patches via
2021-07-12  8:47         ` Ludovic Courtès
2021-07-10 23:11   ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).