diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-06-24 17:48:02 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-06-24 18:05:03 +0200 |
commit | 583323ca1d1af5462f1b45f4be50f96bc8f1e46b (patch) | |
tree | 2cbe53a763ccb5ca1dbbee8e13ad41c055e9c0cc /gnu/build | |
parent | e8277f90c88be9d65b948c299620fd9d6d9b28ae (diff) |
linux-initrd: Populate cpio archives in a deterministic order.
* gnu/build/linux-initrd.scm (write-cpio-archive)[files]: Use 'sort' instead
of 'reverse'.
Diffstat (limited to 'gnu/build')
-rw-r--r-- | gnu/build/linux-initrd.scm | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/gnu/build/linux-initrd.scm b/gnu/build/linux-initrd.scm index 2c148836f3..815c7a0aeb 100644 --- a/gnu/build/linux-initrd.scm +++ b/gnu/build/linux-initrd.scm @@ -49,21 +49,22 @@ COMPRESS? is true, compress it using GZIP. On success, return OUTPUT." ;; directories." (define files - ;; XXX: Use a deterministic order. - (reverse - (file-system-fold (const #t) ;enter? - (lambda (file stat result) ;leaf - (cons file result)) - (lambda (dir stat result) ;down - (if (string=? dir directory) - result - (cons dir result))) - (lambda (file stat result) - result) - (const #f) ;skip - (const #f) ;error - '() - directory))) + ;; Use 'sort' so that (1) the order of files is deterministic, and (2) + ;; directories appear before the files they contain. + (sort (file-system-fold (const #t) ;enter? + (lambda (file stat result) ;leaf + (cons file result)) + (lambda (dir stat result) ;down + (if (string=? dir directory) + result + (cons dir result))) + (lambda (file stat result) + result) + (const #f) ;skip + (const #f) ;error + '() + directory) + string<?)) (call-with-output-file output (lambda (port) |