aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/requirements.txt5
-rw-r--r--python/servo/bootstrap_commands.py30
-rw-r--r--python/servo/devenv_commands.py5
-rw-r--r--python/servo/util.py21
-rw-r--r--support/android/openssl.makefile2
5 files changed, 43 insertions, 20 deletions
diff --git a/python/requirements.txt b/python/requirements.txt
index 502c2821a6b..11d7910b94d 100644
--- a/python/requirements.txt
+++ b/python/requirements.txt
@@ -26,4 +26,9 @@ colorama == 0.3.7
# For package uploading
boto3 == 1.4.4
+# Default root CAs on Windows CI do not trust CloudFront certificates,
+# connecting to https://static.rust-lang.org would fail:
+# https://github.com/servo/servo/pull/18942
+certifi
+
-e python/tidy
diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py
index 5d09fadb806..aa64060ecaa 100644
--- a/python/servo/bootstrap_commands.py
+++ b/python/servo/bootstrap_commands.py
@@ -29,6 +29,7 @@ from mach.decorators import (
import servo.bootstrap as bootstrap
from servo.command_base import CommandBase, BIN_SUFFIX, cd
from servo.util import delete, download_bytes, download_file, extract, host_triple
+from servo.util import STATIC_RUST_LANG_ORG_DIST, URLOPEN_KWARGS
@CommandProvider
@@ -71,7 +72,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,16 +89,16 @@ 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
+ 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())
- nightly_commit_hash = toml.load(urllib2.urlopen(channel))["pkg"]["rustc"]["git_commit_hash"]
+ channel = nightly_dist + "/channel-rust-nightly.toml"
+ manifest = toml.load(urllib2.urlopen(channel, **URLOPEN_KWARGS))
+ nightly_commit_hash = manifest["pkg"]["rustc"]["git_commit_hash"]
- base_url = "https://s3.amazonaws.com/rust-lang-ci/rustc-builds"
- if not self.config["build"]["llvm-assertions"]:
- base_url += "-alt"
- base_url += "/" + nightly_commit_hash
+ base_url = "https://s3.amazonaws.com/rust-lang-ci/rustc-builds-alt/" + nightly_commit_hash
rustc_url = base_url + "/rustc-%s-%s.tar.gz" % (version, host_triple())
tgz_file = rust_dir + '-rustc.tar.gz'
@@ -131,9 +133,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)
@@ -168,8 +170,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)
@@ -203,8 +206,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)
diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py
index 5e951bec8cd..e6cb91bd20a 100644
--- a/python/servo/devenv_commands.py
+++ b/python/servo/devenv_commands.py
@@ -23,6 +23,7 @@ from mach.decorators import (
from servo.command_base import CommandBase, cd, call
from servo.build_commands import notify_build_done
+from servo.util import STATIC_RUST_LANG_ORG_DIST, URLOPEN_KWARGS
@CommandProvider
@@ -262,8 +263,8 @@ class MachCommands(CommandBase):
description='Update the Rust version to latest Nightly',
category='devenv')
def rustup(self):
- url = "https://static-rust-lang-org.s3.amazonaws.com/dist/channel-rust-nightly-date.txt"
- nightly_date = urllib2.urlopen(url).read()
+ url = STATIC_RUST_LANG_ORG_DIST + "/channel-rust-nightly-date.txt"
+ nightly_date = urllib2.urlopen(url, **URLOPEN_KWARGS).read()
filename = path.join(self.context.topdir, "rust-toolchain")
with open(filename, "w") as f:
f.write("nightly-%s\n" % nightly_date)
diff --git a/python/servo/util.py b/python/servo/util.py
index 0a74f9fe7f1..78158b840da 100644
--- a/python/servo/util.py
+++ b/python/servo/util.py
@@ -19,6 +19,21 @@ import sys
import tarfile
import zipfile
import urllib2
+import certifi
+
+
+try:
+ from ssl import HAS_SNI
+except ImportError:
+ HAS_SNI = False
+
+# The cafile parameter was added in 2.7.9
+if HAS_SNI and sys.version_info >= (2, 7, 9):
+ STATIC_RUST_LANG_ORG_DIST = "https://static.rust-lang.org/dist"
+ URLOPEN_KWARGS = {"cafile": certifi.where()}
+else:
+ STATIC_RUST_LANG_ORG_DIST = "https://static-rust-lang-org.s3.amazonaws.com/dist"
+ URLOPEN_KWARGS = {}
def delete(path):
@@ -64,16 +79,16 @@ def host_triple():
def download(desc, src, writer, start_byte=0):
if start_byte:
- print("Resuming download of {}...".format(desc))
+ print("Resuming download of {} ...".format(src))
else:
- print("Downloading {}...".format(desc))
+ print("Downloading {} ...".format(src))
dumb = (os.environ.get("TERM") == "dumb") or (not sys.stdout.isatty())
try:
req = urllib2.Request(src)
if start_byte:
req = urllib2.Request(src, headers={'Range': 'bytes={}-'.format(start_byte)})
- resp = urllib2.urlopen(req)
+ resp = urllib2.urlopen(req, **URLOPEN_KWARGS)
fsize = None
if resp.info().getheader('Content-Length'):
diff --git a/support/android/openssl.makefile b/support/android/openssl.makefile
index cfa720d2c3a..1e3ec330b64 100644
--- a/support/android/openssl.makefile
+++ b/support/android/openssl.makefile
@@ -10,5 +10,5 @@ openssl-${OPENSSL_VERSION}/libssl.so: openssl-${OPENSSL_VERSION}/Configure
./openssl.sh ${ANDROID_NDK} ${OPENSSL_VERSION}
openssl-${OPENSSL_VERSION}/Configure:
- URL=https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/openssl-${OPENSSL_VERSION}.tar.gz; \
+ URL=https://s3.amazonaws.com/servo-deps/android-deps/openssl-${OPENSSL_VERSION}.tar.gz; \
curl $$URL | tar xzf -