mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
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'.
This commit is contained in:
parent
583323ca1d
commit
eae5b3fff5
2 changed files with 15 additions and 1 deletions
|
@ -68,7 +68,8 @@ (define files
|
|||
|
||||
(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))
|
||||
|
|
|
@ -26,6 +26,7 @@ (define-module (guix cpio)
|
|||
#:export (cpio-header?
|
||||
make-cpio-header
|
||||
file->cpio-header
|
||||
file->cpio-header*
|
||||
write-cpio-header
|
||||
read-cpio-header
|
||||
|
||||
|
@ -174,6 +175,18 @@ (define* (file->cpio-header file #:optional (file-name file)
|
|||
#: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!!!")
|
||||
|
||||
|
|
Loading…
Reference in a new issue