diff mbox series

[bug#71038,v4,3/3] inferior: Use the host built-in-builders with inferior.

Message ID a85396e292cdbbc044742004c449b52fe59d5362.1721134116.git.mail@cbaines.net
State New
Headers show
Series [bug#71038,v4,1/3] guix: store: Enable specifying the builtin builders. | expand

Commit Message

Christopher Baines July 16, 2024, 12:48 p.m. UTC
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(-)

Comments

Ludovic Courtès July 18, 2024, 9:35 a.m. UTC | #1
Christopher Baines <mail@cbaines.net> skribis:

> 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

LGTM as well!

Thanks,
Ludo'.
Christopher Baines July 18, 2024, 1:08 p.m. UTC | #2
Ludovic Courtès <ludo@gnu.org> writes:

> Christopher Baines <mail@cbaines.net> skribis:
>
>> 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
>
> LGTM as well!

Thanks for taking a look, I've pushed this to master as
f3e17f9ff1bf77b4ebddf0de3340e77e2ec8a830.

Chris
diff mbox series

Patch

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 <store-connection> (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.