@@ -63,31 +63,30 @@ def support_xz():
63
63
except tarfile .CompressionError :
64
64
return False
65
65
66
- def get (base , url , path , checksums , verbose = False , do_verify = True ):
66
+ def get (base , url , path , checksums , verbose = False ):
67
67
with tempfile .NamedTemporaryFile (delete = False ) as temp_file :
68
68
temp_path = temp_file .name
69
69
70
70
try :
71
- if do_verify :
72
- if url not in checksums :
73
- raise RuntimeError (("src/stage0.json doesn't contain a checksum for {}. "
74
- "Pre-built artifacts might not available for this "
75
- "target at this time, see https://doc.rust-lang.org/nightly"
76
- "/rustc/platform-support.html for more information." )
77
- .format (url ))
78
- sha256 = checksums [url ]
79
- if os .path .exists (path ):
80
- if verify (path , sha256 , False ):
81
- if verbose :
82
- print ("using already-download file" , path )
83
- return
84
- else :
85
- if verbose :
86
- print ("ignoring already-download file" ,
87
- path , "due to failed verification" )
88
- os .unlink (path )
71
+ if url not in checksums :
72
+ raise RuntimeError (("src/stage0.json doesn't contain a checksum for {}. "
73
+ "Pre-built artifacts might not be available for this "
74
+ "target at this time, see https://doc.rust-lang.org/nightly"
75
+ "/rustc/platform-support.html for more information." )
76
+ .format (url ))
77
+ sha256 = checksums [url ]
78
+ if os .path .exists (path ):
79
+ if verify (path , sha256 , False ):
80
+ if verbose :
81
+ print ("using already-download file" , path )
82
+ return
83
+ else :
84
+ if verbose :
85
+ print ("ignoring already-download file" ,
86
+ path , "due to failed verification" )
87
+ os .unlink (path )
89
88
download (temp_path , "{}/{}" .format (base , url ), True , verbose )
90
- if do_verify and not verify (temp_path , sha256 , verbose ):
89
+ if not verify (temp_path , sha256 , verbose ):
91
90
raise RuntimeError ("failed verification" )
92
91
if verbose :
93
92
print ("moving {} to {}" .format (temp_path , path ))
@@ -430,7 +429,6 @@ class RustBuild(object):
430
429
def __init__ (self ):
431
430
self .checksums_sha256 = {}
432
431
self .stage0_compiler = None
433
- self .stage0_rustfmt = None
434
432
self ._download_url = ''
435
433
self .build = ''
436
434
self .build_dir = ''
@@ -484,31 +482,10 @@ def download_toolchain(self):
484
482
with output (self .rustc_stamp ()) as rust_stamp :
485
483
rust_stamp .write (key )
486
484
487
- if self .rustfmt () and self .rustfmt ().startswith (bin_root ) and (
488
- not os .path .exists (self .rustfmt ())
489
- or self .program_out_of_date (
490
- self .rustfmt_stamp (),
491
- "" if self .stage0_rustfmt is None else self .stage0_rustfmt .channel ()
492
- )
493
- ):
494
- if self .stage0_rustfmt is not None :
495
- tarball_suffix = '.tar.xz' if support_xz () else '.tar.gz'
496
- filename = "rustfmt-{}-{}{}" .format (
497
- self .stage0_rustfmt .version , self .build , tarball_suffix ,
498
- )
499
- self ._download_component_helper (
500
- filename , "rustfmt-preview" , tarball_suffix , key = self .stage0_rustfmt .date
501
- )
502
- self .fix_bin_or_dylib ("{}/bin/rustfmt" .format (bin_root ))
503
- self .fix_bin_or_dylib ("{}/bin/cargo-fmt" .format (bin_root ))
504
- with output (self .rustfmt_stamp ()) as rustfmt_stamp :
505
- rustfmt_stamp .write (self .stage0_rustfmt .channel ())
506
-
507
485
def _download_component_helper (
508
- self , filename , pattern , tarball_suffix , key = None
486
+ self , filename , pattern , tarball_suffix ,
509
487
):
510
- if key is None :
511
- key = self .stage0_compiler .date
488
+ key = self .stage0_compiler .date
512
489
cache_dst = os .path .join (self .build_dir , "cache" )
513
490
rustc_cache = os .path .join (cache_dst , key )
514
491
if not os .path .exists (rustc_cache ):
@@ -524,7 +501,6 @@ def _download_component_helper(
524
501
tarball ,
525
502
self .checksums_sha256 ,
526
503
verbose = self .verbose ,
527
- do_verify = True ,
528
504
)
529
505
unpack (tarball , tarball_suffix , self .bin_root (), match = pattern , verbose = self .verbose )
530
506
@@ -634,16 +610,6 @@ def rustc_stamp(self):
634
610
"""
635
611
return os .path .join (self .bin_root (), '.rustc-stamp' )
636
612
637
- def rustfmt_stamp (self ):
638
- """Return the path for .rustfmt-stamp
639
-
640
- >>> rb = RustBuild()
641
- >>> rb.build_dir = "build"
642
- >>> rb.rustfmt_stamp() == os.path.join("build", "stage0", ".rustfmt-stamp")
643
- True
644
- """
645
- return os .path .join (self .bin_root (), '.rustfmt-stamp' )
646
-
647
613
def program_out_of_date (self , stamp_path , key ):
648
614
"""Check if the given program stamp is out of date"""
649
615
if not os .path .exists (stamp_path ) or self .clean :
@@ -717,12 +683,6 @@ def rustc(self):
717
683
"""Return config path for rustc"""
718
684
return self .program_config ('rustc' )
719
685
720
- def rustfmt (self ):
721
- """Return config path for rustfmt"""
722
- if self .stage0_rustfmt is None :
723
- return None
724
- return self .program_config ('rustfmt' )
725
-
726
686
def program_config (self , program ):
727
687
"""Return config path for the given program at the given stage
728
688
@@ -1082,8 +1042,6 @@ def bootstrap(help_triggered):
1082
1042
data = json .load (f )
1083
1043
build .checksums_sha256 = data ["checksums_sha256" ]
1084
1044
build .stage0_compiler = Stage0Toolchain (data ["compiler" ])
1085
- if data .get ("rustfmt" ) is not None :
1086
- build .stage0_rustfmt = Stage0Toolchain (data ["rustfmt" ])
1087
1045
1088
1046
build .set_dist_environment (data ["dist_server" ])
1089
1047
0 commit comments