unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 47989@debbugs.gnu.org
Subject: [bug#47989] [PATCH] channels: Add a #:system argument to channel-instances->manifest.
Date: Wed, 05 May 2021 12:25:11 +0100	[thread overview]
Message-ID: <87wnsdbey0.fsf@cbaines.net> (raw)
In-Reply-To: <878s4ur4gq.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 3295 bytes --]


Ludovic Courtès <ludo@gnu.org> writes:

> Christopher Baines <mail@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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

  reply	other threads:[~2021-05-05 11:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-24  8:14 [bug#47989] [PATCH] channels: Add a #:system argument to channel-instances->manifest Christopher Baines
2021-05-03 20:56 ` Ludovic Courtès
2021-05-03 21:35   ` Christopher Baines
2021-05-04 13:48     ` Ludovic Courtès
2021-05-05  9:28       ` Christopher Baines
2021-05-11  8:48         ` Ludovic Courtès
2021-05-04 13:52 ` Ludovic Courtès
2021-05-05 11:25   ` Christopher Baines [this message]
2021-05-05 11:24 ` [bug#47989] [PATCH v2] " Christopher Baines
2021-05-11  8:52   ` [bug#47989] [PATCH] " Ludovic Courtès
2021-05-12  8:52     ` bug#47989: " Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnsdbey0.fsf@cbaines.net \
    --to=mail@cbaines.net \
    --cc=47989@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).