guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

06/06: linux-initrd: Produce cpio archives with zeroed timestamps, etc.


From: Ludovic Courtès
Subject: 06/06: linux-initrd: Produce cpio archives with zeroed timestamps, etc.
Date: Wed, 24 Jun 2015 16:06:06 +0000

civodul pushed a commit to branch master
in repository guix.

commit eae5b3fff54e6f0a38d03d01187142accbed1eb8
Author: Ludovic Courtès <address@hidden>
Date:   Wed Jun 24 18:02:15 2015 +0200

    linux-initrd: Produce cpio archives with zeroed timestamps, etc.
    
    * guix/cpio.scm (file->cpio-header*): New procedure.
    * gnu/build/linux-initrd.scm (write-cpio-archive): Add #:file->header 
argument
      to 'cpio:write-cpio-archive'.
---
 gnu/build/linux-initrd.scm |    3 ++-
 guix/cpio.scm              |   13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/gnu/build/linux-initrd.scm b/gnu/build/linux-initrd.scm
index 815c7a0..e26c067 100644
--- a/gnu/build/linux-initrd.scm
+++ b/gnu/build/linux-initrd.scm
@@ -68,7 +68,8 @@ COMPRESS? is true, compress it using GZIP.  On success, 
return OUTPUT."
 
   (call-with-output-file output
     (lambda (port)
-      (cpio:write-cpio-archive files port)))
+      (cpio:write-cpio-archive files port
+                               #:file->header cpio:file->cpio-header*)))
 
   (or (not compress?)
       (and (zero? (system* gzip "--best" output))
diff --git a/guix/cpio.scm b/guix/cpio.scm
index f1c2130..e4692e2 100644
--- a/guix/cpio.scm
+++ b/guix/cpio.scm
@@ -26,6 +26,7 @@
   #:export (cpio-header?
             make-cpio-header
             file->cpio-header
+            file->cpio-header*
             write-cpio-header
             read-cpio-header
 
@@ -174,6 +175,18 @@ using FILE-NAME as its file name."
                       #:rdev (stat:rdev st)
                       #:name-size (string-length file-name))))
 
+(define* (file->cpio-header* file
+                             #:optional (file-name file)
+                             #:key (stat lstat))
+  "Similar to 'file->cpio-header', but return a header with a zeroed
+modification time, inode number, UID/GID, etc.  This allows archives to be
+produced in a deterministic fashion."
+  (let ((st (stat file)))
+    (make-cpio-header #:mode (stat:mode st)
+                      #:nlink (stat:nlink st)
+                      #:size (stat:size st)
+                      #:name-size (string-length file-name))))
+
 (define %trailer
   "TRAILER!!!")
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]