summaryrefslogtreecommitdiff
path: root/guix/store
diff options
context:
space:
mode:
Diffstat (limited to 'guix/store')
-rw-r--r--guix/store/database.scm6
-rw-r--r--guix/store/deduplication.scm12
2 files changed, 15 insertions, 3 deletions
diff --git a/guix/store/database.scm b/guix/store/database.scm
index 341276bc30..38796910da 100644
--- a/guix/store/database.scm
+++ b/guix/store/database.scm
@@ -36,7 +36,9 @@
#:use-module (ice-9 match)
#:use-module (system foreign)
#:export (sql-schema
+ %default-database-file
with-database
+ path-id
sqlite-register
register-path
register-items
@@ -85,6 +87,10 @@ create it and initialize it as a new database."
(lambda ()
(sqlite-close db)))))
+(define %default-database-file
+ ;; Default location of the store database.
+ (string-append %store-database-directory "/db.sqlite"))
+
(define-syntax-rule (with-database file db exp ...)
"Open DB from FILE and close it when the dynamic extent of EXP... is left.
If FILE doesn't exist, create it and initialize it as a new database."
diff --git a/guix/store/deduplication.scm b/guix/store/deduplication.scm
index 53810c680f..21b0c81f3d 100644
--- a/guix/store/deduplication.scm
+++ b/guix/store/deduplication.scm
@@ -102,11 +102,17 @@ LINK-PREFIX."
SWAP-DIRECTORY as the directory to store temporary hard links.
Note: TARGET, TO-REPLACE, and SWAP-DIRECTORY must be on the same file system."
- (let ((temp-link (get-temp-link target swap-directory)))
- (make-file-writable (dirname to-replace))
+ (let* ((temp-link (get-temp-link target swap-directory))
+ (parent (dirname to-replace))
+ (stat (stat parent)))
+ (make-file-writable parent)
(catch 'system-error
(lambda ()
- (rename-file temp-link to-replace))
+ (rename-file temp-link to-replace)
+
+ ;; Restore PARENT's mtime and permissions.
+ (set-file-time parent stat)
+ (chmod parent (stat:mode stat)))
(lambda args
(delete-file temp-link)
(unless (= EMLINK (system-error-errno args))