From patchwork Tue Jul 16 12:48:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 29334 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1E98827BBEA; Tue, 16 Jul 2024 13:49:28 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5B35427BBE2 for ; Tue, 16 Jul 2024 13:49:27 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sThc7-0001vL-Tv; Tue, 16 Jul 2024 08:49:03 -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 1sThc6-0001un-Rx for guix-patches@gnu.org; Tue, 16 Jul 2024 08:49:02 -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 1sThc6-0004Pl-Eh; Tue, 16 Jul 2024 08:49:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sThc6-0007nZ-K6; Tue, 16 Jul 2024 08:49:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71038] [PATCH v4 3/3] inferior: Use the host built-in-builders with inferior. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Tue, 16 Jul 2024 12:49: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 , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 71038-submit@debbugs.gnu.org id=B71038.172113413729954 (code B ref 71038); Tue, 16 Jul 2024 12:49:02 +0000 Received: (at 71038) by debbugs.gnu.org; 16 Jul 2024 12:48:57 +0000 Received: from localhost ([127.0.0.1]:32917 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sThc0-0007n2-Jo for submit@debbugs.gnu.org; Tue, 16 Jul 2024 08:48:56 -0400 Received: from mira.cbaines.net ([212.71.252.8]:43958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sThbv-0007mV-LD for 71038@debbugs.gnu.org; Tue, 16 Jul 2024 08:48:53 -0400 Received: from localhost (82-132-219-126.dab.02.net [82.132.219.126]) by mira.cbaines.net (Postfix) with ESMTPSA id 37EBF27BBEA for <71038@debbugs.gnu.org>; Tue, 16 Jul 2024 13:48:48 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id a6cb30a3 for <71038@debbugs.gnu.org>; Tue, 16 Jul 2024 12:48:37 +0000 (UTC) From: Christopher Baines Date: Tue, 16 Jul 2024 13:48:36 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: <8075bccd0026e76f16f91d51c5b9203b5693b03e.1721134116.git.mail@cbaines.net> References: <8075bccd0026e76f16f91d51c5b9203b5693b03e.1721134116.git.mail@cbaines.net> MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Rather than querying the built-in-builders from the inferior, as using the host value allows specifying it when opening the connection. * guix/inferior.scm (port->inferior): Have cached-store-connection take the built-in-builders. (inferior-eval-with-store): Call cached-store-connection with the store connection built-in-builders. Change-Id: I27c20732355c0c6aa646748a02df39db302cd568 --- guix/inferior.scm | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/guix/inferior.scm b/guix/inferior.scm index 190ba01b3c..b60bf1ab01 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -253,7 +253,8 @@ (define* (port->inferior pipe #:optional (close close-port)) result) (inferior-eval '(begin (define %store-table (make-hash-table)) - (define (cached-store-connection store-id version) + (define (cached-store-connection store-id version + built-in-builders) ;; Cache connections to store ID. This ensures that ;; the caches within (in ;; particular the object cache) are reused across @@ -268,9 +269,19 @@ (define* (port->inferior pipe #:optional (close close-port)) ;; risk of talking to the wrong daemon or having ;; our build result reclaimed (XXX). (let ((store (if (defined? 'port->connection) - (port->connection %bridge-socket - #:version - version) + ;; #:built-in-builders was + ;; added in 2024 + (catch 'keyword-argument-error + (lambda () + (port->connection %bridge-socket + #:version + version + #:built-in-builders + built-in-builders)) + (lambda _ + (port->connection %bridge-socket + #:version + version))) (open-connection)))) (hashv-set! %store-table store-id store) store)))) @@ -690,11 +701,13 @@ (define (inferior-eval-with-store inferior store code) ;; The address of STORE itself is not a good identifier because it ;; keeps changing through the use of "functional caches". The ;; address of its socket port makes more sense. - (store-id (object-address (store-connection-socket store)))) + (store-id (object-address (store-connection-socket store))) + (store-built-in-builders (built-in-builders store))) (ensure-store-bridge! inferior) (send-inferior-request `(let ((proc ,code) - (store (cached-store-connection ,store-id ,proto))) + (store (cached-store-connection ,store-id ,proto + ',store-built-in-builders))) ;; Serialize '&store-protocol-error' conditions. The exception ;; serialization mechanism that 'read-repl-response' expects is ;; unsuitable for SRFI-35 error conditions, hence this special case.