Skip to content

Commit f21a06f

Browse files
authored
Rollup merge of #99962 - Mark-Simulacrum:detect-ci-artifact-channel, r=jyn514
Discover channel for LLVM download r? `@jyn514` cc `@RalfJung` Reported on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/No.20prebuilt.20LLVM.20for.20the.20beta.20branch.3F
2 parents b9ad36c + d63e982 commit f21a06f

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/bootstrap/config.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,13 @@ impl Config {
13121312
git
13131313
}
13141314

1315+
pub(crate) fn artifact_channel(&self, commit: &str) -> String {
1316+
let mut channel = self.git();
1317+
channel.arg("show").arg(format!("{}:src/ci/channel", commit));
1318+
let channel = output(&mut channel);
1319+
channel.trim().to_owned()
1320+
}
1321+
13151322
/// Try to find the relative path of `bindir`, otherwise return it in full.
13161323
pub fn bindir_relative(&self) -> &Path {
13171324
let bindir = &self.bindir;
@@ -1547,8 +1554,7 @@ fn maybe_download_rustfmt(builder: &Builder<'_>) -> Option<PathBuf> {
15471554

15481555
fn download_ci_rustc(builder: &Builder<'_>, commit: &str) {
15491556
builder.verbose(&format!("using downloaded stage2 artifacts from CI (commit {commit})"));
1550-
// FIXME: support downloading artifacts from the beta channel
1551-
const CHANNEL: &str = "nightly";
1557+
let channel = builder.config.artifact_channel(commit);
15521558
let host = builder.config.build.triple;
15531559
let bin_root = builder.out.join(host).join("ci-rustc");
15541560
let rustc_stamp = bin_root.join(".rustc-stamp");
@@ -1557,13 +1563,13 @@ fn download_ci_rustc(builder: &Builder<'_>, commit: &str) {
15571563
if bin_root.exists() {
15581564
t!(fs::remove_dir_all(&bin_root));
15591565
}
1560-
let filename = format!("rust-std-{CHANNEL}-{host}.tar.xz");
1566+
let filename = format!("rust-std-{channel}-{host}.tar.xz");
15611567
let pattern = format!("rust-std-{host}");
15621568
download_ci_component(builder, filename, &pattern, commit);
1563-
let filename = format!("rustc-{CHANNEL}-{host}.tar.xz");
1569+
let filename = format!("rustc-{channel}-{host}.tar.xz");
15641570
download_ci_component(builder, filename, "rustc", commit);
15651571
// download-rustc doesn't need its own cargo, it can just use beta's.
1566-
let filename = format!("rustc-dev-{CHANNEL}-{host}.tar.xz");
1572+
let filename = format!("rustc-dev-{channel}-{host}.tar.xz");
15671573
download_ci_component(builder, filename, "rustc-dev", commit);
15681574

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

src/bootstrap/native.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ fn download_ci_llvm(builder: &Builder<'_>, llvm_sha: &str) {
189189
} else {
190190
&builder.config.stage0_metadata.config.artifacts_server
191191
};
192-
let filename = format!("rust-dev-nightly-{}.tar.xz", builder.build.build.triple);
192+
let channel = builder.config.artifact_channel(llvm_sha);
193+
let filename = format!("rust-dev-{}-{}.tar.xz", channel, builder.build.build.triple);
193194
let tarball = rustc_cache.join(&filename);
194195
if !tarball.exists() {
195196
let help_on_error = "error: failed to download llvm from ci

0 commit comments

Comments
 (0)