@@ -500,81 +500,6 @@ def download_toolchain(self, stage0=True, rustc_channel=None):
500500 with output (self .rustfmt_stamp ()) as rustfmt_stamp :
501501 rustfmt_stamp .write (self .stage0_rustfmt .channel ())
502502
503- # Avoid downloading LLVM twice (once for stage0 and once for the master rustc)
504- if self .downloading_llvm () and stage0 :
505- # We want the most recent LLVM submodule update to avoid downloading
506- # LLVM more often than necessary.
507- #
508- # This git command finds that commit SHA, looking for bors-authored
509- # commits that modified src/llvm-project or other relevant version
510- # stamp files.
511- #
512- # This works even in a repository that has not yet initialized
513- # submodules.
514- top_level = subprocess .check_output ([
515- "git" , "rev-parse" , "--show-toplevel" ,
516- ]).decode (sys .getdefaultencoding ()).strip ()
517- llvm_sha = subprocess .check_output ([
518- "git" ,
"rev-list" ,
"[email protected] " ,
"-n1" ,
519- "--first-parent" , "HEAD" ,
520- "--" ,
521- "{}/src/llvm-project" .format (top_level ),
522- "{}/src/bootstrap/download-ci-llvm-stamp" .format (top_level ),
523- # the LLVM shared object file is named `LLVM-12-rust-{version}-nightly`
524- "{}/src/version" .format (top_level )
525- ]).decode (sys .getdefaultencoding ()).strip ()
526- llvm_assertions = self .get_toml ('assertions' , 'llvm' ) == 'true'
527- llvm_root = self .llvm_root ()
528- llvm_lib = os .path .join (llvm_root , "lib" )
529- if self .program_out_of_date (self .llvm_stamp (), llvm_sha + str (llvm_assertions )):
530- self ._download_ci_llvm (llvm_sha , llvm_assertions )
531- for binary in ["llvm-config" , "FileCheck" ]:
532- self .fix_bin_or_dylib (os .path .join (llvm_root , "bin" , binary ))
533- for lib in os .listdir (llvm_lib ):
534- if lib .endswith (".so" ):
535- self .fix_bin_or_dylib (os .path .join (llvm_lib , lib ))
536- with output (self .llvm_stamp ()) as llvm_stamp :
537- llvm_stamp .write (llvm_sha + str (llvm_assertions ))
538-
539- def downloading_llvm (self ):
540- opt = self .get_toml ('download-ci-llvm' , 'llvm' )
541- # This is currently all tier 1 targets and tier 2 targets with host tools
542- # (since others may not have CI artifacts)
543- # https://doc.rust-lang.org/rustc/platform-support.html#tier-1
544- supported_platforms = [
545- # tier 1
546- "aarch64-unknown-linux-gnu" ,
547- "i686-pc-windows-gnu" ,
548- "i686-pc-windows-msvc" ,
549- "i686-unknown-linux-gnu" ,
550- "x86_64-unknown-linux-gnu" ,
551- "x86_64-apple-darwin" ,
552- "x86_64-pc-windows-gnu" ,
553- "x86_64-pc-windows-msvc" ,
554- # tier 2 with host tools
555- "aarch64-apple-darwin" ,
556- "aarch64-pc-windows-msvc" ,
557- "aarch64-unknown-linux-musl" ,
558- "arm-unknown-linux-gnueabi" ,
559- "arm-unknown-linux-gnueabihf" ,
560- "armv7-unknown-linux-gnueabihf" ,
561- "mips-unknown-linux-gnu" ,
562- "mips64-unknown-linux-gnuabi64" ,
563- "mips64el-unknown-linux-gnuabi64" ,
564- "mipsel-unknown-linux-gnu" ,
565- "powerpc-unknown-linux-gnu" ,
566- "powerpc64-unknown-linux-gnu" ,
567- "powerpc64le-unknown-linux-gnu" ,
568- "riscv64gc-unknown-linux-gnu" ,
569- "s390x-unknown-linux-gnu" ,
570- "x86_64-unknown-freebsd" ,
571- "x86_64-unknown-illumos" ,
572- "x86_64-unknown-linux-musl" ,
573- "x86_64-unknown-netbsd" ,
574- ]
575- return opt == "true" \
576- or (opt == "if-available" and self .build in supported_platforms )
577-
578503 def _download_component_helper (
579504 self , filename , pattern , tarball_suffix , stage0 = True , key = None
580505 ):
@@ -606,53 +531,6 @@ def _download_component_helper(
606531 )
607532 unpack (tarball , tarball_suffix , self .bin_root (stage0 ), match = pattern , verbose = self .verbose )
608533
609- def _download_ci_llvm (self , llvm_sha , llvm_assertions ):
610- if not llvm_sha :
611- print ("error: could not find commit hash for downloading LLVM" )
612- print ("help: maybe your repository history is too shallow?" )
613- print ("help: consider disabling `download-ci-llvm`" )
614- print ("help: or fetch enough history to include one upstream commit" )
615- exit (1 )
616- cache_prefix = "llvm-{}-{}" .format (llvm_sha , llvm_assertions )
617- cache_dst = os .path .join (self .build_dir , "cache" )
618- rustc_cache = os .path .join (cache_dst , cache_prefix )
619- if not os .path .exists (rustc_cache ):
620- os .makedirs (rustc_cache )
621-
622- base = "https://ci-artifacts.rust-lang.org"
623- url = "rustc-builds/{}" .format (llvm_sha )
624- if llvm_assertions :
625- url = url .replace ('rustc-builds' , 'rustc-builds-alt' )
626- # ci-artifacts are only stored as .xz, not .gz
627- if not support_xz ():
628- print ("error: XZ support is required to download LLVM" )
629- print ("help: consider disabling `download-ci-llvm` or using python3" )
630- exit (1 )
631- tarball_suffix = '.tar.xz'
632- filename = "rust-dev-nightly-" + self .build + tarball_suffix
633- tarball = os .path .join (rustc_cache , filename )
634- if not os .path .exists (tarball ):
635- help_on_error = "error: failed to download llvm from ci"
636- help_on_error += "\n help: old builds get deleted after a certain time"
637- help_on_error += "\n help: if trying to compile an old commit of rustc,"
638- help_on_error += " disable `download-ci-llvm` in config.toml:"
639- help_on_error += "\n "
640- help_on_error += "\n [llvm]"
641- help_on_error += "\n download-ci-llvm = false"
642- help_on_error += "\n "
643- get (
644- base ,
645- "{}/{}" .format (url , filename ),
646- tarball ,
647- self .checksums_sha256 ,
648- verbose = self .verbose ,
649- do_verify = False ,
650- help_on_error = help_on_error ,
651- )
652- unpack (tarball , tarball_suffix , self .llvm_root (),
653- match = "rust-dev" ,
654- verbose = self .verbose )
655-
656534 def fix_bin_or_dylib (self , fname ):
657535 """Modifies the interpreter section of 'fname' to fix the dynamic linker,
658536 or the RPATH section, to fix the dynamic library search path
@@ -816,17 +694,6 @@ def rustfmt_stamp(self):
816694 """
817695 return os .path .join (self .bin_root (True ), '.rustfmt-stamp' )
818696
819- def llvm_stamp (self ):
820- """Return the path for .llvm-stamp
821-
822- >>> rb = RustBuild()
823- >>> rb.build_dir = "build"
824- >>> rb.llvm_stamp() == os.path.join("build", "ci-llvm", ".llvm-stamp")
825- True
826- """
827- return os .path .join (self .llvm_root (), '.llvm-stamp' )
828-
829-
830697 def program_out_of_date (self , stamp_path , key ):
831698 """Check if the given program stamp is out of date"""
832699 if not os .path .exists (stamp_path ) or self .clean :
@@ -856,22 +723,6 @@ def bin_root(self, stage0):
856723 subdir = "ci-rustc"
857724 return os .path .join (self .build_dir , self .build , subdir )
858725
859- def llvm_root (self ):
860- """Return the CI LLVM root directory
861-
862- >>> rb = RustBuild()
863- >>> rb.build_dir = "build"
864- >>> rb.llvm_root() == os.path.join("build", "ci-llvm")
865- True
866-
867- When the 'build' property is given should be a nested directory:
868-
869- >>> rb.build = "devel"
870- >>> rb.llvm_root() == os.path.join("build", "devel", "ci-llvm")
871- True
872- """
873- return os .path .join (self .build_dir , self .build , "ci-llvm" )
874-
875726 def get_toml (self , key , section = None ):
876727 """Returns the value of the given key in config.toml, otherwise returns None
877728
0 commit comments