[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/16: guix system: 'init' copies, resets timestamps, and deduplicates a
From: |
guix-commits |
Subject: |
11/16: guix system: 'init' copies, resets timestamps, and deduplicates at once. |
Date: |
Tue, 15 Dec 2020 11:33:01 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit cd6c5ddfc8a1a0a6f4085c8201fca20fd819bdfd
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Dec 11 10:37:06 2020 +0100
guix system: 'init' copies, resets timestamps, and deduplicates at once.
Partly fixes <https://bugs.gnu.org/44760>.
* guix/build/store-copy.scm (copy-store-item): New procedure.
(populate-store): Use it instead of the inline 'copy-recursively' call.
* guix/scripts/system.scm (copy-item): Likewise.
Pass #:reset-timestamps? and #:deduplicate? to 'register-path'.
---
guix/build/store-copy.scm | 31 +++++++++++++++++++++----------
guix/scripts/system.scm | 11 ++++++++---
2 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/guix/build/store-copy.scm b/guix/build/store-copy.scm
index 7f0672c..01e1f41 100644
--- a/guix/build/store-copy.scm
+++ b/guix/build/store-copy.scm
@@ -38,6 +38,7 @@
file-size
closure-size
+ copy-store-item
populate-store))
;;; Commentary:
@@ -242,6 +243,24 @@ permissions. Write verbose output to the LOG port."
stat
lstat)))
+(define* (copy-store-item item target
+ #:key
+ (deduplicate? #t)
+ (log-port (%make-void-port "w")))
+ "Copy ITEM, a store item, to the store under TARGET, the target root
+directory. When DEDUPLICATE? is true, deduplicate it within TARGET."
+ (define store
+ (string-append target (%store-directory)))
+
+ (copy-recursively item (string-append target item)
+ #:keep-mtime? #t
+ #:keep-permissions? #t
+ #:copy-file
+ (if deduplicate?
+ (cut copy-file/deduplicate <> <> #:store store)
+ copy-file)
+ #:log log-port))
+
(define* (populate-store reference-graphs target
#:key
(deduplicate? #t)
@@ -273,16 +292,8 @@ regular files as they are copied to TARGET."
(call-with-progress-reporter progress
(lambda (report)
(for-each (lambda (thing)
- (copy-recursively thing
- (string-append target thing)
- #:keep-mtime? #t
- #:keep-permissions? #t
- #:copy-file
- (if deduplicate?
- (cut copy-file/deduplicate <> <>
- #:store store)
- copy-file)
- #:log (%make-void-port "w"))
+ (copy-store-item thing target
+ #:deduplicate? deduplicate?)
(report))
things)))))
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index db80e0b..c089290 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -30,6 +30,7 @@
#:use-module ((guix status) #:select (with-status-verbosity))
#:use-module (guix store)
#:autoload (guix store database) (register-path)
+ #:autoload (guix build store-copy) (copy-store-item)
#:use-module (guix describe)
#:use-module (guix grafts)
#:use-module (guix gexp)
@@ -147,8 +148,8 @@ REFERENCES as its set of references."
#:directories? #t))
(delete-file-recursively dest))
- (copy-recursively item dest
- #:log (%make-void-port "w"))
+ (copy-store-item item target
+ #:deduplicate? #t)
;; Register ITEM; as a side-effect, it resets timestamps, etc.
;; Explicitly use "TARGET/var/guix" as the state directory, to avoid
@@ -157,7 +158,11 @@ REFERENCES as its set of references."
(unless (register-path item
#:prefix target
#:state-directory state
- #:references references)
+ #:references references
+
+ ;; Those are taken care of by 'copy-store-item'.
+ #:reset-timestamps? #f
+ #:deduplicate? #f)
(leave (G_ "failed to register '~a' under '~a'~%")
item target))))
- 06/16: image: 'register-closure' assumes already-reset timestamps., (continued)
- 06/16: image: 'register-closure' assumes already-reset timestamps., guix-commits, 2020/12/15
- 12/16: database: Remove #:deduplicate? and #:reset-timestamps? from 'register-path'., guix-commits, 2020/12/15
- 08/16: store-copy: 'populate-store' can optionally deduplicate files., guix-commits, 2020/12/15
- 04/16: nar: Deduplicate files right as they are restored., guix-commits, 2020/12/15
- 16/16: deduplicate: Create the '.links' directory lazily., guix-commits, 2020/12/15
- 05/16: store-copy: 'populate-store' resets timestamps., guix-commits, 2020/12/15
- 09/16: image: 'register-closure' leaves it up to the caller to deduplicate., guix-commits, 2020/12/15
- 15/16: database: Honor 'SOURCE_DATE_EPOCH'., guix-commits, 2020/12/15
- 13/16: system: 'init' does not recompute the hash of each store item., guix-commits, 2020/12/15
- 14/16: database: Remove 'register-path'., guix-commits, 2020/12/15
- 11/16: guix system: 'init' copies, resets timestamps, and deduplicates at once.,
guix-commits <=