summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/packages/admin.scm11
-rw-r--r--guix/build/gnu-build-system.scm6
-rw-r--r--guix/build/utils.scm18
3 files changed, 19 insertions, 16 deletions
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 774194d87b..51b40c889e 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -201,16 +201,7 @@ client and server, a telnet client and server, and an rsh client and server.")
                       (delete-file (string-append bin "/groups"))
                       (for-each delete-file (find-files man "^groups\\."))
                       #t))
-                  (alist-cons-after
-                   'unpack 'reset-timestamps
-                   (lambda _
-                     ;; FIXME: Reset the file timestamps here, until the
-                     ;; 'unpack' phase does it for us.  See
-                     ;; <https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00098.html>.
-                     (for-each (lambda (file)
-                                 (utime file 0 0 0))
-                               (find-files "." "")))
-                   %standard-phases)))))
+                  %standard-phases))))
 
     (inputs (if (string-suffix? "-linux"
                                 (or (%current-target-system)
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index da6b31c326..8636931ed9 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -97,7 +97,11 @@ working directory."
       (begin
         (mkdir "source")
         (chdir "source")
-        (copy-recursively source ".")
+
+        ;; Preserve timestamps (set to the Epoch) on the copied tree so that
+        ;; things work deterministically.
+        (copy-recursively source "."
+                          #:keep-mtime? #t)
         #t)
       (and (zero? (system* "tar" "xvf" source))
            (chdir (first-subdirectory ".")))))
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 40af785b88..9779278167 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -134,9 +134,12 @@ return values of applying PROC to the port."
 (define* (copy-recursively source destination
                            #:key
                            (log (current-output-port))
-                           (follow-symlinks? #f))
+                           (follow-symlinks? #f)
+                           keep-mtime?)
   "Copy SOURCE directory to DESTINATION.  Follow symlinks if FOLLOW-SYMLINKS?
-is true; otherwise, just preserve them.  Write verbose output to the LOG port."
+is true; otherwise, just preserve them.  When KEEP-MTIME? is true, keep the
+modification time of the files in SOURCE on those of DESTINATION.  Write
+verbose output to the LOG port."
   (define strip-source
     (let ((len (string-length source)))
       (lambda (file)
@@ -152,10 +155,15 @@ is true; otherwise, just preserve them.  Write verbose output to the LOG port."
                            (let ((target (readlink file)))
                              (symlink target dest)))
                           (else
-                           (copy-file file dest)))))
+                           (copy-file file dest)
+                           (when keep-mtime?
+                             (set-file-time dest stat))))))
                     (lambda (dir stat result)     ; down
-                      (mkdir-p (string-append destination
-                                              (strip-source dir))))
+                      (let ((target (string-append destination
+                                                   (strip-source dir))))
+                        (mkdir-p target)
+                        (when keep-mtime?
+                          (set-file-time target stat))))
                     (lambda (dir stat result)     ; up
                       result)
                     (const #t)                    ; skip