Skip to content

Commit

Permalink
rustbuild: Fix handling of the bootstrap key
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexcrichton committed Apr 12, 2016
1 parent b622c3e commit 8efbfae
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/bootstrap/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ winapi = "0.2"
kernel32-sys = "0.2"
gcc = "0.3.17"
libc = "0.2"
md5 = "0.1"
11 changes: 6 additions & 5 deletions src/bootstrap/build/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}

1 change: 1 addition & 0 deletions src/bootstrap/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extern crate libc;
extern crate num_cpus;
extern crate rustc_serialize;
extern crate toml;
extern crate md5;

use std::env;

Expand Down
40 changes: 37 additions & 3 deletions src/rustc/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8efbfae

Please sign in to comment.