diff options
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/compile.rs | 5 | ||||
| -rw-r--r-- | src/bootstrap/dist.rs | 11 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 18 | ||||
| -rw-r--r-- | src/bootstrap/step.rs | 2 |
4 files changed, 28 insertions, 8 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 46d8d4b4aab..3459c1d2b84 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -417,7 +417,10 @@ pub fn tool(build: &Build, stage: u32, target: &str, tool: &str) { // build.clear_if_dirty(&out_dir, &libstd_stamp(build, stage, &host, target)); let mut cargo = build.cargo(&compiler, Mode::Tool, target, "build"); - let dir = build.src.join("src/tools").join(tool); + let mut dir = build.src.join(tool); + if !dir.exists() { + dir = build.src.join("src/tools").join(tool); + } cargo.arg("--manifest-path").arg(dir.join("Cargo.toml")); // We don't want to build tools dynamically as they'll be running across diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 67e4dad83ce..5c547f7af5f 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -392,6 +392,7 @@ pub fn rust_src(build: &Build) { let src_dirs = [ "man", "src", + "cargo", ]; let filter_fn = move |path: &Path| { @@ -535,9 +536,9 @@ pub fn cargo(build: &Build, stage: u32, target: &str) { let src = build.src.join("src/tools/cargo"); let etc = src.join("src/etc"); - let release_num = &build.crates["cargo"].version; - let name = format!("cargo-{}", build.package_vers(release_num)); - let version = build.cargo_info.version(build, release_num); + let release_num = build.cargo_release_num(); + let name = format!("cargo-{}", build.package_vers(&release_num)); + let version = build.cargo_info.version(build, &release_num); let tmp = tmpdir(build); let image = tmp.join("cargo-image"); @@ -594,7 +595,7 @@ pub fn extended(build: &Build, stage: u32, target: &str) { println!("Dist extended stage{} ({})", stage, target); let dist = distdir(build); - let cargo_vers = &build.crates["cargo"].version; + let cargo_vers = build.cargo_release_num(); let rustc_installer = dist.join(format!("{}-{}.tar.gz", pkgname(build, "rustc"), target)); @@ -943,7 +944,7 @@ pub fn hash_and_sign(build: &Build) { cmd.arg(distdir(build)); cmd.arg(today.trim()); cmd.arg(build.rust_package_vers()); - cmd.arg(build.cargo_info.version(build, &build.crates["cargo"].version)); + cmd.arg(build.cargo_info.version(build, &build.cargo_release_num())); cmd.arg(addr); t!(fs::create_dir_all(distdir(build))); diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 071d0b0b090..4831b380837 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -76,11 +76,12 @@ extern crate num_cpus; extern crate rustc_serialize; extern crate toml; -use std::collections::HashMap; use std::cmp; +use std::collections::HashMap; use std::env; use std::ffi::OsString; use std::fs::{self, File}; +use std::io::Read; use std::path::{Component, PathBuf, Path}; use std::process::Command; @@ -995,6 +996,21 @@ impl Build { self.rust_info.version(self, channel::CFG_RELEASE_NUM) } + /// Returns the `a.b.c` version that Cargo is at. + fn cargo_release_num(&self) -> String { + let mut toml = String::new(); + t!(t!(File::open(self.src.join("cargo/Cargo.toml"))).read_to_string(&mut toml)); + for line in toml.lines() { + let prefix = "version = \""; + let suffix = "\""; + if line.starts_with(prefix) && line.ends_with(suffix) { + return line[prefix.len()..line.len() - suffix.len()].to_string() + } + } + + panic!("failed to find version in cargo's Cargo.toml") + } + /// Returns whether unstable features should be enabled for the compiler /// we're building. fn unstable_features(&self) -> bool { diff --git a/src/bootstrap/step.rs b/src/bootstrap/step.rs index a5c0d11d219..a11726a57db 100644 --- a/src/bootstrap/step.rs +++ b/src/bootstrap/step.rs @@ -559,7 +559,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules { rules.build("tool-qemu-test-client", "src/tools/qemu-test-client") .dep(|s| s.name("libstd")) .run(move |s| compile::tool(build, s.stage, s.target, "qemu-test-client")); - rules.build("tool-cargo", "src/tools/cargo") + rules.build("tool-cargo", "cargo") .dep(|s| s.name("libstd")) .dep(|s| s.stage(0).host(s.target).name("openssl")) .dep(move |s| { |
