@@ -63,31 +63,30 @@ def support_xz():
6363 except tarfile .CompressionError :
6464 return False
6565
66- def get (base , url , path , checksums , verbose = False , do_verify = True ):
66+ def get (base , url , path , checksums , verbose = False ):
6767 with tempfile .NamedTemporaryFile (delete = False ) as temp_file :
6868 temp_path = temp_file .name
6969
7070 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 )
8988 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 ):
9190 raise RuntimeError ("failed verification" )
9291 if verbose :
9392 print ("moving {} to {}" .format (temp_path , path ))
@@ -430,7 +429,6 @@ class RustBuild(object):
430429 def __init__ (self ):
431430 self .checksums_sha256 = {}
432431 self .stage0_compiler = None
433- self .stage0_rustfmt = None
434432 self ._download_url = ''
435433 self .build = ''
436434 self .build_dir = ''
@@ -484,31 +482,10 @@ def download_toolchain(self):
484482 with output (self .rustc_stamp ()) as rust_stamp :
485483 rust_stamp .write (key )
486484
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-
507485 def _download_component_helper (
508- self , filename , pattern , tarball_suffix , key = None
486+ self , filename , pattern , tarball_suffix ,
509487 ):
510- if key is None :
511- key = self .stage0_compiler .date
488+ key = self .stage0_compiler .date
512489 cache_dst = os .path .join (self .build_dir , "cache" )
513490 rustc_cache = os .path .join (cache_dst , key )
514491 if not os .path .exists (rustc_cache ):
@@ -524,7 +501,6 @@ def _download_component_helper(
524501 tarball ,
525502 self .checksums_sha256 ,
526503 verbose = self .verbose ,
527- do_verify = True ,
528504 )
529505 unpack (tarball , tarball_suffix , self .bin_root (), match = pattern , verbose = self .verbose )
530506
@@ -634,16 +610,6 @@ def rustc_stamp(self):
634610 """
635611 return os .path .join (self .bin_root (), '.rustc-stamp' )
636612
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-
647613 def program_out_of_date (self , stamp_path , key ):
648614 """Check if the given program stamp is out of date"""
649615 if not os .path .exists (stamp_path ) or self .clean :
@@ -717,12 +683,6 @@ def rustc(self):
717683 """Return config path for rustc"""
718684 return self .program_config ('rustc' )
719685
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-
726686 def program_config (self , program ):
727687 """Return config path for the given program at the given stage
728688
@@ -1082,8 +1042,6 @@ def bootstrap(help_triggered):
10821042 data = json .load (f )
10831043 build .checksums_sha256 = data ["checksums_sha256" ]
10841044 build .stage0_compiler = Stage0Toolchain (data ["compiler" ])
1085- if data .get ("rustfmt" ) is not None :
1086- build .stage0_rustfmt = Stage0Toolchain (data ["rustfmt" ])
10871045
10881046 build .set_dist_environment (data ["dist_server" ])
10891047
0 commit comments