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.
This commit is contained in:
Alex Crichton 2016-04-11 17:09:55 -07:00
parent b622c3e085
commit 8efbfae6bf
5 changed files with 51 additions and 8 deletions

View File

@ -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)",
@ -59,6 +60,11 @@ name = "libc"
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"

View File

@ -31,3 +31,4 @@ winapi = "0.2"
kernel32-sys = "0.2"
gcc = "0.3.17"
libc = "0.2"
md5 = "0.1"

View File

@ -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);
}

View File

@ -20,6 +20,7 @@ extern crate libc;
extern crate num_cpus;
extern crate rustc_serialize;
extern crate toml;
extern crate md5;
use std::env;

40
src/rustc/Cargo.lock generated
View File

@ -73,7 +73,7 @@ dependencies = [
"rbml 0.0.0",
"rustc_back 0.0.0",
"rustc_bitflags 0.0.0",
"rustc_const_eval 0.0.0",
"rustc_const_math 0.0.0",
"rustc_data_structures 0.0.0",
"serialize 0.0.0",
"syntax 0.0.0",
@ -106,6 +106,19 @@ dependencies = [
[[package]]
name = "rustc_const_eval"
version = "0.0.0"
dependencies = [
"graphviz 0.0.0",
"log 0.0.0",
"rustc 0.0.0",
"rustc_back 0.0.0",
"rustc_const_math 0.0.0",
"serialize 0.0.0",
"syntax 0.0.0",
]
[[package]]
name = "rustc_const_math"
version = "0.0.0"
dependencies = [
"log 0.0.0",
"serialize 0.0.0",
@ -131,6 +144,8 @@ dependencies = [
"rustc 0.0.0",
"rustc_back 0.0.0",
"rustc_borrowck 0.0.0",
"rustc_const_eval 0.0.0",
"rustc_incremental 0.0.0",
"rustc_lint 0.0.0",
"rustc_llvm 0.0.0",
"rustc_metadata 0.0.0",
@ -147,6 +162,19 @@ dependencies = [
"syntax_ext 0.0.0",
]
[[package]]
name = "rustc_incremental"
version = "0.0.0"
dependencies = [
"graphviz 0.0.0",
"log 0.0.0",
"rbml 0.0.0",
"rustc 0.0.0",
"rustc_data_structures 0.0.0",
"serialize 0.0.0",
"syntax 0.0.0",
]
[[package]]
name = "rustc_lint"
version = "0.0.0"
@ -154,6 +182,7 @@ dependencies = [
"log 0.0.0",
"rustc 0.0.0",
"rustc_back 0.0.0",
"rustc_const_eval 0.0.0",
"syntax 0.0.0",
]
@ -176,7 +205,7 @@ dependencies = [
"rustc 0.0.0",
"rustc_back 0.0.0",
"rustc_bitflags 0.0.0",
"rustc_const_eval 0.0.0",
"rustc_const_math 0.0.0",
"rustc_llvm 0.0.0",
"serialize 0.0.0",
"syntax 0.0.0",
@ -191,6 +220,7 @@ dependencies = [
"rustc 0.0.0",
"rustc_back 0.0.0",
"rustc_const_eval 0.0.0",
"rustc_const_math 0.0.0",
"rustc_data_structures 0.0.0",
"syntax 0.0.0",
]
@ -201,6 +231,7 @@ version = "0.0.0"
dependencies = [
"log 0.0.0",
"rustc 0.0.0",
"rustc_const_eval 0.0.0",
"syntax 0.0.0",
]
@ -247,7 +278,6 @@ version = "0.0.0"
dependencies = [
"log 0.0.0",
"rustc 0.0.0",
"rustc_front 0.0.0",
"syntax 0.0.0",
]
@ -262,7 +292,9 @@ dependencies = [
"rustc 0.0.0",
"rustc_back 0.0.0",
"rustc_const_eval 0.0.0",
"rustc_const_math 0.0.0",
"rustc_data_structures 0.0.0",
"rustc_incremental 0.0.0",
"rustc_llvm 0.0.0",
"rustc_mir 0.0.0",
"rustc_platform_intrinsics 0.0.0",
@ -280,6 +312,7 @@ dependencies = [
"rustc 0.0.0",
"rustc_back 0.0.0",
"rustc_const_eval 0.0.0",
"rustc_const_math 0.0.0",
"rustc_platform_intrinsics 0.0.0",
"syntax 0.0.0",
]
@ -294,6 +327,7 @@ dependencies = [
"log 0.0.0",
"rustc 0.0.0",
"rustc_back 0.0.0",
"rustc_const_eval 0.0.0",
"rustc_driver 0.0.0",
"rustc_lint 0.0.0",
"rustc_metadata 0.0.0",