database: Remove #:deduplicate? from 'register-items'.

It is now up to the caller to deduplicate store contents.

* guix/store/database.scm (register-items): Remove #:deduplicate?
parameter and call to 'deduplicate'.
(register-path): Call 'deduplicate' when #:deduplicate? is true.
* gnu/build/image.scm (register-closure): Adjust call accordingly.
* gnu/build/vm.scm (register-closure): Likewise.
* guix/nar.scm (finalize-store-file): Likewise.
* guix/scripts/pack.scm (store-database): Likewise.
This commit is contained in:
Ludovic Courtès 2020-12-10 21:42:02 +01:00
parent 2aa512ec28
commit 0793833c59
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
5 changed files with 7 additions and 10 deletions

View file

@ -151,7 +151,6 @@ (define* (register-closure prefix closure
#:wal-mode? wal-mode?
(register-items db items
#:prefix prefix
#:deduplicate? #f
#:registration-time %epoch)))))
(define* (initialize-efi-partition root

View file

@ -224,7 +224,6 @@ (define* (register-closure prefix closure
(with-database (store-database-file #:prefix prefix) db
(register-items db items
#:prefix prefix
#:deduplicate? #f
#:registration-time %epoch)))))

View file

@ -118,8 +118,7 @@ (define (acquire-lock file)
;; Register TARGET. The 'restore-file' call took care of
;; deduplication, timestamps, and permissions.
(register-items db
(list (store-info target deriver references))
#:deduplicate? #f))
(list (store-info target deriver references))))
(when lock?
(delete-file (string-append target ".lock"))

View file

@ -167,7 +167,6 @@ (define db-file
(let ((items (append-map read-closure '#$labels)))
(with-database db-file db
(register-items db items
#:deduplicate? #f
#:registration-time %epoch)))))))
(computed-file "store-database" build

View file

@ -407,6 +407,11 @@ (define db-file
(define real-file-name
(string-append (or prefix "") path))
(when deduplicate?
(deduplicate real-file-name (nar-sha256 real-file-name)
#:store (string-append (or prefix "")
%store-directory)))
(when reset-timestamps?
(reset-timestamps real-file-name))
@ -414,7 +419,6 @@ (define real-file-name
(with-database db-file db
(register-items db (list (store-info path deriver references))
#:prefix prefix
#:deduplicate? deduplicate?
#:log-port (%make-void-port "w")))))
(define %epoch
@ -423,7 +427,6 @@ (define %epoch
(define* (register-items db items
#:key prefix
(deduplicate? #t)
registration-time
(log-port (current-error-port)))
"Register all of ITEMS, a list of <store-info> records as returned by
@ -467,9 +470,7 @@ (define real-file-name
"sha256:"
(bytevector->base16-string hash))
#:nar-size nar-size
#:time registration-time)))
(when deduplicate?
(deduplicate real-file-name hash #:store store-dir)))))
#:time registration-time))))))
(let* ((prefix (format #f "registering ~a items" (length items)))
(progress (progress-reporter/bar (length items)