From 8efbfae6bf3ec3995dca0604d09c839967840b7a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 11 Apr 2016 17:09:55 -0700 Subject: [PATCH] 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. --- src/bootstrap/Cargo.lock | 6 +++++ src/bootstrap/Cargo.toml | 1 + src/bootstrap/build/channel.rs | 11 +++++----- src/bootstrap/main.rs | 1 + src/rustc/Cargo.lock | 40 +++++++++++++++++++++++++++++++--- 5 files changed, 51 insertions(+), 8 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)", @@ -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" 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; diff --git a/src/rustc/Cargo.lock b/src/rustc/Cargo.lock index 4b5c2850dab..a3420d75218 100644 --- a/src/rustc/Cargo.lock +++ b/src/rustc/Cargo.lock @@ -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",