Skip to content

Commit

Permalink
Fix stable channel downloads of LLVM
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Nov 2, 2022
1 parent 7c57093 commit 3100c85
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
22 changes: 16 additions & 6 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1280,11 +1280,21 @@ impl Config {
git
}

pub(crate) fn artifact_channel(&self, commit: &str) -> String {
pub(crate) fn artifact_version_part(&self, commit: &str) -> String {
let mut channel = self.git();
channel.arg("show").arg(format!("{}:src/ci/channel", commit));
let channel = output(&mut channel);
channel.trim().to_owned()

let mut version = self.git();
version.arg("show").arg(format!("{}:src/version", commit));
let version = output(&mut version);

match channel.trim() {
"stable" => version.trim().to_owned(),
"beta" => channel.trim().to_owned(),
"nightly" => channel.trim().to_owned(),
other => unreachable!("{:?} is not recognized as a valid channel", other),
}
}

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

fn download_ci_rustc(builder: &Builder<'_>, commit: &str) {
builder.verbose(&format!("using downloaded stage2 artifacts from CI (commit {commit})"));
let channel = builder.config.artifact_channel(commit);
let version = builder.config.artifact_version_part(commit);
let host = builder.config.build.triple;
let bin_root = builder.out.join(host).join("ci-rustc");
let rustc_stamp = bin_root.join(".rustc-stamp");
Expand All @@ -1535,13 +1545,13 @@ fn download_ci_rustc(builder: &Builder<'_>, commit: &str) {
if bin_root.exists() {
t!(fs::remove_dir_all(&bin_root));
}
let filename = format!("rust-std-{channel}-{host}.tar.xz");
let filename = format!("rust-std-{version}-{host}.tar.xz");
let pattern = format!("rust-std-{host}");
download_ci_component(builder, filename, &pattern, commit);
let filename = format!("rustc-{channel}-{host}.tar.xz");
let filename = format!("rustc-{version}-{host}.tar.xz");
download_ci_component(builder, filename, "rustc", commit);
// download-rustc doesn't need its own cargo, it can just use beta's.
let filename = format!("rustc-dev-{channel}-{host}.tar.xz");
let filename = format!("rustc-dev-{version}-{host}.tar.xz");
download_ci_component(builder, filename, "rustc-dev", commit);

builder.fix_bin_or_dylib(&bin_root.join("bin").join("rustc"));
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ fn download_ci_llvm(builder: &Builder<'_>, llvm_sha: &str) {
} else {
&builder.config.stage0_metadata.config.artifacts_server
};
let channel = builder.config.artifact_channel(llvm_sha);
let filename = format!("rust-dev-{}-{}.tar.xz", channel, builder.build.build.triple);
let version = builder.config.artifact_version_part(llvm_sha);
let filename = format!("rust-dev-{}-{}.tar.xz", version, builder.build.build.triple);
let tarball = rustc_cache.join(&filename);
if !tarball.exists() {
let help_on_error = "error: failed to download llvm from ci
Expand Down

0 comments on commit 3100c85

Please sign in to comment.