linux-initrd: Populate cpio archives in a deterministic order.

* gnu/build/linux-initrd.scm (write-cpio-archive)[files]: Use 'sort' instead
  of 'reverse'.
This commit is contained in:
Ludovic Courtès 2015-06-24 17:48:02 +02:00
parent e8277f90c8
commit 583323ca1d
1 changed files with 16 additions and 15 deletions

View File

@ -49,21 +49,22 @@ COMPRESS? is true, compress it using GZIP. On success, return OUTPUT."
;; directories." ;; directories."
(define files (define files
;; XXX: Use a deterministic order. ;; Use 'sort' so that (1) the order of files is deterministic, and (2)
(reverse ;; directories appear before the files they contain.
(file-system-fold (const #t) ;enter? (sort (file-system-fold (const #t) ;enter?
(lambda (file stat result) ;leaf (lambda (file stat result) ;leaf
(cons file result)) (cons file result))
(lambda (dir stat result) ;down (lambda (dir stat result) ;down
(if (string=? dir directory) (if (string=? dir directory)
result result
(cons dir result))) (cons dir result)))
(lambda (file stat result) (lambda (file stat result)
result) result)
(const #f) ;skip (const #f) ;skip
(const #f) ;error (const #f) ;error
'() '()
directory))) directory)
string<?))
(call-with-output-file output (call-with-output-file output
(lambda (port) (lambda (port)