aboutsummaryrefslogtreecommitdiff
path: root/guix/nar.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-11-13 09:46:40 +0100
committerLudovic Courtès <ludo@gnu.org>2018-11-13 14:59:45 +0100
commit1afe1985f5bffef76872f4c9e87115b46a4a3d47 (patch)
tree79bd452895b477a5ec3ec3b5aa12c763cf7160cf /guix/nar.scm
parent155956449af6d42cdf739b0922b34bdaae639aa7 (diff)
downloadgnu-guix-1afe1985f5bffef76872f4c9e87115b46a4a3d47.tar
gnu-guix-1afe1985f5bffef76872f4c9e87115b46a4a3d47.tar.gz
nar: Access the database instead of connecting to the daemon.
* guix/store/database.scm (%default-database-file): New variable. (path-id): Export. * guix/nar.scm (finalize-store-file): Use 'with-database' instead of 'with-store', and use 'path-id' instead of 'valid-path?'.
Diffstat (limited to 'guix/nar.scm')
-rw-r--r--guix/nar.scm13
1 files changed, 7 insertions, 6 deletions
diff --git a/guix/nar.scm b/guix/nar.scm
index 0495b4a40c..8894f10d2b 100644
--- a/guix/nar.scm
+++ b/guix/nar.scm
@@ -22,8 +22,12 @@
#:use-module (guix build syscalls)
#:use-module ((guix build utils)
#:select (delete-file-recursively with-directory-excursion))
+
+ ;; XXX: Eventually we should use (guix store database) exclusively, and not
+ ;; (guix store) since this is "daemon-side" code.
#:use-module (guix store)
#:use-module (guix store database)
+
#:use-module (guix ui) ; for '_'
#:use-module (gcrypt hash)
#:use-module (guix pki)
@@ -88,15 +92,12 @@
REFERENCES and DERIVER. When LOCK? is true, acquire exclusive locks on TARGET
before attempting to register it; otherwise, assume TARGET's locks are already
held."
-
- ;; XXX: Currently we have to call out to the daemon to check whether TARGET
- ;; is valid.
- (with-store store
- (unless (valid-path? store target)
+ (with-database %default-database-file db
+ (unless (path-id db target)
(when lock?
(lock-store-file target))
- (unless (valid-path? store target)
+ (unless (path-id db target)
;; If FILE already exists, delete it (it's invalid anyway.)
(when (file-exists? target)
(delete-file-recursively target))