From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id n667L53Tg2CaCgAAgWs5BA (envelope-from ) for ; Sat, 24 Apr 2021 10:15:25 +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 OEVnKp3Tg2AIewAAB5/wlQ (envelope-from ) for ; Sat, 24 Apr 2021 08:15:25 +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 3F0B11E091 for ; Sat, 24 Apr 2021 10:15:25 +0200 (CEST) Received: from localhost ([::1]:36822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laDRk-00072y-Dg for larch@yhetil.org; Sat, 24 Apr 2021 04:15:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laDRO-00072r-Rt for guix-patches@gnu.org; Sat, 24 Apr 2021 04:15:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56088) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laDRO-0007b3-L1 for guix-patches@gnu.org; Sat, 24 Apr 2021 04:15:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1laDRO-0007WN-Fs for guix-patches@gnu.org; Sat, 24 Apr 2021 04:15:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47989] [PATCH] channels: Add a #:system argument to channel-instances->manifest. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 24 Apr 2021 08:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47989 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 47989@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161925204928833 (code B ref -1); Sat, 24 Apr 2021 08:15:02 +0000 Received: (at submit) by debbugs.gnu.org; 24 Apr 2021 08:14:09 +0000 Received: from localhost ([127.0.0.1]:39401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laDQW-0007Uz-Ln for submit@debbugs.gnu.org; Sat, 24 Apr 2021 04:14:09 -0400 Received: from lists.gnu.org ([209.51.188.17]:38390) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laDQV-0007Up-3D for submit@debbugs.gnu.org; Sat, 24 Apr 2021 04:14:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laDQU-0006zN-Sy for guix-patches@gnu.org; Sat, 24 Apr 2021 04:14:06 -0400 Received: from mira.cbaines.net ([212.71.252.8]:44906) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laDQT-0006wk-1L for guix-patches@gnu.org; Sat, 24 Apr 2021 04:14:06 -0400 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id 9CA1027BC7C for ; Sat, 24 Apr 2021 09:14:03 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id a510ae54 for ; Sat, 24 Apr 2021 08:14:02 +0000 (UTC) From: Christopher Baines Date: Sat, 24 Apr 2021 09:14:02 +0100 Message-Id: <20210424081402.26742-1-mail@cbaines.net> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=212.71.252.8; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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=1619252125; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jWI1K0ygA/RJS34DPIBc4vecFxItW9t8zVmHr/bX/YA=; b=ZoA+3peHbhP+nrI3osOalkzJhAb4N0TSmgEI7HTsA9uCUJHDRsGRqJaszlpCmQooKlsQre xzDmIm511R+NpHxBjSsKbS0PqDoK5YL96ufbcpO4RHooAnly3i54mvj6SrCQd99a4ImnoP Nc9Xiq7YotvA2UcKdE67Blqq5diuin/WIOxtSIANepAB5Hv8Najwf5zVDvpR3ujPCNjQuZ a7CBn6PveZmjV6gzgHWDfB3KqqU0MglnVUcM1yxcYZQdXxf+Qny6p4gzg5qZgqLN9F3jcB a3shTdUyrxwRY1plXqamTyqyIDNvkekLS/C+XX+KQ+lTOdLEgiz0pWMaJlysAQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619252125; a=rsa-sha256; cv=none; b=ny3ydgcli/fBtwOUotk45Fv+BrytUrBdSO9iTnvm7v9AHVYjPbT4EcSaHuA5yy1Oz1q4Ur 7a3zJg9fpcIdORQdPejezslqkcIA4B/h3sxlY0CbcbODEslFAcGJIvzRxqQGjx+zVD1zPM ifBL4zENlZlaPDoNZ9Q66nLzAroKIKgETaVwyUNdt2GMRFsL8FTqNfSgQdsyhUxrS66qUo sJWAzLsohvuhyqzZDqYPq/Czg1d0Xpa1IKYgeA2D7yhalYcXeyWUopUyFUvtHbApyDTFIT iMKqU8oVzhephF1jlWEIMWh2y0cjvjWmj64IxfIWltySqYPDNGU9tunYry98Xw== 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.56 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: 3F0B11E091 X-Spam-Score: 2.56 X-Migadu-Scanner: scn0.migadu.com X-TUID: mxAuqWBsExac 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 | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/guix/channels.scm b/guix/channels.scm index c40fc0c507..70a09e74ff 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -657,7 +657,7 @@ 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." @@ -700,20 +700,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." (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,7 +745,7 @@ 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." (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))) (unless core-instance @@ -865,7 +868,7 @@ 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." (define (instance->entry instance drv) @@ -883,7 +886,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