From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KD37DZWAkmAwOAAAgWs5BA (envelope-from ) for ; Wed, 05 May 2021 13:25:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id ap2fCZWAkmCeEgAAB5/wlQ (envelope-from ) for ; Wed, 05 May 2021 11:25:09 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E37C025DE9 for ; Wed, 5 May 2021 13:25:08 +0200 (CEST) Received: from localhost ([::1]:51048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leFeO-0008Uu-3l for larch@yhetil.org; Wed, 05 May 2021 07:25:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leFeI-0008Sd-Pi for guix-patches@gnu.org; Wed, 05 May 2021 07:25:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:47967) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leFeI-0001e2-HY for guix-patches@gnu.org; Wed, 05 May 2021 07:25:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1leFeI-0008RJ-EX for guix-patches@gnu.org; Wed, 05 May 2021 07:25:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47989] [PATCH v2] channels: Add a #:system argument to channel-instances->manifest. References: <20210424081402.26742-1-mail@cbaines.net> In-Reply-To: <20210424081402.26742-1-mail@cbaines.net> Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 05 May 2021 11:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47989 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 47989@debbugs.gnu.org Received: via spool by 47989-submit@debbugs.gnu.org id=B47989.162021386432411 (code B ref 47989); Wed, 05 May 2021 11:25:02 +0000 Received: (at 47989) by debbugs.gnu.org; 5 May 2021 11:24:24 +0000 Received: from localhost ([127.0.0.1]:59507 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1leFdg-0008Qh-Cd for submit@debbugs.gnu.org; Wed, 05 May 2021 07:24:24 -0400 Received: from mira.cbaines.net ([212.71.252.8]:53002) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1leFdc-0008Qb-Mi for 47989@debbugs.gnu.org; Wed, 05 May 2021 07:24:22 -0400 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id D635227BC81 for <47989@debbugs.gnu.org>; Wed, 5 May 2021 12:24:19 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 34e18058 for <47989@debbugs.gnu.org>; Wed, 5 May 2021 11:24:19 +0000 (UTC) From: Christopher Baines Date: Wed, 5 May 2021 12:24:19 +0100 Message-Id: <20210505112419.14893-1-mail@cbaines.net> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620213909; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=Lkao6XpKMZ4TX+bsJo+dJoD7N50GyrOrcz3cxpRFx+E=; b=iC7QCxpYTEeD9B0c7UIv4Y4+Ox/7vVqxtJBOASG3uqIzokLizmHWpyL3C4sGouIXW+lk+e iRd5kMKkq4GBpfMI87zL1wVPCEtCDBmLoXZ3DeMoMTrTBT6p6ARe/gfaddH09gHXzlvULp DmO5+xzAplzNJdcbXO3M4RQzr95/2zDQanraoQCaMkRt88lioVfFfKasOI4kNpbFDEtSgd Wv8H2lnSczYk+6kZif+VWa2uH7sc9+Lvo+HaJFIuKDP3sojeFxlyKPeDaT5TEAzwLtJg41 2X+G1wfpdkQLwkmVo5PQm8dKLU3HcQ9dfbZpLyZUVYePHwQ7UKL86hxEiNqPFw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620213909; a=rsa-sha256; cv=none; b=O00P0obcI/Hfv8rWsbO/NTW1acq0IgZwc7e5sY0kqGCrffXXqvWDH+ztnedkuMMaC5E6EM yzXdzFn4y+1rs6xZHTRzITew1zhev6hnkfyMCsRhrwcxjoWqj/1T6qwSfdgRovpl0Hmwtu PirmUCeP1Me+W+Dxe+YlzWMA5WgsmjZAS2p7KhD5T0c07y/YUGxfNMIrCTgQZWZZIyhqmR o4L4A7KPGstKy9PM3ffcluoAac9hldWDm0/BuVQ+HwNW6jBhj0r5BB8z9xCiXaBsK909tr IOTcGPaAHjalv0d9dxApj3pdnTu8NUCEweGAXflLUdxXYgmqQKqw4hK+c6lIiw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 2.54 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: E37C025DE9 X-Spam-Score: 2.54 X-Migadu-Scanner: scn0.migadu.com X-TUID: PYWc+PfvWK2o 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. --- guix/channels.scm | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/guix/channels.scm b/guix/channels.scm index c40fc0c507..476d62e1f4 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -657,10 +657,11 @@ that unconditionally resumes the continuation." store)))) (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." +SOURCE using CORE, an instance of Guix. By default, build for the current +system, or SYSTEM if specified." (define name (symbol->string (channel-name (channel-instance-channel instance)))) @@ -700,20 +701,22 @@ SOURCE using CORE, an instance of Guix." (with-trivial-build-handler (build source #:verbose? verbose? #:version commit + #:system system #:channel-metadata (channel-instance->sexp instance) #:pull-version %pull-version)))) ;; Build a set of modules that extend Guix using the standard method. (standard-module-derivation name source core dependencies))) -(define* (build-channel-instance instance +(define* (build-channel-instance instance system #:optional core (dependencies '())) "Return, as a monadic value, the derivation for INSTANCE, a channel -instance. DEPENDENCIES is a list of extensions providing Guile modules that -INSTANCE depends on." +instance, for SYSTEM. DEPENDENCIES is a list of extensions providing Guile +modules that INSTANCE depends on." (build-from-source instance #:core core - #:dependencies dependencies)) + #:dependencies dependencies + #:system system)) (define (resolve-dependencies instances) "Return a procedure that, given one of the elements of INSTANCES, returns @@ -743,9 +746,9 @@ list of instances it depends on." (lambda (instance) (vhash-foldq* cons '() instance edges))) -(define (channel-instance-derivations instances) +(define* (channel-instance-derivations instances #:key system) "Return the list of derivations to build INSTANCES, in the same order as -INSTANCES." +INSTANCES. Build for the current system by default, or SYSTEM if specified." (define core-instance ;; The 'guix' channel is treated specially: it's an implicit dependency of ;; all the other channels. @@ -757,13 +760,13 @@ INSTANCES." (resolve-dependencies instances)) (define (instance->derivation instance) - (mlet %store-monad ((system (current-system))) + (mlet %store-monad ((system (if system (return system) (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 system))) @@ -865,9 +868,10 @@ derivation." intro)))))) '())))) -(define (channel-instances->manifest instances) +(define* (channel-instances->manifest instances #:key system) "Return a profile manifest with entries for all of INSTANCES, a list of -channel instances." +channel instances. By default, build for the current system, or SYSTEM if +specified." (define (instance->entry instance drv) (let ((commit (channel-instance-commit instance)) (channel (channel-instance-channel instance))) @@ -883,7 +887,8 @@ channel instances." (properties `((source ,(channel-instance->sexp instance))))))) - (mlet* %store-monad ((derivations (channel-instance-derivations instances)) + (mlet* %store-monad ((derivations (channel-instance-derivations instances + #:system system)) (entries -> (map instance->entry instances derivations))) (return (manifest entries)))) -- 2.30.1