Skip to content

Commit

Permalink
Only include git-commit-hash in tarballs when available
Browse files Browse the repository at this point in the history
… instead of writing an empty file.
  • Loading branch information
SimonSapin committed Sep 4, 2017
1 parent 9abc549 commit 9412fd7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/bootstrap/dist.rs
Expand Up @@ -364,9 +364,10 @@ impl Step for Rustc {
cp("README.md");
// tiny morsel of metadata is used by rust-packaging
let version = build.rust_version();
let sha = build.rust_sha().unwrap_or("");
t!(t!(File::create(overlay.join("version"))).write_all(version.as_bytes()));
t!(t!(File::create(overlay.join("git-commit-hash"))).write_all(sha.as_bytes()));
if let Some(sha) = build.rust_sha() {
t!(t!(File::create(overlay.join("git-commit-hash"))).write_all(sha.as_bytes()));
}

// On MinGW we've got a few runtime DLL dependencies that we need to
// include. The first argument to this script is where to put these DLLs
Expand Down Expand Up @@ -846,8 +847,9 @@ impl Step for PlainSourceTarball {

// Create the version file
write_file(&plain_dst_src.join("version"), build.rust_version().as_bytes());
let sha = build.rust_sha().unwrap_or("");
write_file(&plain_dst_src.join("git-commit-hash"), sha.as_bytes());
if let Some(sha) = build.rust_sha() {
write_file(&plain_dst_src.join("git-commit-hash"), sha.as_bytes());
}

// If we're building from git sources, we need to vendor a complete distribution.
if build.rust_info.is_git() {
Expand Down Expand Up @@ -1160,9 +1162,10 @@ impl Step for Extended {
install(&build.src.join("LICENSE-APACHE"), &overlay, 0o644);
install(&build.src.join("LICENSE-MIT"), &overlay, 0o644);
let version = build.rust_version();
let sha = build.rust_sha().unwrap_or("");
t!(t!(File::create(overlay.join("version"))).write_all(version.as_bytes()));
t!(t!(File::create(overlay.join("git-commit-hash"))).write_all(sha.as_bytes()));
if let Some(sha) = build.rust_sha() {
t!(t!(File::create(overlay.join("git-commit-hash"))).write_all(sha.as_bytes()));
}
install(&etc.join("README.md"), &overlay, 0o644);

// When rust-std package split from rustc, we needed to ensure that during
Expand Down

0 comments on commit 9412fd7

Please sign in to comment.