Subject: [PATCH 0/4] Rewriting implicit inputs with 'package-input-rewriting' & co.

From: Ludovic Courtès <[email-masked]>
Date: Wed, 23 Sep 2020 18:12:53 +0200

Hello Guix!

This patch set aims to hit two bird hunters with one stone:
initially my goal was to fix <https://issues.guix.gnu.org/42156>,
which has become a hindrance to the use of package transformation
options, but it also ends up addressing the fact that those
options did not, until now, rewrite implicit dependencies.

Concretely, the following commands had no effect thus far:

  guix build python-itsdangerous --with-input=python=python2
  guix build hello --with-input=gcc=gcc-toolchain@10

In both cases, this is because the input we want to change is
an implicit input.  This patch set fixes that, and it fixes
<https://issues.guix.gnu.org/42156> as a side effect.

This opens new possibilities.  ‘--with-input=python=python2’ is one
of them, but ‘--with-input=gcc=gcc-toolchain@10’ is not (it fails
to build for obscure reasons that I’ll fix in ‘core-updates’, and
it rebuilds the world anyway, which is not practical).  Another
thing that I find interesting is:

  $ guix build hello --with-graft=glibc=[email-masked]
  /gnu/store/6jv7icpjbl3pvj24db2q2fmdly9vgp4d-hello-2.10
  $ /gnu/store/6jv7icpjbl3pvj24db2q2fmdly9vgp4d-hello-2.10/bin/hello 
  Saluton, mondo!
  $ LD_TRACE_LOADED_OBJECTS=yes /gnu/store/6jv7icpjbl3pvj24db2q2fmdly9vgp4d-hello-2.10/bin/hello
          linux-vdso.so.1 (0x00007ffcc87f8000)
          libgcc_s.so.1 => /gnu/store/1sqr5fa6jbksqmi7hibqaffixy3b1j0y-gcc-7.5.0-lib/lib/libgcc_s.so.1 (0x00007f3f36c3c000)
          libc.so.6 => /gnu/store/i4iqkjx34r3nmwwblfmkbsbsd3pgapfp-glibc-2.29/lib/libc.so.6 (0x00007f3f36a82000)
          /gnu/store/i4iqkjx34r3nmwwblfmkbsbsd3pgapfp-glibc-2.29/lib/ld-linux-x86-64.so.2 (0x00007f3f36c57000)

It “relinks” the package against a different libc, assuming the
ABI is compatible (this particular example downgrades glibc, probably
less useful in the real world than upgrading; it works for ‘hello’
but not for ‘inkscape’ due to ABI differences.)

Feedback welcome!

Ludo’.

Ludovic Courtès (4):
  packages: 'package-mapping' can recurse on implicit inputs.
  packages: 'package-input-rewriting/spec' can rewrite implicit
    dependencies.
  packages: 'package-mapping' correctly recurses into 'replacement'.
  packages: 'package-input-rewriting' has a #:deep? parameter.

 doc/guix.texi           |  28 ++++----
 gnu/packages/guile.scm  |   6 +-
 guix/packages.scm       | 153 ++++++++++++++++++++++++++++------------
 tests/guix-build.sh     |  11 +++
 tests/packages.scm      | 149 ++++++++++++++++++++++++++++++++++++--
 tests/scripts-build.scm |  12 +++-
 6 files changed, 291 insertions(+), 68 deletions(-)

-- 
2.28.0