@@ -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
15271537fn 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" ) ) ;
0 commit comments