about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-04-11 17:09:55 -0700
committerAlex Crichton <alex@alexcrichton.com>2016-04-11 17:16:32 -0700
commit8efbfae6bf3ec3995dca0604d09c839967840b7a (patch)
treeefe95e7880f36805d298b8355252f8dfd8c75a55 /src/bootstrap
parentb622c3e0856767d8e53cf141e2e0a7b6d72a198b (diff)
downloadrust-8efbfae6bf3ec3995dca0604d09c839967840b7a.tar.gz
rust-8efbfae6bf3ec3995dca0604d09c839967840b7a.zip
rustbuild: Fix handling of the bootstrap key
Bring the calculation logic in line with the makefiles and also set the
RUSTC_BOOTSTRAP_KEY environment variable to enable the bootstrap on the stable
compiler.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/Cargo.lock6
-rw-r--r--src/bootstrap/Cargo.toml1
-rw-r--r--src/bootstrap/build/channel.rs11
-rw-r--r--src/bootstrap/main.rs1
4 files changed, 14 insertions, 5 deletions
diff --git a/src/bootstrap/Cargo.lock b/src/bootstrap/Cargo.lock
index c33838a146c..722feab212e 100644
--- a/src/bootstrap/Cargo.lock
+++ b/src/bootstrap/Cargo.lock
@@ -9,6 +9,7 @@ dependencies = [
  "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "md5 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "num_cpus 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
  "toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -60,6 +61,11 @@ version = "0.2.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
+name = "md5"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
 name = "num_cpus"
 version = "0.2.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml
index 0d334219b4f..88dd19a7697 100644
--- a/src/bootstrap/Cargo.toml
+++ b/src/bootstrap/Cargo.toml
@@ -31,3 +31,4 @@ winapi = "0.2"
 kernel32-sys = "0.2"
 gcc = "0.3.17"
 libc = "0.2"
+md5 = "0.1"
diff --git a/src/bootstrap/build/channel.rs b/src/bootstrap/build/channel.rs
index 5c39356d214..611e3475610 100644
--- a/src/bootstrap/build/channel.rs
+++ b/src/bootstrap/build/channel.rs
@@ -8,15 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::env;
 use std::fs::{self, File};
 use std::io::prelude::*;
-use std::path::Path;
 use std::process::Command;
 
 use build_helper::output;
+use md5;
 
 use build::Build;
-use build::util::mtime;
 
 pub fn collect(build: &mut Build) {
     let mut main_mk = String::new();
@@ -80,7 +80,8 @@ pub fn collect(build: &mut Build) {
         build.short_ver_hash = Some(short_ver_hash);
     }
 
-    build.bootstrap_key = mtime(Path::new("config.toml")).seconds()
-                                                        .to_string();
+    let key = md5::compute(build.release.as_bytes());
+    build.bootstrap_key = format!("{:02x}{:02x}{:02x}{:02x}",
+                                  key[0], key[1], key[2], key[3]);
+    env::set_var("RUSTC_BOOTSTRAP_KEY", &build.bootstrap_key);
 }
-
diff --git a/src/bootstrap/main.rs b/src/bootstrap/main.rs
index 32432132c17..bf29ac107ff 100644
--- a/src/bootstrap/main.rs
+++ b/src/bootstrap/main.rs
@@ -20,6 +20,7 @@ extern crate libc;
 extern crate num_cpus;
 extern crate rustc_serialize;
 extern crate toml;
+extern crate md5;
 
 use std::env;