From 0a27a8713bdca09564ffd298fce8f760e47775af Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 13 Mar 2017 19:49:36 -0700 Subject: [PATCH] rustbuild: Don't hardcode 'nightly' for Cargo It now follows rustc release trains --- src/bootstrap/dist.rs | 19 +++++++++++-------- src/bootstrap/lib.rs | 5 +++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 7c463bec5ff7c..b3c44200c2ae6 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -37,8 +37,12 @@ use channel; use util::{cp_r, libdir, is_dylib, cp_filtered, copy, exe}; fn pkgname(build: &Build, component: &str) -> String { - assert!(component.starts_with("rust")); // does not work with cargo - format!("{}-{}", component, build.rust_package_vers()) + if component == "cargo" { + format!("{}-{}", component, build.cargo_package_vers()) + } else { + assert!(component.starts_with("rust")); + format!("{}-{}", component, build.rust_package_vers()) + } } fn distdir(build: &Build) -> PathBuf { @@ -537,7 +541,7 @@ pub fn cargo(build: &Build, stage: u32, target: &str) { let src = build.src.join("cargo"); let etc = src.join("src/etc"); let release_num = build.cargo_release_num(); - let name = format!("cargo-{}", build.package_vers(&release_num)); + let name = pkgname(build, "cargo"); let version = build.cargo_info.version(build, &release_num); let tmp = tmpdir(build); @@ -595,12 +599,11 @@ pub fn extended(build: &Build, stage: u32, target: &str) { println!("Dist extended stage{} ({})", stage, target); let dist = distdir(build); - let cargo_vers = build.cargo_release_num(); let rustc_installer = dist.join(format!("{}-{}.tar.gz", pkgname(build, "rustc"), target)); - let cargo_installer = dist.join(format!("cargo-{}-{}.tar.gz", - build.package_vers(&cargo_vers), + let cargo_installer = dist.join(format!("{}-{}.tar.gz", + pkgname(build, "cargo"), target)); let docs_installer = dist.join(format!("{}-{}.tar.gz", pkgname(build, "rust-docs"), @@ -678,7 +681,7 @@ pub fn extended(build: &Build, stage: u32, target: &str) { cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target)), &pkg.join("rustc")); - cp_r(&work.join(&format!("cargo-nightly-{}", target)), + cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target)), &pkg.join("cargo")); cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target)), &pkg.join("rust-docs")); @@ -730,7 +733,7 @@ pub fn extended(build: &Build, stage: u32, target: &str) { cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target)) .join("rustc"), &exe.join("rustc")); - cp_r(&work.join(&format!("cargo-nightly-{}", target)) + cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target)) .join("cargo"), &exe.join("cargo")); cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target)) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 72aec15e532b5..3e17739685bea 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -994,6 +994,11 @@ impl Build { self.package_vers(channel::CFG_RELEASE_NUM) } + /// Returns the value of `package_vers` above for Cargo + fn cargo_package_vers(&self) -> String { + self.package_vers(&self.cargo_release_num()) + } + /// Returns the `version` string associated with this compiler for Rust /// itself. ///