Skip to content

Commit 3100c85

Browse files
Fix stable channel downloads of LLVM
1 parent 7c57093 commit 3100c85

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/bootstrap/config.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,11 +1280,21 @@ impl Config {
12801280
git
12811281
}
12821282

1283-
pub(crate) fn artifact_channel(&self, commit: &str) -> String {
1283+
pub(crate) fn artifact_version_part(&self, commit: &str) -> String {
12841284
let mut channel = self.git();
12851285
channel.arg("show").arg(format!("{}:src/ci/channel", commit));
12861286
let channel = output(&mut channel);
1287-
channel.trim().to_owned()
1287+
1288+
let mut version = self.git();
1289+
version.arg("show").arg(format!("{}:src/version", commit));
1290+
let version = output(&mut version);
1291+
1292+
match channel.trim() {
1293+
"stable" => version.trim().to_owned(),
1294+
"beta" => channel.trim().to_owned(),
1295+
"nightly" => channel.trim().to_owned(),
1296+
other => unreachable!("{:?} is not recognized as a valid channel", other),
1297+
}
12881298
}
12891299

12901300
/// Try to find the relative path of `bindir`, otherwise return it in full.
@@ -1526,7 +1536,7 @@ fn maybe_download_rustfmt(builder: &Builder<'_>) -> Option<PathBuf> {
15261536

15271537
fn download_ci_rustc(builder: &Builder<'_>, commit: &str) {
15281538
builder.verbose(&format!("using downloaded stage2 artifacts from CI (commit {commit})"));
1529-
let channel = builder.config.artifact_channel(commit);
1539+
let version = builder.config.artifact_version_part(commit);
15301540
let host = builder.config.build.triple;
15311541
let bin_root = builder.out.join(host).join("ci-rustc");
15321542
let rustc_stamp = bin_root.join(".rustc-stamp");
@@ -1535,13 +1545,13 @@ fn download_ci_rustc(builder: &Builder<'_>, commit: &str) {
15351545
if bin_root.exists() {
15361546
t!(fs::remove_dir_all(&bin_root));
15371547
}
1538-
let filename = format!("rust-std-{channel}-{host}.tar.xz");
1548+
let filename = format!("rust-std-{version}-{host}.tar.xz");
15391549
let pattern = format!("rust-std-{host}");
15401550
download_ci_component(builder, filename, &pattern, commit);
1541-
let filename = format!("rustc-{channel}-{host}.tar.xz");
1551+
let filename = format!("rustc-{version}-{host}.tar.xz");
15421552
download_ci_component(builder, filename, "rustc", commit);
15431553
// download-rustc doesn't need its own cargo, it can just use beta's.
1544-
let filename = format!("rustc-dev-{channel}-{host}.tar.xz");
1554+
let filename = format!("rustc-dev-{version}-{host}.tar.xz");
15451555
download_ci_component(builder, filename, "rustc-dev", commit);
15461556

15471557
builder.fix_bin_or_dylib(&bin_root.join("bin").join("rustc"));

src/bootstrap/native.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ fn download_ci_llvm(builder: &Builder<'_>, llvm_sha: &str) {
260260
} else {
261261
&builder.config.stage0_metadata.config.artifacts_server
262262
};
263-
let channel = builder.config.artifact_channel(llvm_sha);
264-
let filename = format!("rust-dev-{}-{}.tar.xz", channel, builder.build.build.triple);
263+
let version = builder.config.artifact_version_part(llvm_sha);
264+
let filename = format!("rust-dev-{}-{}.tar.xz", version, builder.build.build.triple);
265265
let tarball = rustc_cache.join(&filename);
266266
if !tarball.exists() {
267267
let help_on_error = "error: failed to download llvm from ci

0 commit comments

Comments
 (0)