nar: 'with-temporary-store-file' uses a single connection

Previously the 'with-store' form was entered every time a different temporary
file was tried.  This caused there to be as many simultaneous open connections
as there were attempts, and prevented the (loop ...) call from being a tail
call.  This change fixes that.

* guix/nar.scm (with-temporary-store-file): open connection once prior to
  entering the loop.
This commit is contained in:
Caleb Ristvedt 2020-05-06 11:52:16 -05:00
parent 37edbc91e3
commit b338c41c82
No known key found for this signature in database
GPG Key ID: C166AA495F7F189C
1 changed files with 2 additions and 2 deletions

View File

@ -138,8 +138,8 @@ held."
(define-syntax-rule (with-temporary-store-file name body ...)
"Evaluate BODY with NAME bound to the file name of a temporary store item
protected from GC."
(let loop ((name (temporary-store-file)))
(with-store store
(with-store store
(let loop ((name (temporary-store-file)))
;; Add NAME to the current process' roots. (Opening this connection to
;; the daemon allows us to reuse its code that deals with the
;; per-process roots file.)