about summary refs log tree commit diff
path: root/src/bootstrap/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap/config.rs')
-rw-r--r--src/bootstrap/config.rs22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 7c062460c4f..f1a150e0f24 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -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.
@@ -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");
@@ -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"));