about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-09-15 20:48:58 -0700
committerGitHub <noreply@github.com>2016-09-15 20:48:58 -0700
commita36e069288141a8bb2d090f65e8c5cd415fb37e9 (patch)
tree01bcd6bc47b53e7e2e3b2b32c90a974bdec1beed /src/bootstrap
parent5511a93c8af5a2ee4ed1e4c55b19635b00938cdb (diff)
parent72da8b82c14772980956a808e93ed6258c5691ba (diff)
downloadrust-a36e069288141a8bb2d090f65e8c5cd415fb37e9.tar.gz
rust-a36e069288141a8bb2d090f65e8c5cd415fb37e9.zip
Auto merge of #36213 - josephDunne:dist_version, r=brson
Add rustc version info (git hash + date) to dist tarball

a fix for #32444
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/dist.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index 9d18901eb00..31b7db168b4 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -388,6 +388,9 @@ pub fn rust_src(build: &Build) {
     // Rename directory, so that root folder of tarball has the correct name
     t!(fs::rename(&dst_src, &plain_dst_src));
 
+    // Create the version file
+    write_file(&plain_dst_src.join("version"), build.version.as_bytes());
+
     // Create plain source tarball
     let mut cmd = Command::new("tar");
     cmd.arg("-czf").arg(sanitize_sh(&distdir(build).join(&format!("{}.tar.gz", plain_name))))
@@ -431,3 +434,8 @@ fn sanitize_sh(path: &Path) -> String {
         Some(format!("/{}/{}", drive, &s[drive.len_utf8() + 2..]))
     }
 }
+
+fn write_file(path: &Path, data: &[u8]) {
+    let mut vf = t!(fs::File::create(path));
+    t!(vf.write_all(data));
+}