@@ -446,7 +446,7 @@ def __init__(self):
446
446
self .nix_deps_dir = None
447
447
self .rustc_commit = None
448
448
449
- def download_toolchain (self , stage0 = True , rustc_channel = None ):
449
+ def download_toolchain (self , rustc_channel = None ):
450
450
"""Fetch the build system for Rust, written in Rust
451
451
452
452
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):
458
458
"""
459
459
if rustc_channel is None :
460
460
rustc_channel = self .stage0_compiler .version
461
- bin_root = self .bin_root (stage0 )
461
+ bin_root = self .bin_root ()
462
462
463
463
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 )):
469
467
if os .path .exists (bin_root ):
470
468
shutil .rmtree (bin_root )
471
469
tarball_suffix = '.tar.xz' if support_xz () else '.tar.gz'
472
470
filename = "rust-std-{}-{}{}" .format (
473
471
rustc_channel , self .build , tarball_suffix )
474
472
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 )
476
474
filename = "rustc-{}-{}{}" .format (rustc_channel , self .build ,
477
475
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 ))
490
481
491
482
self .fix_bin_or_dylib ("{}/bin/rustc" .format (bin_root ))
492
483
self .fix_bin_or_dylib ("{}/bin/rustdoc" .format (bin_root ))
493
484
lib_dir = "{}/lib" .format (bin_root )
494
485
for lib in os .listdir (lib_dir ):
495
486
if lib .endswith (".so" ):
496
487
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 :
498
489
rust_stamp .write (key )
499
490
500
491
if self .rustfmt () and self .rustfmt ().startswith (bin_root ) and (
@@ -518,24 +509,17 @@ def download_toolchain(self, stage0=True, rustc_channel=None):
518
509
rustfmt_stamp .write (self .stage0_rustfmt .channel ())
519
510
520
511
def _download_component_helper (
521
- self , filename , pattern , tarball_suffix , stage0 = True , key = None
512
+ self , filename , pattern , tarball_suffix , key = None
522
513
):
523
514
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
528
516
cache_dst = os .path .join (self .build_dir , "cache" )
529
517
rustc_cache = os .path .join (cache_dst , key )
530
518
if not os .path .exists (rustc_cache ):
531
519
os .makedirs (rustc_cache )
532
520
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 )
539
523
tarball = os .path .join (rustc_cache , filename )
540
524
if not os .path .exists (tarball ):
541
525
get (
@@ -544,9 +528,9 @@ def _download_component_helper(
544
528
tarball ,
545
529
self .checksums_sha256 ,
546
530
verbose = self .verbose ,
547
- do_verify = stage0 ,
531
+ do_verify = True ,
548
532
)
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 )
550
534
551
535
def fix_bin_or_dylib (self , fname ):
552
536
"""Modifies the interpreter section of 'fname' to fix the dynamic linker,
@@ -689,17 +673,15 @@ def maybe_download_ci_toolchain(self):
689
673
# FIXME: support downloading artifacts from the beta channel
690
674
self .download_toolchain (False , "nightly" )
691
675
692
- def rustc_stamp (self , stage0 ):
676
+ def rustc_stamp (self ):
693
677
"""Return the path for .rustc-stamp at the given stage
694
678
695
679
>>> rb = RustBuild()
696
680
>>> 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")
700
682
True
701
683
"""
702
- return os .path .join (self .bin_root (stage0 ), '.rustc-stamp' )
684
+ return os .path .join (self .bin_root (), '.rustc-stamp' )
703
685
704
686
def rustfmt_stamp (self ):
705
687
"""Return the path for .rustfmt-stamp
@@ -709,7 +691,7 @@ def rustfmt_stamp(self):
709
691
>>> rb.rustfmt_stamp() == os.path.join("build", "stage0", ".rustfmt-stamp")
710
692
True
711
693
"""
712
- return os .path .join (self .bin_root (True ), '.rustfmt-stamp' )
694
+ return os .path .join (self .bin_root (), '.rustfmt-stamp' )
713
695
714
696
def program_out_of_date (self , stamp_path , key ):
715
697
"""Check if the given program stamp is out of date"""
@@ -718,26 +700,21 @@ def program_out_of_date(self, stamp_path, key):
718
700
with open (stamp_path , 'r' ) as stamp :
719
701
return key != stamp .read ()
720
702
721
- def bin_root (self , stage0 ):
703
+ def bin_root (self ):
722
704
"""Return the binary root directory for the given stage
723
705
724
706
>>> rb = RustBuild()
725
707
>>> 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")
729
709
True
730
710
731
711
When the 'build' property is given should be a nested directory:
732
712
733
713
>>> rb.build = "devel"
734
- >>> rb.bin_root(True ) == os.path.join("build", "devel", "stage0")
714
+ >>> rb.bin_root() == os.path.join("build", "devel", "stage0")
735
715
True
736
716
"""
737
- if stage0 :
738
- subdir = "stage0"
739
- else :
740
- subdir = "ci-rustc"
717
+ subdir = "stage0"
741
718
return os .path .join (self .build_dir , self .build , subdir )
742
719
743
720
def get_toml (self , key , section = None ):
@@ -785,37 +762,33 @@ def cargo(self):
785
762
"""Return config path for cargo"""
786
763
return self .program_config ('cargo' )
787
764
788
- def rustc (self , stage0 ):
765
+ def rustc (self ):
789
766
"""Return config path for rustc"""
790
- return self .program_config ('rustc' , stage0 )
767
+ return self .program_config ('rustc' )
791
768
792
769
def rustfmt (self ):
793
770
"""Return config path for rustfmt"""
794
771
if self .stage0_rustfmt is None :
795
772
return None
796
773
return self .program_config ('rustfmt' )
797
774
798
- def program_config (self , program , stage0 = True ):
775
+ def program_config (self , program ):
799
776
"""Return config path for the given program at the given stage
800
777
801
778
>>> rb = RustBuild()
802
779
>>> rb.config_toml = 'rustc = "rustc"\\ n'
803
780
>>> rb.program_config('rustc')
804
781
'rustc'
805
782
>>> 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(),
812
785
... "bin", "cargo")
813
786
True
814
787
"""
815
788
config = self .get_toml (program )
816
789
if config :
817
790
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 (
819
792
program , self .exe_suffix ()))
820
793
821
794
@staticmethod
@@ -871,14 +844,14 @@ def build_bootstrap(self):
871
844
if "CARGO_BUILD_TARGET" in env :
872
845
del env ["CARGO_BUILD_TARGET" ]
873
846
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" ) + \
876
849
(os .pathsep + env ["LD_LIBRARY_PATH" ]) \
877
850
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" ) + \
879
852
(os .pathsep + env ["DYLD_LIBRARY_PATH" ]) \
880
853
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" ) + \
882
855
(os .pathsep + env ["LIBRARY_PATH" ]) \
883
856
if "LIBRARY_PATH" in env else ""
884
857
@@ -900,7 +873,7 @@ def build_bootstrap(self):
900
873
if self .get_toml ("deny-warnings" , "rust" ) != "false" :
901
874
env ["RUSTFLAGS" ] += " -Dwarnings"
902
875
903
- env ["PATH" ] = os .path .join (self .bin_root (True ), "bin" ) + \
876
+ env ["PATH" ] = os .path .join (self .bin_root (), "bin" ) + \
904
877
os .pathsep + env ["PATH" ]
905
878
if not os .path .isfile (self .cargo ()):
906
879
raise Exception ("no cargo executable found at `{}`" .format (
@@ -1172,7 +1145,7 @@ def bootstrap(help_triggered):
1172
1145
# Fetch/build the bootstrap
1173
1146
build .download_toolchain ()
1174
1147
# Download the master compiler if `download-rustc` is set
1175
- build .maybe_download_ci_toolchain ()
1148
+ # build.maybe_download_ci_toolchain()
1176
1149
sys .stdout .flush ()
1177
1150
build .ensure_vendored ()
1178
1151
build .build_bootstrap ()
0 commit comments