summary refs log tree commit diff
path: root/guix/store
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-12-11 12:36:52 +0100
committerLudovic Courtès <ludo@gnu.org>2020-12-15 17:32:11 +0100
commit1574bd82bb36ee64574912c3e8855f94a73adc44 (patch)
tree180ad6f175671dc197fc73ccbaf49e1f2eb22650 /guix/store
parent0682cc593688e7d9a435ca69f05320aa87df06d0 (diff)
downloadguix-1574bd82bb36ee64574912c3e8855f94a73adc44.tar.gz
system: 'init' does not recompute the hash of each store item.
Fixes <https://bugs.gnu.org/44760>.

Previously, the 'register-path' call would re-traverse ITEM to compute
its nar hash, even though that hash is already known in the initial
store.  This patch also avoids repeated opening/closing of the
database.

* guix/store/database.scm (call-with-database): Export.
* guix/scripts/system.scm (copy-item): Add 'db' parameter.  Call
'sqlite-register' instead of 'register-path'.
(copy-closure): Remove redundant call to 'references*'.  Call
'call-with-database' and pass the database to 'copy-item'.
Diffstat (limited to 'guix/store')
-rw-r--r--guix/store/database.scm1
1 files changed, 1 insertions, 0 deletions
diff --git a/guix/store/database.scm b/guix/store/database.scm
index c0010b72b9..9d5bc531bb 100644
--- a/guix/store/database.scm
+++ b/guix/store/database.scm
@@ -39,6 +39,7 @@
   #:export (sql-schema
             %default-database-file
             store-database-file
+            call-with-database
             with-database
             path-id
             sqlite-register