From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id CAd4NxSrSGYrcgAAqHPOHw:P1 (envelope-from ) for ; Sat, 18 May 2024 15:20:21 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id CAd4NxSrSGYrcgAAqHPOHw (envelope-from ) for ; Sat, 18 May 2024 15:20:21 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1716038420; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=I3I7HAH1BH7M99OVSOnToiYgtLn1H3oKpo3hriaC/M8=; b=TFWwI/KWORWEcLXL4yQacnJM/o1EraMoqC2puVVmdrzvnhAeR3eafPh15EKtOs7ywbnjvJ ww6POFIV/ty6agvjQVVp3trvVP0887cQl4yBNckJFQZFmfFGqQSBlbR3GG0CBAssqWIOfU Cvz/f0mWtsJY+3GGWCbTPosuQ6uSBSFO9b7J7cGASSdshUFRqjhXpjkjhnnFY/hCHKVZVD 7xru43UghxeKmwAWhgcRLR4AwQpZacT+L2bBSSxsO3AlrAE52FMjEfEw2FHasurk9Ugqls bJYWhFVtnz4UEayiM6QYakqX9S9tV93hyBML+ef1hXzI53eBNw/AKBlyEMVd9g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1716038420; a=rsa-sha256; cv=none; b=LVxiHuIVqhHOWC3HljOH5mz6409RmugBr2PzwnjDTQaXalMpi64zfeTEi80rY6AtxQd5G7 WcMOEBIWeY3+ho9xcbqUdamcXX0gM1RHKGnLJQ33afqaz0ZJQKRuCaGnMMnv7DYsPiayDP ORf6oKzkgQZxvSyt8hCN+jYr2bCEqIB0d65b6uebwpY4Q7r7XkSarP/3lnKM2pO5Lw6ZT2 wnlccrKQSaWjEnjc44PDi9IXKYkmhEkrs4hRZYV2RZylJE41eXwCJAw4mG/Vp0AV9Hdr2F FRrHzzDF7AQglDb9UT8fThqbT8vvOsFtcqrXbcXhPWf34rc3NEOq2uzYzSopQA== 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 19D6916BFB for ; Sat, 18 May 2024 15:20:19 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s8Jyq-0002I5-Uj; Sat, 18 May 2024 09:20:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s8Jym-0002Hc-2t for guix-patches@gnu.org; Sat, 18 May 2024 09:20:04 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s8Jyj-0005KH-1r; Sat, 18 May 2024 09:20:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s8Jyk-0006AS-LD; Sat, 18 May 2024 09:20:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71038] [PATCH 2/2] guix: channels: Enable specifiying available builtin builders. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sat, 18 May 2024 13:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71038 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71038@debbugs.gnu.org Cc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 71038-submit@debbugs.gnu.org id=B71038.171603838823686 (code B ref 71038); Sat, 18 May 2024 13:20:02 +0000 Received: (at 71038) by debbugs.gnu.org; 18 May 2024 13:19:48 +0000 Received: from localhost ([127.0.0.1]:33449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s8JyV-00069y-Um for submit@debbugs.gnu.org; Sat, 18 May 2024 09:19:48 -0400 Received: from mira.cbaines.net ([212.71.252.8]:43558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s8JyQ-00069g-OB for 71038@debbugs.gnu.org; Sat, 18 May 2024 09:19:43 -0400 Received: from localhost (unknown [89.207.171.92]) by mira.cbaines.net (Postfix) with ESMTPSA id 7257B27BBE9 for <71038@debbugs.gnu.org>; Sat, 18 May 2024 14:19:38 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id ba9ae70a for <71038@debbugs.gnu.org>; Sat, 18 May 2024 13:19:36 +0000 (UTC) From: Christopher Baines Date: Sat, 18 May 2024 14:19:35 +0100 Message-ID: <3724435f5b2e86be53ffba5bffcbfdf493b48e5c.1716038375.git.mail@cbaines.net> X-Mailer: git-send-email 2.41.0 In-Reply-To: <6b9c634c024b6fd7a50d3b82edc244676a8ca8e8.1716038375.git.mail@cbaines.net> References: <6b9c634c024b6fd7a50d3b82edc244676a8ca8e8.1716038375.git.mail@cbaines.net> 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -3.36 X-Spam-Score: -3.36 X-Migadu-Queue-Id: 19D6916BFB X-Migadu-Scanner: mx13.migadu.com X-TUID: gDg41ubT+h75 When computing channel instance derivations. This is useful when you want to generate compatible derivations that can be run with a daemon that potentially doesn't support builtin builders that the daemon you're using to generate the derivations has. I'm looking at this in particular because I want to use this in the data service, since it provides substitutes for derivations, and since these can be built on other machines, it's useful to control which builtin builders they depend on. Fixes: . * build-aux/build-self.scm (build-program): Accept #:assume-available-builtin-builders and pass along to port->connection or open-connection as approriate. (build): Accept and pass on #:assume-available-builtin-builders. * guix/channels.scm (build-from-source, build-channel-instance, channel-instance-derivations, channel-instances->manifest, channel-instances->derivation): Accept and pass on #:assume-available-builtin-builders. Change-Id: I315c990de66c6f7dca25a859165a5568abe385ea --- build-aux/build-self.scm | 28 ++++++++++++++++++-------- guix/channels.scm | 43 +++++++++++++++++++++++++++++----------- 2 files changed, 51 insertions(+), 20 deletions(-) diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm index 02822a2ee8..7afb13c1e4 100644 --- a/build-aux/build-self.scm +++ b/build-aux/build-self.scm @@ -241,7 +241,8 @@ (define guile-gcrypt (define* (build-program source version #:optional (guile-version (effective-version)) - #:key (pull-version 0) (channel-metadata #f)) + #:key (pull-version 0) (channel-metadata #f) + assume-available-builtin-builders) "Return a program that computes the derivation to build Guix from SOURCE." (define select? ;; Select every module but (guix config) and non-Guix modules. @@ -331,11 +332,20 @@ (define* (build-program source version ;; case, attempt to open a new connection. (let* ((proto (string->number protocol-version)) (store (if (integer? proto) - (port->connection (duplicate-port - (current-input-port) - "w+0") - #:version proto) - (open-connection))) + (port->connection + (duplicate-port + (current-input-port) + "w+0") + #:version proto + #$@(if assume-available-builtin-builders + #~(#:assume-available-builtin-builders + '(#$@assume-available-builtin-builders)) + '())) + (open-connection + #$@(if assume-available-builtin-builders + #~(#:assume-available-builtin-builders + '(#$@assume-available-builtin-builders)) + '())))) (sock (socket AF_UNIX SOCK_STREAM 0))) ;; Connect to BUILD-OUTPUT and send it the raw ;; build output. @@ -406,7 +416,7 @@ (define* (build source (guile-version (if (> pull-version 0) "3.0" (effective-version))) - + assume-available-builtin-builders #:allow-other-keys #:rest rest) "Return a derivation that unpacks SOURCE into STORE and compiles Scheme @@ -415,7 +425,9 @@ (define* (build source ;; SOURCE. (mlet %store-monad ((build (build-program source version guile-version #:channel-metadata channel-metadata - #:pull-version pull-version)) + #:pull-version pull-version + #:assume-available-builtin-builders + assume-available-builtin-builders)) (system (if system (return system) (current-system))) (home -> (getenv "HOME")) diff --git a/guix/channels.scm b/guix/channels.scm index 0d7bc541cc..6469d08bb9 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -704,7 +704,8 @@ (define (with-trivial-build-handler mvalue) store)))) (define* (build-from-source instance - #:key core verbose? (dependencies '()) system) + #:key core verbose? (dependencies '()) system + assume-available-builtin-builders) "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. By default, build for the current @@ -750,20 +751,25 @@ (define* (build-from-source instance #:verbose? verbose? #:version commit #:system system #:channel-metadata (channel-instance->sexp instance) - #:pull-version %pull-version)))) + #:pull-version %pull-version + #:assume-available-builtin-builders + assume-available-builtin-builders)))) ;; Build a set of modules that extend Guix using the standard method. (standard-module-derivation name source core dependencies))) (define* (build-channel-instance instance system - #:optional core (dependencies '())) + #:optional core (dependencies '()) + #:key assume-available-builtin-builders) "Return, as a monadic value, the derivation for INSTANCE, a channel instance, for SYSTEM. DEPENDENCIES is a list of extensions providing Guile modules that INSTANCE depends on." (build-from-source instance #:core core #:dependencies dependencies - #:system system)) + #:system system + #:assume-available-builtin-builders + assume-available-builtin-builders)) (define (resolve-dependencies instances) "Return a procedure that, given one of the elements of INSTANCES, returns @@ -793,7 +799,8 @@ (define (resolve-dependencies instances) (lambda (instance) (vhash-foldq* cons '() instance edges))) -(define* (channel-instance-derivations instances #:key system) +(define* (channel-instance-derivations instances #:key system + assume-available-builtin-builders) "Return the list of derivations to build INSTANCES, in the same order as INSTANCES. Build for the current system by default, or SYSTEM if specified." (define core-instance @@ -809,11 +816,15 @@ (define* (channel-instance-derivations instances #:key system) (define (instance->derivation instance) (mlet %store-monad ((system (if system (return system) (current-system)))) (mcached (if (eq? instance core-instance) - (build-channel-instance instance system) + (build-channel-instance instance system + #:assume-available-builtin-builders + assume-available-builtin-builders) (mlet %store-monad ((core (instance->derivation core-instance)) (deps (mapm %store-monad instance->derivation (edges instance)))) - (build-channel-instance instance system core deps))) + (build-channel-instance instance system core deps + #:assume-available-builtin-builders + assume-available-builtin-builders))) instance system))) @@ -915,7 +926,8 @@ (define (channel-instance->sexp instance) intro)))))) '())))) -(define* (channel-instances->manifest instances #:key system) +(define* (channel-instances->manifest instances #:key system + assume-available-builtin-builders) "Return a profile manifest with entries for all of INSTANCES, a list of channel instances. By default, build for the current system, or SYSTEM if specified." @@ -934,8 +946,11 @@ (define* (channel-instances->manifest instances #:key system) (properties `((source ,(channel-instance->sexp instance))))))) - (mlet* %store-monad ((derivations (channel-instance-derivations instances - #:system system)) + (mlet* %store-monad ((derivations (channel-instance-derivations + instances + #:system system + #:assume-available-builtin-builders + assume-available-builtin-builders)) (entries -> (map instance->entry instances derivations))) (return (manifest entries)))) @@ -990,10 +1005,14 @@ (define %channel-profile-hooks ;; The default channel profile hooks. (cons package-cache-file %default-profile-hooks)) -(define (channel-instances->derivation instances) +(define* (channel-instances->derivation instances + #:key assume-available-builtin-builders) "Return the derivation of the profile containing INSTANCES, a list of channel instances." - (mlet %store-monad ((manifest (channel-instances->manifest instances))) + (mlet %store-monad ((manifest (channel-instances->manifest + instances + #:assume-available-builtin-builders + assume-available-builtin-builders))) ;; Emit a profile in format version so that, if INSTANCES denotes an old ;; Guix, it can still read that profile, for instance for the purposes of ;; 'guix describe'. -- 2.41.0