@@ -8,8 +8,8 @@ use crate::error::Result;
8
8
use crate :: repositories:: RepositoryStatsUpdater ;
9
9
use crate :: storage:: { rustdoc_archive_path, source_archive_path} ;
10
10
use crate :: utils:: {
11
- copy_dir_all, parse_rustc_version, queue_builder, report_error, set_config, CargoMetadata ,
12
- ConfigName ,
11
+ copy_dir_all, get_config , parse_rustc_version, queue_builder, report_error, set_config,
12
+ CargoMetadata , ConfigName ,
13
13
} ;
14
14
use crate :: RUSTDOC_STATIC_STORAGE_PREFIX ;
15
15
use crate :: { db:: blacklist:: is_blacklisted, utils:: MetadataPackage } ;
@@ -33,6 +33,21 @@ const COMPONENTS: &[&str] = &["llvm-tools-preview", "rustc-dev", "rustfmt"];
33
33
const DUMMY_CRATE_NAME : & str = "empty-library" ;
34
34
const DUMMY_CRATE_VERSION : & str = "1.0.0" ;
35
35
36
+ fn get_configured_toolchain ( conn : & mut Client ) -> Result < Toolchain > {
37
+ let name: String = get_config ( conn, ConfigName :: Toolchain ) ?. unwrap_or_else ( || "nightly" . into ( ) ) ;
38
+
39
+ // If the toolchain is all hex, assume it references an artifact from
40
+ // CI, for instance an `@bors try` build.
41
+ let re = Regex :: new ( r"^[a-fA-F0-9]+$" ) . unwrap ( ) ;
42
+ if re. is_match ( & name) {
43
+ debug ! ( "using CI build {}" , & name) ;
44
+ Ok ( Toolchain :: ci ( & name, false ) )
45
+ } else {
46
+ debug ! ( "using toolchain {}" , & name) ;
47
+ Ok ( Toolchain :: dist ( & name) )
48
+ }
49
+ }
50
+
36
51
pub enum PackageKind < ' a > {
37
52
Local ( & ' a Path ) ,
38
53
CratesIo ,
@@ -75,22 +90,13 @@ impl RustwideBuilder {
75
90
. purge_all_build_dirs ( )
76
91
. map_err ( FailureError :: compat) ?;
77
92
78
- // If the toolchain is all hex, assume it references an artifact from
79
- // CI, for instance an `@bors try` build.
80
- let re = Regex :: new ( r"^[a-fA-F0-9]+$" ) . unwrap ( ) ;
81
- let toolchain = if re. is_match ( & config. toolchain ) {
82
- debug ! ( "using CI build {}" , & config. toolchain) ;
83
- Toolchain :: ci ( & config. toolchain , false )
84
- } else {
85
- debug ! ( "using toolchain {}" , & config. toolchain) ;
86
- Toolchain :: dist ( & config. toolchain )
87
- } ;
93
+ let pool = context. pool ( ) ?;
88
94
89
95
Ok ( RustwideBuilder {
90
96
workspace,
91
- toolchain,
97
+ toolchain : get_configured_toolchain ( & mut * pool . get ( ) ? ) ? ,
92
98
config,
93
- db : context . pool ( ) ? ,
99
+ db : pool,
94
100
storage : context. storage ( ) ?,
95
101
metrics : context. instance_metrics ( ) ?,
96
102
index : context. index ( ) ?,
@@ -119,6 +125,8 @@ impl RustwideBuilder {
119
125
}
120
126
121
127
pub fn update_toolchain ( & mut self ) -> Result < bool > {
128
+ self . toolchain = get_configured_toolchain ( & mut * self . db . get ( ) ?) ?;
129
+
122
130
// For CI builds, a lot of the normal update_toolchain things don't apply.
123
131
// CI builds are only for one platform (https://forge.rust-lang.org/infra/docs/rustc-ci.html#try-builds)
124
132
// so we only try installing for the current platform. If that's not a match,
0 commit comments