mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
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?'.
This commit is contained in:
parent
155956449a
commit
1afe1985f5
2 changed files with 13 additions and 6 deletions
13
guix/nar.scm
13
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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue