GNU bug report logs - #65665
package-mapping with #:deep? #t doesn't get all the implicit inputs

Previous Next

Package: guix;

Reported by: Ulf Herrman <striness <at> tilde.club>

Date: Thu, 31 Aug 2023 20:16:02 UTC

Severity: important

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Ulf Herrman <striness <at> tilde.club>
Cc: 65665 <at> debbugs.gnu.org
Subject: bug#65665: package-mapping with #:deep? #t doesn't get all the implicit inputs
Date: Thu, 12 Oct 2023 16:06:47 +0200
Ulf Herrman <striness <at> tilde.club> skribis:

> -(define (build-system-with-package-mapping bs rewrite)
> +(define (build-system-with-package-mapping bs rewrite-input rewrite-argument)
>    "Return a variant of BS, a build system, that rewrites a bag's inputs by
>  passing them through REWRITE, a procedure that takes an input tuplet and
>  returns a \"rewritten\" input tuplet."
> @@ -1442,9 +1442,10 @@ (define (build-system-with-package-mapping bs rewrite)
>      (let ((lowered (apply lower args)))
>        (bag
>          (inherit lowered)
> -        (build-inputs (map rewrite (bag-build-inputs lowered)))
> -        (host-inputs (map rewrite (bag-host-inputs lowered)))
> -        (target-inputs (map rewrite (bag-target-inputs lowered))))))
> +        (build-inputs (map rewrite-input (bag-build-inputs lowered)))
> +        (host-inputs (map rewrite-input (bag-host-inputs lowered)))
> +        (target-inputs (map rewrite-input (bag-target-inputs lowered)))
> +        (arguments (map rewrite-argument (bag-arguments lowered))))))

Aah, now I understand.  :-)

It’s indeed the case that arguments can capture references to packages
that won’t be caught by ‘package-mapping’.  For instance, if you write:

  (package
    …
    (arguments (list … #~(whatever #$coreutils))))

… then ‘coreutils’ here cannot be replaced.

To address this, the recommendation is to always add dependencies to
input fields and to use self-references within arguments.  The example
above should be written like this:

  (package
    …
    (arguments
     (list … #~(whatever #$(this-package-input "coreutils")))))

It’s just a recommendation and one can perfectly ignore it, and I
suppose that was the impetus for this patch.

This is one of the things discussed while designing this change:

  https://guix.gnu.org/en/blog/2021/the-big-change/
  (search for “self-referential records”)

  https://issues.guix.gnu.org/49169

My take was and still is that it’s an acceptable limitation.  Packagers
need to follow the guideline above if they want proper support for
rewriting, ‘guix graph’, and other tools.

WDYT?

Thanks,
Ludo’.




This bug report was last modified 1 year and 242 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.