GNU bug report logs - #47989
[PATCH] channels: Add a #:system argument to channel-instances->manifest.

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Sat, 24 Apr 2021 08:15:02 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

Full log


Message #26 received at 47989 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 47989 <at> debbugs.gnu.org
Subject: Re: bug#47989: [PATCH] channels: Add a #:system argument to
 channel-instances->manifest.
Date: Wed, 05 May 2021 12:25:11 +0100
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:

> Christopher Baines <mail <at> cbaines.net> skribis:
>
>> This allows computing a manifest for a specific system. Previously this was
>> possible, but only through changing %current-system, which caused the
>> derivation to be computed using that system as well (so computing a derivation
>> for aarch64-linux on x86_64-linux would require running aarch64-linux code).
>>
>> This new argument adds the possibility of computing derivations for non-native
>> systems, without having to run non-native code.
>>
>> I'm looking at this as it will enable the Guix Data Service to compute channel
>> instance derivations without relying on QEMU emulation for non-native
>> systems (it should be faster as well).
>>
>> * guix/channels.scm (build-from-source): Add #:system argument and pass to
>> build.
>> (build-channel-instance): Add system argument and pass to build-from-source.
>> (channel-instance-derivations): Add #:system argument and pass to
>> build-channel-instance, also rename system to current-system-value.
>> (channel-instances->manifest): Add #:system argument and pass to
>> channel-instance-derivations.
>
> [...]
>
>>  (define* (build-from-source instance
>> -                            #:key core verbose? (dependencies '()))
>> +                            #:key core verbose? (dependencies '()) system)
>>    "Return a derivation to build Guix from INSTANCE, using the self-build
>>  script contained therein.  When CORE is true, build package modules under
>>  SOURCE using CORE, an instance of Guix."
>
> Please mention SYSTEM in the docstring.
>
>> +(define* (channel-instance-derivations instances #:key system)
>>    "Return the list of derivations to build INSTANCES, in the same order as
>>  INSTANCES."
>>    (define core-instance
>> @@ -757,14 +759,15 @@ INSTANCES."
>>      (resolve-dependencies instances))
>>
>>    (define (instance->derivation instance)
>> -    (mlet %store-monad ((system (current-system)))
>> +    (mlet %store-monad ((current-system-value (current-system)))
>>        (mcached (if (eq? instance core-instance)
>> -                   (build-channel-instance instance)
>> +                   (build-channel-instance instance system)
>>                     (mlet %store-monad ((core (instance->derivation core-instance))
>>                                         (deps (mapm %store-monad instance->derivation
>>                                                     (edges instance))))
>> -                     (build-channel-instance instance core deps)))
>> +                     (build-channel-instance instance system core deps)))
>>                 instance
>> +               current-system-value
>>                 system)))
>
> Here, there should not be any additional key to ‘mcached’ since there’s
> only one system being targeted.
>
> Instead, it should look something like this:
>
>   (define (instance->derivation core-instance)
>     (mlet %store-monad ((system (if system (return system) (current-system))))
>       (mcached …         ;pass ‘system’ to callees
>                instance
>                system))) ;unchanged

Sure, I've sent an updated patch that updates docstrings and makes the
above changes.
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 4 years and 14 days ago.

Previous Next


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