diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2017-10-18 22:50:20 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2017-10-18 22:50:20 +0200 |
commit | 664f2829a9d7e8f5a158111b80e71eb8b830f283 (patch) | |
tree | 1b1cf594de23f12f37c8b39d45f08051267631fa /python/servo/bootstrap_commands.py | |
parent | 1f4c0c63de99ba868816351844b553f805bc1391 (diff) | |
download | servo-664f2829a9d7e8f5a158111b80e71eb8b830f283.tar.gz servo-664f2829a9d7e8f5a158111b80e71eb8b830f283.zip |
Bootstrap from official static.rust-lang.org when SNI is available
Diffstat (limited to 'python/servo/bootstrap_commands.py')
-rw-r--r-- | python/servo/bootstrap_commands.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py index bb5e122dc48..46328563247 100644 --- a/python/servo/bootstrap_commands.py +++ b/python/servo/bootstrap_commands.py @@ -27,7 +27,7 @@ from mach.decorators import ( ) import servo.bootstrap as bootstrap -from servo.command_base import CommandBase, BIN_SUFFIX, cd +from servo.command_base import CommandBase, BIN_SUFFIX, cd, STATIC_RUST_LANG_ORG_DIST from servo.util import delete, download_bytes, download_file, extract, host_triple @@ -71,7 +71,8 @@ class MachCommands(CommandBase): rust_dir = path.join(self.context.sharedir, "rust", self.rust_path()) install_dir = path.join(self.context.sharedir, "rust", self.rust_install_dir()) version = self.rust_stable_version() if stable else "nightly" - static_s3 = "https://static-rust-lang-org.s3.amazonaws.com/dist" + + nightly_dist = STATIC_RUST_LANG_ORG_DIST + "/" + self.rust_nightly_date() if not force and path.exists(path.join(rust_dir, "rustc", "bin", "rustc" + BIN_SUFFIX)): print("Rust compiler already downloaded.", end=" ") @@ -87,15 +88,15 @@ class MachCommands(CommandBase): # giving a directory name that will be the same as the tarball name (rustc is # in that directory). if stable: - base_url = static_s3 - elif not self.config["build"]["llvm-assertions"]: + base_url = STATIC_RUST_LANG_ORG_DIST + elif self.config["build"]["llvm-assertions"]: + base_url = nightly_dist + else: import toml - channel = "%s/%s/channel-rust-nightly.toml" % (static_s3, self.rust_nightly_date()) + channel = nightly_dist + "/channel-rust-nightly.toml" nightly_commit_hash = toml.load(urllib2.urlopen(channel))["pkg"]["rustc"]["git_commit_hash"] base_url = "https://s3.amazonaws.com/rust-lang-ci/rustc-builds-alt/" + nightly_commit_hash - else: - base_url = "%s/%s" % (static_s3, self.rust_nightly_date()) rustc_url = base_url + "/rustc-%s-%s.tar.gz" % (version, host_triple()) tgz_file = rust_dir + '-rustc.tar.gz' @@ -130,9 +131,9 @@ class MachCommands(CommandBase): tarball = "rust-std-%s-%s.tar.gz" % (version, target_triple) tgz_file = path.join(install_dir, tarball) if self.use_stable_rust(): - std_url = static_s3 + "/" + tarball + std_url = STATIC_RUST_LANG_ORG_DIST + "/" + tarball else: - std_url = static_s3 + "/" + self.rust_nightly_date() + "/" + tarball + std_url = nightly_dist + "/" + tarball download_file("Host rust library for target %s" % target_triple, std_url, tgz_file) print("Extracting Rust stdlib for target %s..." % target_triple) @@ -167,8 +168,9 @@ class MachCommands(CommandBase): if path.isdir(docs_dir): shutil.rmtree(docs_dir) docs_name = self.rust_path().replace("rustc-", "rust-docs-") - docs_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/%s/rust-docs-nightly-%s.tar.gz" - % (self.rust_nightly_date(), host_triple())) + docs_url = "%s/%s/rust-docs-nightly-%s.tar.gz" % ( + STATIC_RUST_LANG_ORG_DIST, self.rust_nightly_date(), host_triple() + ) tgz_file = path.join(rust_root, 'doc.tar.gz') download_file("Rust docs", docs_url, tgz_file) @@ -202,8 +204,7 @@ class MachCommands(CommandBase): os.makedirs(cargo_dir) tgz_file = "cargo-nightly-%s.tar.gz" % host_triple() - nightly_url = "https://static-rust-lang-org.s3.amazonaws.com/dist/%s/%s" % \ - (self.rust_nightly_date(), tgz_file) + nightly_url = "%s/%s/%s" % (STATIC_RUST_LANG_ORG_DIST, self.rust_nightly_date(), tgz_file) download_file("Cargo nightly", nightly_url, tgz_file) |