store: 'run-with-store' gracefully deals with #f store.

This is a followup to dd0ee954c4, which
introduced a failure in tests/graph.scm.

* guix/store.scm (run-with-store): Check whether STORE and NEW-STORE are
true before calling 'store-connection-object-cache' etc.  Fixes a
failure in tests/graph.scm related to %REVERSE-PACKAGE-NODE-TYPE, which
uses #f as the store.
This commit is contained in:
Ludovic Courtès 2019-07-05 00:48:20 +02:00
parent d74392a85c
commit 728a4ab101
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 6 additions and 5 deletions

View File

@ -1802,11 +1802,12 @@ connection, and return the result."
(call-with-values (lambda () (call-with-values (lambda ()
(run-with-state mval store)) (run-with-state mval store))
(lambda (result new-store) (lambda (result new-store)
;; Copy the object cache from NEW-STORE so we don't fully discard the (when (and store new-store)
;; state. ;; Copy the object cache from NEW-STORE so we don't fully discard
(let ((cache (store-connection-object-cache new-store))) ;; the state.
(set-store-connection-object-cache! store cache) (let ((cache (store-connection-object-cache new-store)))
result))))) (set-store-connection-object-cache! store cache)))
result))))
;;; ;;;