Message ID | 20210622090221.15182-1-ludo@gnu.org |
---|---|
Headers | show |
Series | Removing input labels from package definitions | expand |
Hi! Ludovic Courtès <ludo@gnu.org> skribis: > 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). The 2nd phase of this change (could be a year from now) would be to remove labels entirely from the API: ‘package-inputs’ and related procedures would return a label-less list. We’d most likely keep the ‘%build-inputs’ and ‘inputs’ alists on the build side. However, this phase will be trickier. Labels currently serve as an indirection to implement “virtual dependencies”, as in this example: (package ;; … (arguments '(… (assoc-ref inputs "mpi") …)) (inputs `(("mpi" ,openmpi)))) Here you can replace ‘openmpi’ with ‘mpich’ or ‘my-custom-openmpi’ (through inheritance or with ‘--with-input’) and the build-side code in ‘arguments’ still behaves as expected. Once labels have fully disappeared, the build-side ‘inputs’ could only contain the real package name, so either “openmpi” or “mpich”. We could replace the build-side ‘assoc-ref’ with host-side code like: (package ;; … (arguments (list #:phases #~(… #$(lookup-package-input this-package "openmpi") …)))) but again, it depends on the actual package name, so it doesn’t help. So we need… something else. I don’t think it’s a showstopper for this patch series, but it does mean that for the time being one has to know about labels to understand what happens in package variants. Ludo’.
Hi! This is an improved version of this patch series, with the following changes: • ‘guix style’ supports -e/--expression and --input-simplification=POLICY. The latter allows users to ask for input simplification even when labels don’t match package names (this is useful in obvious cases where there’s a “libX11” label for the “libx11” package, for instance.) • I changed a few importers to emit simplified package inputs. We’ll have to take care of the other importers eventually. I plan to merge this series by the end of the week on ‘core-updates’. The plan is to run ‘guix style’ (with no arguments: convert all the packages as long as that does not involve a rebuild) towards the end of the ‘core-updates’ cycle so as to minimize merge conflicts. Thanks, Ludo’. Ludovic Courtès (16): 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'. packages: 'hidden-package' inherits the original package location. import: pypi: Emit new-style package inputs. import: cran: Emit new-style package inputs. import: print: Emit new-style package inputs when possible. import: elpa: Emit new-style package inputs. .dir-locals.el | 6 + Makefile.am | 2 + doc/guix.texi | 208 ++++++++++++++-- gnu/packages/base.scm | 48 ++-- gnu/packages/guile.scm | 103 +++----- gnu/packages/mes.scm | 25 +- guix/import/cran.scm | 8 +- guix/import/elpa.scm | 7 +- guix/import/print.scm | 57 +++-- guix/import/pypi.scm | 15 +- guix/lint.scm | 36 +++ guix/packages.scm | 146 +++++++++++- guix/records.scm | 65 +++-- guix/scripts/style.scm | 527 +++++++++++++++++++++++++++++++++++++++++ guix/utils.scm | 151 +++++++++--- po/guix/POTFILES.in | 1 + tests/cran.scm | 10 +- tests/lint.scm | 14 ++ tests/packages.scm | 86 ++++--- tests/print.scm | 4 +- tests/pypi.scm | 18 +- tests/records.scm | 38 +++ tests/style.scm | 366 ++++++++++++++++++++++++++++ 23 files changed, 1643 insertions(+), 298 deletions(-) create mode 100644 guix/scripts/style.scm create mode 100644 tests/style.scm base-commit: 4c0cf61afd5ed62e830f2e87ef6b72505f2c303a