@@ -159,40 +159,41 @@ def format_build_time(duration):
159
159
class RustBuild (object ):
160
160
def download_stage0 (self ):
161
161
cache_dst = os .path .join (self .build_dir , "cache" )
162
- rustc_cache = os .path .join (cache_dst , self .stage0_rustc_date ())
162
+ rustc_cache = os .path .join (cache_dst , self .stage0_date ())
163
163
if not os .path .exists (rustc_cache ):
164
164
os .makedirs (rustc_cache )
165
165
166
- channel = self .stage0_rustc_channel ()
166
+ rustc_channel = self .stage0_rustc_channel ()
167
+ cargo_channel = self .stage0_cargo_channel ()
167
168
168
169
if self .rustc ().startswith (self .bin_root ()) and \
169
170
(not os .path .exists (self .rustc ()) or self .rustc_out_of_date ()):
170
171
self .print_what_it_means_to_bootstrap ()
171
172
if os .path .exists (self .bin_root ()):
172
173
shutil .rmtree (self .bin_root ())
173
- filename = "rust-std-{}-{}.tar.gz" .format (channel , self .build )
174
- url = "https://static.rust-lang.org/ dist/" + self .stage0_rustc_date ()
174
+ filename = "rust-std-{}-{}.tar.gz" .format (rustc_channel , self .build )
175
+ url = self . _download_url + "/ dist/" + self .stage0_date ()
175
176
tarball = os .path .join (rustc_cache , filename )
176
177
if not os .path .exists (tarball ):
177
178
get ("{}/{}" .format (url , filename ), tarball , verbose = self .verbose )
178
179
unpack (tarball , self .bin_root (),
179
180
match = "rust-std-" + self .build ,
180
181
verbose = self .verbose )
181
182
182
- filename = "rustc-{}-{}.tar.gz" .format (channel , self .build )
183
- url = "https://static.rust-lang.org/ dist/" + self .stage0_rustc_date ()
183
+ filename = "rustc-{}-{}.tar.gz" .format (rustc_channel , self .build )
184
+ url = self . _download_url + "/ dist/" + self .stage0_date ()
184
185
tarball = os .path .join (rustc_cache , filename )
185
186
if not os .path .exists (tarball ):
186
187
get ("{}/{}" .format (url , filename ), tarball , verbose = self .verbose )
187
188
unpack (tarball , self .bin_root (), match = "rustc" , verbose = self .verbose )
188
189
self .fix_executable (self .bin_root () + "/bin/rustc" )
189
190
self .fix_executable (self .bin_root () + "/bin/rustdoc" )
190
191
with open (self .rustc_stamp (), 'w' ) as f :
191
- f .write (self .stage0_rustc_date ())
192
+ f .write (self .stage0_date ())
192
193
193
194
if "pc-windows-gnu" in self .build :
194
- filename = "rust-mingw-{}-{}.tar.gz" .format (channel , self .build )
195
- url = "https://static.rust-lang.org/ dist/" + self .stage0_rustc_date ()
195
+ filename = "rust-mingw-{}-{}.tar.gz" .format (rustc_channel , self .build )
196
+ url = self . _download_url + "/ dist/" + self .stage0_date ()
196
197
tarball = os .path .join (rustc_cache , filename )
197
198
if not os .path .exists (tarball ):
198
199
get ("{}/{}" .format (url , filename ), tarball , verbose = self .verbose )
@@ -201,15 +202,15 @@ def download_stage0(self):
201
202
if self .cargo ().startswith (self .bin_root ()) and \
202
203
(not os .path .exists (self .cargo ()) or self .cargo_out_of_date ()):
203
204
self .print_what_it_means_to_bootstrap ()
204
- filename = "cargo-{}-{}.tar.gz" .format (channel , self .build )
205
- url = "https://static.rust-lang.org/ dist/" + self .stage0_rustc_date ()
205
+ filename = "cargo-{}-{}.tar.gz" .format (cargo_channel , self .build )
206
+ url = self . _download_url + "/ dist/" + self .stage0_date ()
206
207
tarball = os .path .join (rustc_cache , filename )
207
208
if not os .path .exists (tarball ):
208
209
get ("{}/{}" .format (url , filename ), tarball , verbose = self .verbose )
209
210
unpack (tarball , self .bin_root (), match = "cargo" , verbose = self .verbose )
210
211
self .fix_executable (self .bin_root () + "/bin/cargo" )
211
212
with open (self .cargo_stamp (), 'w' ) as f :
212
- f .write (self .stage0_rustc_date ())
213
+ f .write (self .stage0_date ())
213
214
214
215
def fix_executable (self , fname ):
215
216
# If we're on NixOS we need to change the path to the dynamic loader
@@ -264,12 +265,15 @@ def fix_executable(self, fname):
264
265
print ("warning: failed to call patchelf: %s" % e )
265
266
return
266
267
267
- def stage0_rustc_date (self ):
268
- return self ._rustc_date
268
+ def stage0_date (self ):
269
+ return self ._date
269
270
270
271
def stage0_rustc_channel (self ):
271
272
return self ._rustc_channel
272
273
274
+ def stage0_cargo_channel (self ):
275
+ return self ._cargo_channel
276
+
273
277
def rustc_stamp (self ):
274
278
return os .path .join (self .bin_root (), '.rustc-stamp' )
275
279
@@ -280,13 +284,13 @@ def rustc_out_of_date(self):
280
284
if not os .path .exists (self .rustc_stamp ()) or self .clean :
281
285
return True
282
286
with open (self .rustc_stamp (), 'r' ) as f :
283
- return self .stage0_rustc_date () != f .read ()
287
+ return self .stage0_date () != f .read ()
284
288
285
289
def cargo_out_of_date (self ):
286
290
if not os .path .exists (self .cargo_stamp ()) or self .clean :
287
291
return True
288
292
with open (self .cargo_stamp (), 'r' ) as f :
289
- return self .stage0_rustc_date () != f .read ()
293
+ return self .stage0_date () != f .read ()
290
294
291
295
def bin_root (self ):
292
296
return os .path .join (self .build_dir , self .build , "stage0" )
@@ -585,7 +589,13 @@ def bootstrap():
585
589
shutil .rmtree ('.cargo' )
586
590
587
591
data = stage0_data (rb .rust_root )
588
- rb ._rustc_channel , rb ._rustc_date = data ['rustc' ].split ('-' , 1 )
592
+ rb ._date = data ['date' ]
593
+ rb ._rustc_channel = data ['rustc' ]
594
+ rb ._cargo_channel = data ['cargo' ]
595
+ if 'dev' in data :
596
+ rb ._download_url = 'https://dev-static.rust-lang.org'
597
+ else :
598
+ rb ._download_url = 'https://static.rust-lang.org'
589
599
590
600
# Fetch/build the bootstrap
591
601
rb .build = rb .build_triple ()
0 commit comments