Subject: (%guile-for-build) default in ‘computed-file’

From: Ludovic Courtès <[email-masked]>
Date: Thu, 23 Feb 2023 16:44:49 +0100

Hello!

Maxim Cournoyer <[email-masked]> skribis:

> Hi Ludovic!
>
> Ludovic Courtès <[email-masked]> writes:
>
>> Hi Maxim,
>>
>> Maxim Cournoyer <[email-masked]> skribis:
>>
>>> Ludovic Courtès <[email-masked]> writes:
>>>
>>>> Hello!
>>>>
>>>> Maxim Cournoyer <[email-masked]> skribis:
>>>>
>>>>> * guix/gexp.scm (computed-file): Set the default value of the #:guile argument
>>>>> to that of the %guile-for-build parameter.
>>>>
>>>> [...]
>>>>
>>>>>  (define* (computed-file name gexp
>>>>> -                        #:key guile (local-build? #t) (options '()))
>>>>> +                        #:key (guile (%guile-for-build))
>>>>> +                        (local-build? #t) (options '()))
>>>>
>>>> I think that would lead ‘computed-file’ to pick (%guile-for-build) at
>>>> the wrong time (time of call instead of time of lowering).
>>>>
>>>> Commit ab25eb7caaf5571cc9f8d6397a1eae127d7e29d1 made it #f such that
>>>> ‘gexp->derivation’ gets to resolve it at the “right” time.
>>>
>>> I see!  I think you are right.  Would making the change in the
>>> associated gexp compiler do the right thing?  Currently it ignores the
>>> %guile-for-build fluid as set in the tests/pack.scm test suite for
>>> example.  Something like this:
>>
>> I don’t fully understand the context.  My preference would go to doing
>> like the ‘computed-file’ tests in ‘tests/gexp.scm’, where we explicitly
>> pass #:guile %bootstrap-guile.
>
> With the refactoring done in patch 3/5 ("pack: Extract
> populate-profile-root from self-contained-tarball/builder."), a
> computed-file is used in the factorized building block
> 'populate-profile-root'.  Without this patch, the tests making use of it
> would attempt to build Guile & friends in the test store.
>
>> That said, it seems like patch #5 in this series doesn’t actually use
>> ‘computed-file’ in ‘tests/pack.scm’, does it?
>
> It does, indirectly.
>
> I hope that helps!

I’m really not sure what the impact of
68775338a510f84e63657ab09242d79e726fa457 is, nor whether it was the only
solution to the problem.

One thing that probably happens is that (default-guile) is now never
used for <computed-file>, contrary to what was happening before.  The
spirit is that (default-guile) would be used as the default for all the
declarative file-like objects; gexp compilers refer to (default-guile),
not (%guile-for-build).

Importantly, (%guile-for-build) is a derivation, possibly built for
another system, whereas (default-guile) is a package, which allows
‘lower-object’ to return the derivation for the right system type.

Overall, I think this change should be reverted but of course, we should
find a solution to the problem you hit in the first place.

I hope this makes sense to you.

Ludo’.