aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-09-23 23:11:30 +0200
committerLudovic Courtès <ludo@gnu.org>2018-09-23 23:34:17 +0200
commitbb3b6ccb05550fbfbeb459c68819a752327d6e1e (patch)
tree2acbcd4a94e3f1e590eaafde965776b73a53d66d /guix
parentf0addd6461658d13eadf5f6e3bdb89aa02a6e902 (diff)
downloadgnu-guix-bb3b6ccb05550fbfbeb459c68819a752327d6e1e.tar
gnu-guix-bb3b6ccb05550fbfbeb459c68819a752327d6e1e.tar.gz
database: Register each store item only once.
Fixes <https://bugs.gnu.org/32600>. Reported by Leo Famulari. * guix/store/database.scm (register-items): Check whether TO-REGISTER is in DB by calling 'path-id', and skip the reset-timestamps, registration, and deduplication phases when it is.
Diffstat (limited to 'guix')
-rw-r--r--guix/store/database.scm24
1 files changed, 14 insertions, 10 deletions
diff --git a/guix/store/database.scm b/guix/store/database.scm
index 5d094faaf3..341276bc30 100644
--- a/guix/store/database.scm
+++ b/guix/store/database.scm
@@ -290,18 +290,22 @@ Write a progress report to LOG-PORT."
(define real-file-name
(string-append store-dir "/" (basename (store-info-item item))))
- (let-values (((hash nar-size) (nar-sha256 real-file-name)))
+ ;; When TO-REGISTER is already registered, skip it. This makes a
+ ;; significant differences when 'register-closures' is called
+ ;; consecutively for overlapping closures such as 'system' and 'bootcfg'.
+ (unless (path-id db to-register)
(when reset-timestamps?
(reset-timestamps real-file-name))
- (sqlite-register db #:path to-register
- #:references (store-info-references item)
- #:deriver (store-info-deriver item)
- #:hash (string-append "sha256:"
- (bytevector->base16-string hash))
- #:nar-size nar-size
- #:time registration-time)
- (when deduplicate?
- (deduplicate real-file-name hash #:store store-dir))))
+ (let-values (((hash nar-size) (nar-sha256 real-file-name)))
+ (sqlite-register db #:path to-register
+ #:references (store-info-references item)
+ #:deriver (store-info-deriver item)
+ #:hash (string-append "sha256:"
+ (bytevector->base16-string hash))
+ #:nar-size nar-size
+ #:time registration-time)
+ (when deduplicate?
+ (deduplicate real-file-name hash #:store store-dir)))))
(mkdir-p db-dir)
(parameterize ((sql-schema schema))