Skip to content

Commit 877e8d4

Browse files
committed
Sort directories when generating tarballs
1 parent 18d9d44 commit 877e8d4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/tools/rust-installer/src/tarballer.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ impl Tarballer {
5353
// Sort files by their suffix, to group files with the same name from
5454
// different locations (likely identical) and files with the same
5555
// extension (likely containing similar data).
56-
let (dirs, mut files) = get_recursive_paths(&self.work_dir, &self.input)
56+
// Sorting of file and directory paths also helps with the reproducibility
57+
// of the resulting archive.
58+
let (mut dirs, mut files) = get_recursive_paths(&self.work_dir, &self.input)
5759
.context("failed to collect file paths")?;
60+
dirs.sort();
5861
files.sort_by(|a, b| a.bytes().rev().cmp(b.bytes().rev()));
5962

6063
// Write the tar into both encoded files. We write all directories

0 commit comments

Comments
 (0)