mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Build manpage archive deterministically
Keep deterministic builds for Cargo! The changes here are: * Sort files being added to the archive to ensure they're added in the same order on all platforms. * Flag the archive builder as "deterministic mode" which means it won't pick up fields like mtime. Closes #8599
This commit is contained in:
parent
449743b1ac
commit
624acc8e2b
9
build.rs
9
build.rs
@ -14,10 +14,15 @@ fn compress_man() {
|
|||||||
.filename("man.tar")
|
.filename("man.tar")
|
||||||
.write(dst, Compression::best());
|
.write(dst, Compression::best());
|
||||||
let mut ar = tar::Builder::new(encoder);
|
let mut ar = tar::Builder::new(encoder);
|
||||||
|
ar.mode(tar::HeaderMode::Deterministic);
|
||||||
|
|
||||||
let mut add_files = |dir, extension| {
|
let mut add_files = |dir, extension| {
|
||||||
for entry in fs::read_dir(dir).unwrap() {
|
let mut files = fs::read_dir(dir)
|
||||||
let path = entry.unwrap().path();
|
.unwrap()
|
||||||
|
.map(|e| e.unwrap().path())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
files.sort();
|
||||||
|
for path in files {
|
||||||
if path.extension() != Some(extension) {
|
if path.extension() != Some(extension) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user