inferior: Use the host built-in-builders with inferior.

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
This commit is contained in:
Christopher Baines 2024-07-16 09:04:57 +01:00
parent d82ac48b07
commit f3e17f9ff1
No known key found for this signature in database
GPG key ID: 5E28A33B0B84F577

View file

@ -253,7 +253,8 @@ (define* (port->inferior pipe #:optional (close close-port))
result) result)
(inferior-eval '(begin (inferior-eval '(begin
(define %store-table (make-hash-table)) (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 ;; Cache connections to store ID. This ensures that
;; the caches within <store-connection> (in ;; the caches within <store-connection> (in
;; particular the object cache) are reused across ;; particular the object cache) are reused across
@ -268,9 +269,19 @@ (define (cached-store-connection store-id version)
;; risk of talking to the wrong daemon or having ;; risk of talking to the wrong daemon or having
;; our build result reclaimed (XXX). ;; our build result reclaimed (XXX).
(let ((store (if (defined? 'port->connection) (let ((store (if (defined? 'port->connection)
(port->connection %bridge-socket ;; #:built-in-builders was
#:version ;; added in 2024
version) (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)))) (open-connection))))
(hashv-set! %store-table store-id store) (hashv-set! %store-table store-id store)
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 ;; The address of STORE itself is not a good identifier because it
;; keeps changing through the use of "functional caches". The ;; keeps changing through the use of "functional caches". The
;; address of its socket port makes more sense. ;; 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) (ensure-store-bridge! inferior)
(send-inferior-request (send-inferior-request
`(let ((proc ,code) `(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 ;; Serialize '&store-protocol-error' conditions. The exception
;; serialization mechanism that 'read-repl-response' expects is ;; serialization mechanism that 'read-repl-response' expects is
;; unsuitable for SRFI-35 error conditions, hence this special case. ;; unsuitable for SRFI-35 error conditions, hence this special case.