Subject: Re: [bug#70895] [PATCH] grafts: Only compute necessary graft derivations.

From: Ludovic Courtès <[email-masked]>
Date: Fri, 31 Jan 2025 17:26:13 +0100

Hi David,

David Elsing <[email-masked]> skribis:

>> My thought was that the fact that grafts must be enabled on the
>> replacement, etc., are implementation details.  I’d like producers of
>> <graft> records to just be able to drop whatever is relevant to them in
>> the ‘replacement’ field.
>
> Ah sure, that makes sense to me.
>
>> Let me know if you notice something wrong.
>
> I noticed that 'with-parameters' doesn't actually do anything here. :)
> The 'graft-origin' is already a derivation anyway, so there it has
> obviously no effect. For the 'graft-replacement', I noticed that when
> setting %graft? to #f, it still results in the same grafted derivation.
> The same was the case in my version using 'with-parameters' in
> 'input-graft' of course.

Hmm.  For ‘graft-origin’, it doesn’t really matter; but the replacement,
it does.

> The grafting still works correctly however, I think because the %graft?
> parameter is also set when the derivations are actually calculated,
> while in 'input-graft', 'package->derivation' is explicitely called with
> #:graft? set to #f.

OK, pfew.

> [1] https://issues.guix.gnu.org/75879

Uh, looks like this is a real bug.  I’m surprised because we do have
tests for that in ‘tests/gexp.scm’ (and it’s actually used in a few
important places), but maybe they’re not exercising the right thing.

Ludo’.