Skip to content

Commit e1999f9

Browse files
committed
Add support for mtime override to generate and combine rust-installer commands
1 parent c54a2a5 commit e1999f9

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ actor! {
5555
/// The formats used to compress the tarball
5656
#[arg(value_name = "FORMAT", default_value_t)]
5757
compression_formats: CompressionFormats,
58+
59+
/// Modification time that will be set for all files added to the archive.
60+
/// The default is the date of the first Rust commit from 2006.
61+
/// This serves for better reproducibility of the archives.
62+
#[arg(value_name = "FILE_MTIME", default_value_t = 1153704088)]
63+
override_file_mtime: u64,
5864
}
5965
}
6066

@@ -145,7 +151,8 @@ impl Combiner {
145151
.input(self.package_name)
146152
.output(path_to_str(&output)?.into())
147153
.compression_profile(self.compression_profile)
148-
.compression_formats(self.compression_formats);
154+
.compression_formats(self.compression_formats)
155+
.override_file_mtime(self.override_file_mtime);
149156
tarballer.run()?;
150157

151158
Ok(())

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ actor! {
6161
/// The formats used to compress the tarball
6262
#[arg(value_name = "FORMAT", default_value_t)]
6363
compression_formats: CompressionFormats,
64+
65+
/// Modification time that will be set for all files added to the archive.
66+
/// The default is the date of the first Rust commit from 2006.
67+
/// This serves for better reproducibility of the archives.
68+
#[arg(value_name = "FILE_MTIME", default_value_t = 1153704088)]
69+
override_file_mtime: u64,
6470
}
6571
}
6672

@@ -114,7 +120,8 @@ impl Generator {
114120
.input(self.package_name)
115121
.output(path_to_str(&output)?.into())
116122
.compression_profile(self.compression_profile)
117-
.compression_formats(self.compression_formats);
123+
.compression_formats(self.compression_formats)
124+
.override_file_mtime(self.override_file_mtime);
118125
tarballer.run()?;
119126

120127
Ok(())

0 commit comments

Comments
 (0)