@@ -429,17 +429,24 @@ def download_toolchain(self):
429
429
self .program_out_of_date (self .rustc_stamp (), key )):
430
430
if os .path .exists (bin_root ):
431
431
shutil .rmtree (bin_root )
432
+
433
+ key = self .stage0_compiler .date
434
+ cache_dst = os .path .join (self .build_dir , "cache" )
435
+ rustc_cache = os .path .join (cache_dst , key )
436
+ if not os .path .exists (rustc_cache ):
437
+ os .makedirs (rustc_cache )
438
+
432
439
tarball_suffix = '.tar.gz' if lzma is None else '.tar.xz'
433
440
filename = "rust-std-{}-{}{}" .format (
434
441
rustc_channel , self .build , tarball_suffix )
435
442
pattern = "rust-std-{}" .format (self .build )
436
- self ._download_component_helper (filename , pattern , tarball_suffix )
443
+ self ._download_component_helper (filename , pattern , tarball_suffix , rustc_cache )
437
444
filename = "rustc-{}-{}{}" .format (rustc_channel , self .build ,
438
445
tarball_suffix )
439
- self ._download_component_helper (filename , "rustc" , tarball_suffix )
446
+ self ._download_component_helper (filename , "rustc" , tarball_suffix , rustc_cache )
440
447
filename = "cargo-{}-{}{}" .format (rustc_channel , self .build ,
441
448
tarball_suffix )
442
- self ._download_component_helper (filename , "cargo" , tarball_suffix )
449
+ self ._download_component_helper (filename , "cargo" , tarball_suffix , rustc_cache )
443
450
if self .should_fix_bins_and_dylibs ():
444
451
self .fix_bin_or_dylib ("{}/bin/cargo" .format (bin_root ))
445
452
@@ -455,13 +462,9 @@ def download_toolchain(self):
455
462
rust_stamp .write (key )
456
463
457
464
def _download_component_helper (
458
- self , filename , pattern , tarball_suffix ,
465
+ self , filename , pattern , tarball_suffix , rustc_cache ,
459
466
):
460
467
key = self .stage0_compiler .date
461
- cache_dst = os .path .join (self .build_dir , "cache" )
462
- rustc_cache = os .path .join (cache_dst , key )
463
- if not os .path .exists (rustc_cache ):
464
- os .makedirs (rustc_cache )
465
468
466
469
tarball = os .path .join (rustc_cache , filename )
467
470
if not os .path .exists (tarball ):
0 commit comments