about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2024-03-30 22:03:11 +0100
committerJakub Beránek <berykubik@gmail.com>2024-03-31 12:56:05 +0200
commit877e8d456db497c2b7b895cb88243fb894584701 (patch)
tree1e4e9e2c162f65d5fc629b0c5ba5fd0722d90107
parent18d9d44bd6f431db4e50f5636b08458a8a1a63c4 (diff)
downloadrust-877e8d456db497c2b7b895cb88243fb894584701.tar.gz
rust-877e8d456db497c2b7b895cb88243fb894584701.zip
Sort directories when generating tarballs
-rw-r--r--src/tools/rust-installer/src/tarballer.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tools/rust-installer/src/tarballer.rs b/src/tools/rust-installer/src/tarballer.rs
index 24d341db78e..2f093e7ad17 100644
--- a/src/tools/rust-installer/src/tarballer.rs
+++ b/src/tools/rust-installer/src/tarballer.rs
@@ -53,8 +53,11 @@ impl Tarballer {
         // Sort files by their suffix, to group files with the same name from
         // different locations (likely identical) and files with the same
         // extension (likely containing similar data).
-        let (dirs, mut files) = get_recursive_paths(&self.work_dir, &self.input)
+        // Sorting of file and directory paths also helps with the reproducibility
+        // of the resulting archive.
+        let (mut dirs, mut files) = get_recursive_paths(&self.work_dir, &self.input)
             .context("failed to collect file paths")?;
+        dirs.sort();
         files.sort_by(|a, b| a.bytes().rev().cmp(b.bytes().rev()));
 
         // Write the tar into both encoded files. We write all directories