@@ -446,7 +446,7 @@ def __init__(self):
446446 self .nix_deps_dir = None
447447 self .rustc_commit = None
448448
449- def download_toolchain (self , stage0 = True , rustc_channel = None ):
449+ def download_toolchain (self , rustc_channel = None ):
450450 """Fetch the build system for Rust, written in Rust
451451
452452 This method will build a cache directory, then it will fetch the
@@ -458,43 +458,34 @@ def download_toolchain(self, stage0=True, rustc_channel=None):
458458 """
459459 if rustc_channel is None :
460460 rustc_channel = self .stage0_compiler .version
461- bin_root = self .bin_root (stage0 )
461+ bin_root = self .bin_root ()
462462
463463 key = self .stage0_compiler .date
464- if not stage0 :
465- key += str (self .rustc_commit )
466- if self .rustc (stage0 ).startswith (bin_root ) and \
467- (not os .path .exists (self .rustc (stage0 )) or
468- self .program_out_of_date (self .rustc_stamp (stage0 ), key )):
464+ if self .rustc ().startswith (bin_root ) and \
465+ (not os .path .exists (self .rustc ()) or
466+ self .program_out_of_date (self .rustc_stamp (), key )):
469467 if os .path .exists (bin_root ):
470468 shutil .rmtree (bin_root )
471469 tarball_suffix = '.tar.xz' if support_xz () else '.tar.gz'
472470 filename = "rust-std-{}-{}{}" .format (
473471 rustc_channel , self .build , tarball_suffix )
474472 pattern = "rust-std-{}" .format (self .build )
475- self ._download_component_helper (filename , pattern , tarball_suffix , stage0 )
473+ self ._download_component_helper (filename , pattern , tarball_suffix )
476474 filename = "rustc-{}-{}{}" .format (rustc_channel , self .build ,
477475 tarball_suffix )
478- self ._download_component_helper (filename , "rustc" , tarball_suffix , stage0 )
479- # download-rustc doesn't need its own cargo, it can just use beta's.
480- if stage0 :
481- filename = "cargo-{}-{}{}" .format (rustc_channel , self .build ,
482- tarball_suffix )
483- self ._download_component_helper (filename , "cargo" , tarball_suffix )
484- self .fix_bin_or_dylib ("{}/bin/cargo" .format (bin_root ))
485- else :
486- filename = "rustc-dev-{}-{}{}" .format (rustc_channel , self .build , tarball_suffix )
487- self ._download_component_helper (
488- filename , "rustc-dev" , tarball_suffix , stage0
489- )
476+ self ._download_component_helper (filename , "rustc" , tarball_suffix )
477+ filename = "cargo-{}-{}{}" .format (rustc_channel , self .build ,
478+ tarball_suffix )
479+ self ._download_component_helper (filename , "cargo" , tarball_suffix )
480+ self .fix_bin_or_dylib ("{}/bin/cargo" .format (bin_root ))
490481
491482 self .fix_bin_or_dylib ("{}/bin/rustc" .format (bin_root ))
492483 self .fix_bin_or_dylib ("{}/bin/rustdoc" .format (bin_root ))
493484 lib_dir = "{}/lib" .format (bin_root )
494485 for lib in os .listdir (lib_dir ):
495486 if lib .endswith (".so" ):
496487 self .fix_bin_or_dylib (os .path .join (lib_dir , lib ))
497- with output (self .rustc_stamp (stage0 )) as rust_stamp :
488+ with output (self .rustc_stamp ()) as rust_stamp :
498489 rust_stamp .write (key )
499490
500491 if self .rustfmt () and self .rustfmt ().startswith (bin_root ) and (
@@ -518,24 +509,17 @@ def download_toolchain(self, stage0=True, rustc_channel=None):
518509 rustfmt_stamp .write (self .stage0_rustfmt .channel ())
519510
520511 def _download_component_helper (
521- self , filename , pattern , tarball_suffix , stage0 = True , key = None
512+ self , filename , pattern , tarball_suffix , key = None
522513 ):
523514 if key is None :
524- if stage0 :
525- key = self .stage0_compiler .date
526- else :
527- key = self .rustc_commit
515+ key = self .stage0_compiler .date
528516 cache_dst = os .path .join (self .build_dir , "cache" )
529517 rustc_cache = os .path .join (cache_dst , key )
530518 if not os .path .exists (rustc_cache ):
531519 os .makedirs (rustc_cache )
532520
533- if stage0 :
534- base = self ._download_url
535- url = "dist/{}" .format (key )
536- else :
537- base = "https://ci-artifacts.rust-lang.org"
538- url = "rustc-builds/{}" .format (self .rustc_commit )
521+ base = self ._download_url
522+ url = "dist/{}" .format (key )
539523 tarball = os .path .join (rustc_cache , filename )
540524 if not os .path .exists (tarball ):
541525 get (
@@ -544,9 +528,9 @@ def _download_component_helper(
544528 tarball ,
545529 self .checksums_sha256 ,
546530 verbose = self .verbose ,
547- do_verify = stage0 ,
531+ do_verify = True ,
548532 )
549- unpack (tarball , tarball_suffix , self .bin_root (stage0 ), match = pattern , verbose = self .verbose )
533+ unpack (tarball , tarball_suffix , self .bin_root (), match = pattern , verbose = self .verbose )
550534
551535 def fix_bin_or_dylib (self , fname ):
552536 """Modifies the interpreter section of 'fname' to fix the dynamic linker,
@@ -689,17 +673,15 @@ def maybe_download_ci_toolchain(self):
689673 # FIXME: support downloading artifacts from the beta channel
690674 self .download_toolchain (False , "nightly" )
691675
692- def rustc_stamp (self , stage0 ):
676+ def rustc_stamp (self ):
693677 """Return the path for .rustc-stamp at the given stage
694678
695679 >>> rb = RustBuild()
696680 >>> rb.build_dir = "build"
697- >>> rb.rustc_stamp(True) == os.path.join("build", "stage0", ".rustc-stamp")
698- True
699- >>> rb.rustc_stamp(False) == os.path.join("build", "ci-rustc", ".rustc-stamp")
681+ >>> rb.rustc_stamp() == os.path.join("build", "stage0", ".rustc-stamp")
700682 True
701683 """
702- return os .path .join (self .bin_root (stage0 ), '.rustc-stamp' )
684+ return os .path .join (self .bin_root (), '.rustc-stamp' )
703685
704686 def rustfmt_stamp (self ):
705687 """Return the path for .rustfmt-stamp
@@ -709,7 +691,7 @@ def rustfmt_stamp(self):
709691 >>> rb.rustfmt_stamp() == os.path.join("build", "stage0", ".rustfmt-stamp")
710692 True
711693 """
712- return os .path .join (self .bin_root (True ), '.rustfmt-stamp' )
694+ return os .path .join (self .bin_root (), '.rustfmt-stamp' )
713695
714696 def program_out_of_date (self , stamp_path , key ):
715697 """Check if the given program stamp is out of date"""
@@ -718,26 +700,21 @@ def program_out_of_date(self, stamp_path, key):
718700 with open (stamp_path , 'r' ) as stamp :
719701 return key != stamp .read ()
720702
721- def bin_root (self , stage0 ):
703+ def bin_root (self ):
722704 """Return the binary root directory for the given stage
723705
724706 >>> rb = RustBuild()
725707 >>> rb.build_dir = "build"
726- >>> rb.bin_root(True) == os.path.join("build", "stage0")
727- True
728- >>> rb.bin_root(False) == os.path.join("build", "ci-rustc")
708+ >>> rb.bin_root() == os.path.join("build", "stage0")
729709 True
730710
731711 When the 'build' property is given should be a nested directory:
732712
733713 >>> rb.build = "devel"
734- >>> rb.bin_root(True ) == os.path.join("build", "devel", "stage0")
714+ >>> rb.bin_root() == os.path.join("build", "devel", "stage0")
735715 True
736716 """
737- if stage0 :
738- subdir = "stage0"
739- else :
740- subdir = "ci-rustc"
717+ subdir = "stage0"
741718 return os .path .join (self .build_dir , self .build , subdir )
742719
743720 def get_toml (self , key , section = None ):
@@ -785,37 +762,33 @@ def cargo(self):
785762 """Return config path for cargo"""
786763 return self .program_config ('cargo' )
787764
788- def rustc (self , stage0 ):
765+ def rustc (self ):
789766 """Return config path for rustc"""
790- return self .program_config ('rustc' , stage0 )
767+ return self .program_config ('rustc' )
791768
792769 def rustfmt (self ):
793770 """Return config path for rustfmt"""
794771 if self .stage0_rustfmt is None :
795772 return None
796773 return self .program_config ('rustfmt' )
797774
798- def program_config (self , program , stage0 = True ):
775+ def program_config (self , program ):
799776 """Return config path for the given program at the given stage
800777
801778 >>> rb = RustBuild()
802779 >>> rb.config_toml = 'rustc = "rustc"\\ n'
803780 >>> rb.program_config('rustc')
804781 'rustc'
805782 >>> rb.config_toml = ''
806- >>> cargo_path = rb.program_config('cargo', True)
807- >>> cargo_path.rstrip(".exe") == os.path.join(rb.bin_root(True),
808- ... "bin", "cargo")
809- True
810- >>> cargo_path = rb.program_config('cargo', False)
811- >>> cargo_path.rstrip(".exe") == os.path.join(rb.bin_root(False),
783+ >>> cargo_path = rb.program_config('cargo')
784+ >>> cargo_path.rstrip(".exe") == os.path.join(rb.bin_root(),
812785 ... "bin", "cargo")
813786 True
814787 """
815788 config = self .get_toml (program )
816789 if config :
817790 return os .path .expanduser (config )
818- return os .path .join (self .bin_root (stage0 ), "bin" , "{}{}" .format (
791+ return os .path .join (self .bin_root (), "bin" , "{}{}" .format (
819792 program , self .exe_suffix ()))
820793
821794 @staticmethod
@@ -871,14 +844,14 @@ def build_bootstrap(self):
871844 if "CARGO_BUILD_TARGET" in env :
872845 del env ["CARGO_BUILD_TARGET" ]
873846 env ["CARGO_TARGET_DIR" ] = build_dir
874- env ["RUSTC" ] = self .rustc (True )
875- env ["LD_LIBRARY_PATH" ] = os .path .join (self .bin_root (True ), "lib" ) + \
847+ env ["RUSTC" ] = self .rustc ()
848+ env ["LD_LIBRARY_PATH" ] = os .path .join (self .bin_root (), "lib" ) + \
876849 (os .pathsep + env ["LD_LIBRARY_PATH" ]) \
877850 if "LD_LIBRARY_PATH" in env else ""
878- env ["DYLD_LIBRARY_PATH" ] = os .path .join (self .bin_root (True ), "lib" ) + \
851+ env ["DYLD_LIBRARY_PATH" ] = os .path .join (self .bin_root (), "lib" ) + \
879852 (os .pathsep + env ["DYLD_LIBRARY_PATH" ]) \
880853 if "DYLD_LIBRARY_PATH" in env else ""
881- env ["LIBRARY_PATH" ] = os .path .join (self .bin_root (True ), "lib" ) + \
854+ env ["LIBRARY_PATH" ] = os .path .join (self .bin_root (), "lib" ) + \
882855 (os .pathsep + env ["LIBRARY_PATH" ]) \
883856 if "LIBRARY_PATH" in env else ""
884857
@@ -900,7 +873,7 @@ def build_bootstrap(self):
900873 if self .get_toml ("deny-warnings" , "rust" ) != "false" :
901874 env ["RUSTFLAGS" ] += " -Dwarnings"
902875
903- env ["PATH" ] = os .path .join (self .bin_root (True ), "bin" ) + \
876+ env ["PATH" ] = os .path .join (self .bin_root (), "bin" ) + \
904877 os .pathsep + env ["PATH" ]
905878 if not os .path .isfile (self .cargo ()):
906879 raise Exception ("no cargo executable found at `{}`" .format (
@@ -1172,7 +1145,7 @@ def bootstrap(help_triggered):
11721145 # Fetch/build the bootstrap
11731146 build .download_toolchain ()
11741147 # Download the master compiler if `download-rustc` is set
1175- build .maybe_download_ci_toolchain ()
1148+ # build.maybe_download_ci_toolchain()
11761149 sys .stdout .flush ()
11771150 build .ensure_vendored ()
11781151 build .build_bootstrap ()
0 commit comments