Skip to content

Commit c6df67a

Browse files
committed
Auto merge of #40515 - alexcrichton:tarball-names, r=brson
rustbuild: Don't hardcode 'nightly' for Cargo It now follows rustc release trains. I also had to land this commit on beta (0a27a87) before #40484 could land, so this is basically just a forward port (if you will) of that commit to master.
2 parents 7c7753d + fe2b7a4 commit c6df67a

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/bootstrap/dist.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ use channel;
3737
use util::{cp_r, libdir, is_dylib, cp_filtered, copy, exe};
3838

3939
fn pkgname(build: &Build, component: &str) -> String {
40-
assert!(component.starts_with("rust")); // does not work with cargo
41-
format!("{}-{}", component, build.rust_package_vers())
40+
if component == "cargo" {
41+
format!("{}-{}", component, build.cargo_package_vers())
42+
} else {
43+
assert!(component.starts_with("rust"));
44+
format!("{}-{}", component, build.rust_package_vers())
45+
}
4246
}
4347

4448
fn distdir(build: &Build) -> PathBuf {
@@ -533,7 +537,7 @@ pub fn cargo(build: &Build, stage: u32, target: &str) {
533537
let src = build.src.join("cargo");
534538
let etc = src.join("src/etc");
535539
let release_num = build.cargo_release_num();
536-
let name = format!("cargo-{}", build.package_vers(&release_num));
540+
let name = pkgname(build, "cargo");
537541
let version = build.cargo_info.version(build, &release_num);
538542

539543
let tmp = tmpdir(build);
@@ -591,12 +595,11 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
591595
println!("Dist extended stage{} ({})", stage, target);
592596

593597
let dist = distdir(build);
594-
let cargo_vers = build.cargo_release_num();
595598
let rustc_installer = dist.join(format!("{}-{}.tar.gz",
596599
pkgname(build, "rustc"),
597600
target));
598-
let cargo_installer = dist.join(format!("cargo-{}-{}.tar.gz",
599-
build.package_vers(&cargo_vers),
601+
let cargo_installer = dist.join(format!("{}-{}.tar.gz",
602+
pkgname(build, "cargo"),
600603
target));
601604
let docs_installer = dist.join(format!("{}-{}.tar.gz",
602605
pkgname(build, "rust-docs"),
@@ -674,7 +677,7 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
674677

675678
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target)),
676679
&pkg.join("rustc"));
677-
cp_r(&work.join(&format!("cargo-nightly-{}", target)),
680+
cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target)),
678681
&pkg.join("cargo"));
679682
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target)),
680683
&pkg.join("rust-docs"));
@@ -726,7 +729,7 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
726729
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target))
727730
.join("rustc"),
728731
&exe.join("rustc"));
729-
cp_r(&work.join(&format!("cargo-nightly-{}", target))
732+
cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target))
730733
.join("cargo"),
731734
&exe.join("cargo"));
732735
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target))

src/bootstrap/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,11 @@ impl Build {
10151015
self.package_vers(channel::CFG_RELEASE_NUM)
10161016
}
10171017

1018+
/// Returns the value of `package_vers` above for Cargo
1019+
fn cargo_package_vers(&self) -> String {
1020+
self.package_vers(&self.cargo_release_num())
1021+
}
1022+
10181023
/// Returns the `version` string associated with this compiler for Rust
10191024
/// itself.
10201025
///

0 commit comments

Comments
 (0)