1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-05-26 19:11:46 +02:00

store-copy: 'populate-store' resets timestamps.

Until now, 'populate-store' would reset permissions but not timestamps,
so callers would resort to going through an extra directory traversal to
reset timestamps.

* guix/build/store-copy.scm (reset-permissions): Remove.
(copy-recursively): New procedure.
(populate-store): Pass #:keep-permissions? to 'copy-recursively'.
Remove call to 'reset-permissions'.
* tests/gexp.scm ("gexp->derivation, store copy"): In BUILD-DRV, check
whether 'populate-store' canonicalizes permissions and timestamps.
* gnu/build/image.scm (initialize-root-partition): Pass #:reset-timestamps? #f
to 'register-closure'.
* gnu/build/vm.scm (root-partition-initializer): Likewise.
This commit is contained in:
Ludovic Courtès
2020-12-10 13:37:59 +01:00
parent 2718c29c3f
commit 7b8d239ec2
4 changed files with 95 additions and 34 deletions
+17 -2
View File
@@ -723,10 +723,25 @@
(lambda (port)
(display "This is the second one." port))))))
(build-drv #~(begin
(use-modules (guix build store-copy))
(use-modules (guix build store-copy)
(guix build utils)
(srfi srfi-1))
(define (canonical-file? file)
;; Copied from (guix tests).
(let ((st (lstat file)))
(or (not (string-prefix? (%store-directory) file))
(eq? 'symlink (stat:type st))
(and (= 1 (stat:mtime st))
(zero? (logand #o222 (stat:mode st)))))))
(mkdir #$output)
(populate-store '("graph") #$output))))
(populate-store '("graph") #$output)
;; Check whether 'populate-store' canonicalizes
;; permissions and timestamps.
(unless (every canonical-file? (find-files #$output))
(error "not canonical!" #$output)))))
(mlet* %store-monad ((one (gexp->derivation "one" build-one))
(two (gexp->derivation "two" (build-two one)))
(drv (gexp->derivation "store-copy" build-drv