From cef92a2050fae29d7ae810da43d387ee57b00273 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 2 Jan 2020 13:56:16 +0100 Subject: [PATCH 01/12] Mach: rename default_toolchain to rust_toolchain --- python/servo/bootstrap_commands.py | 3 +-- python/servo/build_commands.py | 2 +- python/servo/command_base.py | 15 ++++++--------- python/servo/post_build_commands.py | 5 ++--- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py index 835c7bf21c2..b8a88314609 100644 --- a/python/servo/bootstrap_commands.py +++ b/python/servo/bootstrap_commands.py @@ -281,8 +281,7 @@ class MachCommands(CommandBase): default='1', help='Keep up to this many most recent nightlies') def clean_nightlies(self, force=False, keep=None): - default_toolchain = self.default_toolchain() - print("Current Rust version for Servo: {}".format(default_toolchain)) + print("Current Rust version for Servo: {}".format(self.rust_toolchain())) old_toolchains = [] keep = int(keep) stdout = subprocess.check_output(['git', 'log', '--format=%H', 'rust-toolchain']) diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index 4630c9a9dbf..b9d2a90ad79 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -243,7 +243,7 @@ class MachCommands(CommandBase): self.call_rustup_run(["rustc", "--version"]) check_call(["rustup" + BIN_SUFFIX, "target", "add", - "--toolchain", self.toolchain(), target]) + "--toolchain", self.rust_toolchain(), target]) env = self.build_env(target=target, is_build=True, uwp=uwp, features=features) self.ensure_bootstrapped(target=target) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 371eb9844a2..43e993f0907 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -345,17 +345,14 @@ class CommandBase(object): # Set default android target self.handle_android_target("armv7-linux-androideabi") - _default_toolchain = None + _rust_toolchain = None - def toolchain(self): - return self.default_toolchain() - - def default_toolchain(self): - if self._default_toolchain is None: + def rust_toolchain(self): + if self._rust_toolchain is None: filename = path.join(self.context.topdir, "rust-toolchain") with open(filename) as f: - self._default_toolchain = f.read().strip() - return self._default_toolchain + self._rust_toolchain = f.read().strip() + return self._rust_toolchain def call_rustup_run(self, args, **kwargs): if self.config["tools"]["use-rustup"]: @@ -373,7 +370,7 @@ class CommandBase(object): print("rustup is at version %s.%s.%s, Servo requires 1.11.0 or more recent." % version) print("Try running 'rustup self update'.") return 1 - toolchain = self.toolchain() + toolchain = self.rust_toolchain() if platform.system() == "Windows": toolchain += "-x86_64-pc-windows-msvc" args = ["rustup" + BIN_SUFFIX, "run", "--install", toolchain] + args diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py index a6ab4de647c..18b43a1afe0 100644 --- a/python/servo/post_build_commands.py +++ b/python/servo/post_build_commands.py @@ -241,9 +241,8 @@ class PostBuildCommands(CommandBase): @CommandBase.build_like_command_arguments def doc(self, params, features, target=None, android=False, magicleap=False, media_stack=None, **kwargs): - env = os.environ.copy() - env["RUSTUP_TOOLCHAIN"] = self.toolchain() - rustc_path = check_output(["rustup" + BIN_SUFFIX, "which", "rustc"], env=env) + rustc_path = check_output( + ["rustup" + BIN_SUFFIX, "which", "--toolchain", self.rust_toolchain(), "rustc"]) assert path.basename(path.dirname(rustc_path)) == "bin" toolchain_path = path.dirname(path.dirname(rustc_path)) rust_docs = path.join(toolchain_path, "share", "doc", "rust", "html") From e56e49e98fe4f0056c4f7915d9de6e998c056624 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 2 Jan 2020 14:20:20 +0100 Subject: [PATCH 02/12] mach: run `rustup target add` in `ensure_bootstrapped` --- python/servo/build_commands.py | 10 +--------- python/servo/command_base.py | 9 +++++++++ python/servo/devenv_commands.py | 2 +- python/servo/post_build_commands.py | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index b9d2a90ad79..2aa70862fd6 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -30,7 +30,7 @@ from mach.decorators import ( from mach.registrar import Registrar from mach_bootstrap import _get_exec_path -from servo.command_base import CommandBase, cd, call, check_call, BIN_SUFFIX, append_to_path_env, gstreamer_root +from servo.command_base import CommandBase, cd, call, check_call, append_to_path_env, gstreamer_root from servo.util import host_triple @@ -237,14 +237,6 @@ class MachCommands(CommandBase): if very_verbose: opts += ["-vv"] - if target: - if self.config["tools"]["use-rustup"] and not uwp: - # 'rustup target add' fails if the toolchain is not installed at all. - self.call_rustup_run(["rustc", "--version"]) - - check_call(["rustup" + BIN_SUFFIX, "target", "add", - "--toolchain", self.rust_toolchain(), target]) - env = self.build_env(target=target, is_build=True, uwp=uwp, features=features) self.ensure_bootstrapped(target=target) self.ensure_clobbered() diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 43e993f0907..e1edecd957a 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -1016,6 +1016,15 @@ install them, let us know by filing a bug!") if "msvc" in target_platform: Registrar.dispatch("bootstrap", context=self.context) + if target: + if self.config["tools"]["use-rustup"] and not "uwp" in target: + # 'rustup target add' fails if the toolchain is not installed at all. + self.call_rustup_run(["rustc", "--version"]) + + check_call(["rustup" + BIN_SUFFIX, "target", "add", + "--toolchain", self.rust_toolchain(), target]) + + self.context.bootstrapped = True def ensure_clobbered(self, target_dir=None): diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py index 45a3f946f38..658ef547f21 100644 --- a/python/servo/devenv_commands.py +++ b/python/servo/devenv_commands.py @@ -49,7 +49,7 @@ class MachCommands(CommandBase): features += self.pick_media_stack(media_stack, target) - self.ensure_bootstrapped() + self.ensure_bootstrapped(target=target) self.ensure_clobbered() env = self.build_env() diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py index 18b43a1afe0..941999fdc0b 100644 --- a/python/servo/post_build_commands.py +++ b/python/servo/post_build_commands.py @@ -241,13 +241,13 @@ class PostBuildCommands(CommandBase): @CommandBase.build_like_command_arguments def doc(self, params, features, target=None, android=False, magicleap=False, media_stack=None, **kwargs): + self.ensure_bootstrapped() rustc_path = check_output( ["rustup" + BIN_SUFFIX, "which", "--toolchain", self.rust_toolchain(), "rustc"]) assert path.basename(path.dirname(rustc_path)) == "bin" toolchain_path = path.dirname(path.dirname(rustc_path)) rust_docs = path.join(toolchain_path, "share", "doc", "rust", "html") - self.ensure_bootstrapped() docs = path.join(self.get_target_dir(), "doc") if not path.exists(docs): os.makedirs(docs) From d4da65d1497d6567415573117f7e0151e5c16050 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 2 Jan 2020 14:21:58 +0100 Subject: [PATCH 03/12] mach: on Windows, opt into MSVC target for all uses of `rust_toolchain()` --- python/servo/command_base.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index e1edecd957a..283a741aee3 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -352,6 +352,10 @@ class CommandBase(object): filename = path.join(self.context.topdir, "rust-toolchain") with open(filename) as f: self._rust_toolchain = f.read().strip() + + if platform.system() == "Windows": + self._rust_toolchain += "-x86_64-pc-windows-msvc" + return self._rust_toolchain def call_rustup_run(self, args, **kwargs): @@ -370,10 +374,7 @@ class CommandBase(object): print("rustup is at version %s.%s.%s, Servo requires 1.11.0 or more recent." % version) print("Try running 'rustup self update'.") return 1 - toolchain = self.rust_toolchain() - if platform.system() == "Windows": - toolchain += "-x86_64-pc-windows-msvc" - args = ["rustup" + BIN_SUFFIX, "run", "--install", toolchain] + args + args = ["rustup" + BIN_SUFFIX, "run", "--install", self.rust_toolchain()] + args else: args[0] += BIN_SUFFIX return call(args, **kwargs) From 855601ebb47282c1e3a2389979b7cae8247b3f69 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 2 Jan 2020 14:28:57 +0100 Subject: [PATCH 04/12] mach: check rustup version in `ensure_bootstrapped()` --- python/servo/command_base.py | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 283a741aee3..02c4b25c4cf 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -360,20 +360,7 @@ class CommandBase(object): def call_rustup_run(self, args, **kwargs): if self.config["tools"]["use-rustup"]: - try: - version_line = subprocess.check_output(["rustup" + BIN_SUFFIX, "--version"]) - except OSError as e: - if e.errno == NO_SUCH_FILE_OR_DIRECTORY: - print("It looks like rustup is not installed. See instructions at " - "https://github.com/servo/servo/#setting-up-your-environment") - print() - return 1 - raise - version = tuple(map(int, re.match(b"rustup (\d+)\.(\d+)\.(\d+)", version_line).groups())) - if version < (1, 11, 0): - print("rustup is at version %s.%s.%s, Servo requires 1.11.0 or more recent." % version) - print("Try running 'rustup self update'.") - return 1 + self.ensure_rustup_version() args = ["rustup" + BIN_SUFFIX, "run", "--install", self.rust_toolchain()] + args else: args[0] += BIN_SUFFIX @@ -1017,8 +1004,9 @@ install them, let us know by filing a bug!") if "msvc" in target_platform: Registrar.dispatch("bootstrap", context=self.context) - if target: - if self.config["tools"]["use-rustup"] and not "uwp" in target: + if self.config["tools"]["use-rustup"]: + self.ensure_rustup_version() + if target and "uwp" not in target: # 'rustup target add' fails if the toolchain is not installed at all. self.call_rustup_run(["rustc", "--version"]) @@ -1028,6 +1016,22 @@ install them, let us know by filing a bug!") self.context.bootstrapped = True + def ensure_rustup_version(self): + try: + version_line = subprocess.check_output(["rustup" + BIN_SUFFIX, "--version"]) + except OSError as e: + if e.errno == NO_SUCH_FILE_OR_DIRECTORY: + print("It looks like rustup is not installed. See instructions at " + "https://github.com/servo/servo/#setting-up-your-environment") + print() + return 1 + raise + version = tuple(map(int, re.match(b"rustup (\d+)\.(\d+)\.(\d+)", version_line).groups())) + if version < (1, 11, 0): + print("rustup is at version %s.%s.%s, Servo requires 1.11.0 or more recent." % version) + print("Try running 'rustup self update'.") + return 1 + def ensure_clobbered(self, target_dir=None): if target_dir is None: target_dir = self.get_target_dir() From e96bcea669d9c21db8c0b171a6fe4582bbbd6144 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 2 Jan 2020 14:40:03 +0100 Subject: [PATCH 05/12] mach: explicitly install the toolchain and target in `ensure_bootstrapped` --- python/servo/command_base.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 02c4b25c4cf..23bb48050d2 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -1006,13 +1006,15 @@ install them, let us know by filing a bug!") if self.config["tools"]["use-rustup"]: self.ensure_rustup_version() - if target and "uwp" not in target: - # 'rustup target add' fails if the toolchain is not installed at all. - self.call_rustup_run(["rustc", "--version"]) + toolchain = self.rust_toolchain() - check_call(["rustup" + BIN_SUFFIX, "target", "add", - "--toolchain", self.rust_toolchain(), target]) + if toolchain not in check_output(["rustup", "toolchain", "list"]): + check_call(["rustup", "toolchain", "install", toolchain]) + if target and "uwp" not in target and target not in check_output( + ["rustup", "target", "list", "--installed", "--toolchain", toolchain] + ): + check_call(["rustup", "target", "add", "--toolchain", toolchain, target]) self.context.bootstrapped = True From 6f70a9c1de649ce38e014eaa8fa3b22f862768a9 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 2 Jan 2020 14:48:13 +0100 Subject: [PATCH 06/12] mach: always call `ensure_bootstrapped` before `call_rustup_run` --- python/servo/command_base.py | 2 +- python/servo/testing_commands.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 23bb48050d2..f8c1bcb0610 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -360,7 +360,7 @@ class CommandBase(object): def call_rustup_run(self, args, **kwargs): if self.config["tools"]["use-rustup"]: - self.ensure_rustup_version() + assert self.context.bootstrapped args = ["rustup" + BIN_SUFFIX, "run", "--install", self.rust_toolchain()] + args else: args[0] += BIN_SUFFIX diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 0c107a1867b..c874d5ed26e 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -310,6 +310,7 @@ class MachCommands(CommandBase): return 0 def install_rustfmt(self): + self.ensure_bootstrapped() with open(os.devnull, "w") as devnull: if self.call_rustup_run(["cargo", "fmt", "--version", "-q"], stderr=devnull) != 0: From 1110cac184d15ba24f8f94cb21e258de4ba5be76 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 2 Jan 2020 15:27:25 +0100 Subject: [PATCH 07/12] mach + rustup: use the minimal profile and install rustc-dev --- etc/taskcluster/decision_task.py | 24 +++--------------------- etc/taskcluster/decisionlib.py | 1 + etc/taskcluster/docker/build.dockerfile | 3 ++- python/servo/command_base.py | 9 +++++++-- python/servo/devenv_commands.py | 4 ++-- 5 files changed, 15 insertions(+), 26 deletions(-) diff --git a/etc/taskcluster/decision_task.py b/etc/taskcluster/decision_task.py index a3d70653794..414b129405d 100644 --- a/etc/taskcluster/decision_task.py +++ b/etc/taskcluster/decision_task.py @@ -181,9 +181,6 @@ def linux_tidy_unit_untrusted(): .with_dockerfile(dockerfile_path("build")) .with_env(**build_env, **unix_build_env, **linux_build_env) .with_repo_bundle() - .with_script("rustup set profile minimal") - # required by components/script_plugins: - .with_script("rustup component add rustc-dev") .with_script(""" ./mach test-tidy --no-progress --all ./mach test-tidy --no-progress --self-test @@ -304,11 +301,10 @@ def with_rust_nightly(): modified_build_env["RUSTFLAGS"] = " ".join(flags) return ( - linux_build_task("with Rust Nightly", build_env=modified_build_env, install_rustc_dev=False) + linux_build_task("with Rust Nightly", build_env=modified_build_env) .with_treeherder("Linux x64", "RustNightly") .with_script(""" echo "nightly" > rust-toolchain - rustup component add rustc-dev ./mach build --dev ./mach test-unit """) @@ -850,7 +846,7 @@ def macos_task(name): ) -def linux_build_task(name, *, build_env=build_env, install_rustc_dev=True): +def linux_build_task(name, *, build_env=build_env): task = ( linux_task(name) # https://docs.taskcluster.net/docs/reference/workers/docker-worker/docs/caches @@ -867,14 +863,8 @@ def linux_build_task(name, *, build_env=build_env, install_rustc_dev=True): .with_dockerfile(dockerfile_path("build")) .with_env(**build_env, **unix_build_env, **linux_build_env) .with_repo_bundle() - .with_script(""" - rustup set profile minimal - ./mach bootstrap-gstreamer - """) + .with_script("./mach bootstrap-gstreamer") ) - if install_rustc_dev: - # required by components/script_plugins: - task = task.with_script("rustup component add rustc-dev") return task @@ -920,9 +910,6 @@ def windows_build_task(name, package=True, arch="x86_64"): path="python3", ) .with_rustup() - .with_script("rustup set profile minimal") - # required by components/script_plugins: - .with_script("rustup component add rustc-dev") ) if arch in hashes["non-devel"] and arch in hashes["devel"]: task = ( @@ -968,11 +955,6 @@ def macos_build_task(name): .with_repo_bundle(alternate_object_dir="/var/cache/servo.git/objects") .with_python2() .with_rustup() - # Since macOS workers are long-lived and ~/.rustup kept across tasks: - .with_script("rustup self update") - .with_script("rustup set profile minimal") - # required by components/script_plugins: - .with_script("rustup component add rustc-dev") .with_index_and_artifacts_expire_in(build_artifacts_expire_in) # Debugging for surprising generic-worker behaviour .with_early_script("ls") diff --git a/etc/taskcluster/decisionlib.py b/etc/taskcluster/decisionlib.py index b8d878da9d8..2dca9e882ac 100644 --- a/etc/taskcluster/decisionlib.py +++ b/etc/taskcluster/decisionlib.py @@ -693,6 +693,7 @@ class MacOsGenericWorkerTask(UnixTaskMixin, GenericWorkerTask): return self.with_early_script(""" export PATH="$HOME/.cargo/bin:$PATH" which rustup || curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y + rustup self update """) diff --git a/etc/taskcluster/docker/build.dockerfile b/etc/taskcluster/docker/build.dockerfile index c5e148c4df3..e5a1edafc4a 100644 --- a/etc/taskcluster/docker/build.dockerfile +++ b/etc/taskcluster/docker/build.dockerfile @@ -44,7 +44,8 @@ RUN \ # && \ # - # + # Install the version of rustup that is current when this Docker image is being built: + # We want at least 1.21 (increment in this comment to force an image rebuild). curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none --profile=minimal -y && \ # # diff --git a/python/servo/command_base.py b/python/servo/command_base.py index f8c1bcb0610..f42a36fc738 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -1009,7 +1009,12 @@ install them, let us know by filing a bug!") toolchain = self.rust_toolchain() if toolchain not in check_output(["rustup", "toolchain", "list"]): - check_call(["rustup", "toolchain", "install", toolchain]) + check_call(["rustup", "toolchain", "install", "--profile", "minimal", toolchain]) + + if "rustc-dev" not in check_output( + ["rustup", "component", "list", "--installed", "--toolchain", toolchain] + ): + check_call(["rustup", "component", "add", "--toolchain", toolchain, "rustc-dev"]) if target and "uwp" not in target and target not in check_output( ["rustup", "target", "list", "--installed", "--toolchain", toolchain] @@ -1029,7 +1034,7 @@ install them, let us know by filing a bug!") return 1 raise version = tuple(map(int, re.match(b"rustup (\d+)\.(\d+)\.(\d+)", version_line).groups())) - if version < (1, 11, 0): + if version < (1, 21, 0): print("rustup is at version %s.%s.%s, Servo requires 1.11.0 or more recent." % version) print("Try running 'rustup self update'.") return 1 diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py index 658ef547f21..bc715205523 100644 --- a/python/servo/devenv_commands.py +++ b/python/servo/devenv_commands.py @@ -24,7 +24,7 @@ from mach.decorators import ( Command, ) -from servo.command_base import CommandBase, cd, call, BIN_SUFFIX +from servo.command_base import CommandBase, cd, call from servo.build_commands import notify_build_done from servo.util import get_static_rust_lang_org_dist, get_urlopen_kwargs @@ -213,7 +213,7 @@ class MachCommands(CommandBase): filename = path.join(self.context.topdir, "rust-toolchain") with open(filename, "w") as f: f.write(toolchain + "\n") - return call(["rustup" + BIN_SUFFIX, "component", "add", "rustc-dev"]) + self.ensure_bootstrapped() @Command('fetch', description='Fetch Rust, Cargo and Cargo dependencies', From f93c03cda345fb746ff3bb5b92b86536a0ee9236 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 2 Jan 2020 15:38:32 +0100 Subject: [PATCH 08/12] Install `rust-docs` rustup component in `./mach doc` --- etc/taskcluster/decision_task.py | 1 - python/servo/command_base.py | 10 ++++++---- python/servo/post_build_commands.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/etc/taskcluster/decision_task.py b/etc/taskcluster/decision_task.py index 414b129405d..cd452410876 100644 --- a/etc/taskcluster/decision_task.py +++ b/etc/taskcluster/decision_task.py @@ -226,7 +226,6 @@ def linux_docs_check(): linux_build_task("Docs + check") .with_treeherder("Linux x64", "Doc+Check") .with_script(""" - rustup component add rust-docs RUSTDOCFLAGS="--disable-minification" ./mach doc ( cd target/doc diff --git a/python/servo/command_base.py b/python/servo/command_base.py index f42a36fc738..c32219c184d 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -994,7 +994,7 @@ install them, let us know by filing a bug!") return True return False - def ensure_bootstrapped(self, target=None): + def ensure_bootstrapped(self, target=None, rustup_components=None): if self.context.bootstrapped: return @@ -1011,10 +1011,12 @@ install them, let us know by filing a bug!") if toolchain not in check_output(["rustup", "toolchain", "list"]): check_call(["rustup", "toolchain", "install", "--profile", "minimal", toolchain]) - if "rustc-dev" not in check_output( + installed = check_output( ["rustup", "component", "list", "--installed", "--toolchain", toolchain] - ): - check_call(["rustup", "component", "add", "--toolchain", toolchain, "rustc-dev"]) + ) + for component in set(rustup_components or []) | {"rustc-dev"}: + if component not in installed: + check_call(["rustup", "component", "add", "--toolchain", toolchain, component]) if target and "uwp" not in target and target not in check_output( ["rustup", "target", "list", "--installed", "--toolchain", toolchain] diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py index 941999fdc0b..0311350e273 100644 --- a/python/servo/post_build_commands.py +++ b/python/servo/post_build_commands.py @@ -241,7 +241,7 @@ class PostBuildCommands(CommandBase): @CommandBase.build_like_command_arguments def doc(self, params, features, target=None, android=False, magicleap=False, media_stack=None, **kwargs): - self.ensure_bootstrapped() + self.ensure_bootstrapped(rustup_components=["rust-docs"]) rustc_path = check_output( ["rustup" + BIN_SUFFIX, "which", "--toolchain", self.rust_toolchain(), "rustc"]) assert path.basename(path.dirname(rustc_path)) == "bin" From 56895198f418bbb366aac439eec1e6f999902f0f Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 2 Jan 2020 15:51:24 +0100 Subject: [PATCH 09/12] Add timing for Android CI bootstrap --- etc/taskcluster/decision_task.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/taskcluster/decision_task.py b/etc/taskcluster/decision_task.py index cd452410876..6f8d41e3cb8 100644 --- a/etc/taskcluster/decision_task.py +++ b/etc/taskcluster/decision_task.py @@ -873,9 +873,9 @@ def android_build_task(name): # file: NDK parses $(file $SHELL) to tell x64 host from x86 # wget: servo-media-gstreamer’s build script .with_script(""" - apt-get update -q - apt-get install -y --no-install-recommends openjdk-8-jdk-headless file wget - ./mach bootstrap-android --accept-all-licences --build + time apt-get update -q + time apt-get install -y --no-install-recommends openjdk-8-jdk-headless file wget + time ./mach bootstrap-android --accept-all-licences --build """) ) From 895cf695c440d7369255e92c9a0771b3bb0a0988 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 2 Jan 2020 16:44:17 +0100 Subject: [PATCH 10/12] Fix a Python 3 warning ``` /home/simon/projects/servo/python/servo/testing_commands.py:301: SyntaxWarning: "is not" with a literal. Did you mean "!="? if err is not 0: ``` --- python/servo/testing_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index c874d5ed26e..dad2af0aa04 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -298,7 +298,7 @@ class MachCommands(CommandBase): args += ["--", "--nocapture"] err = self.run_cargo_build_like_command("bench" if bench else "test", args, env=env, **kwargs) - if err is not 0: + if err: return err @Command('test-content', From 1d3fdc471e19a44d69526b9d94e5a13550b2d1a4 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 2 Jan 2020 17:02:12 +0100 Subject: [PATCH 11/12] =?UTF-8?q?Fix=20Python=203=20support=20in=20mach?= =?UTF-8?q?=E2=80=99s=20`ensure=5Fbootstrapped`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/servo/command_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index c32219c184d..ee6ee0e450d 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -1008,14 +1008,14 @@ install them, let us know by filing a bug!") self.ensure_rustup_version() toolchain = self.rust_toolchain() - if toolchain not in check_output(["rustup", "toolchain", "list"]): + if toolchain.encode("utf-8") not in check_output(["rustup", "toolchain", "list"]): check_call(["rustup", "toolchain", "install", "--profile", "minimal", toolchain]) installed = check_output( ["rustup", "component", "list", "--installed", "--toolchain", toolchain] ) for component in set(rustup_components or []) | {"rustc-dev"}: - if component not in installed: + if component.encode("utf-8") not in installed: check_call(["rustup", "component", "add", "--toolchain", toolchain, component]) if target and "uwp" not in target and target not in check_output( From 8fc072a375378dcc73d2e348d8e46a4d735e6210 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 2 Jan 2020 19:25:01 +0100 Subject: [PATCH 12/12] =?UTF-8?q?Don=E2=80=99t=20run=20`ensure=5Fbootstrap?= =?UTF-8?q?ped`=20when=20rustup=20is=20not=20used=20at=20all.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linux WPT tasks on our CI don’t have rustup installed. --- python/servo/testing_commands.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index dad2af0aa04..bc29955fd79 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -199,7 +199,6 @@ class MachCommands(CommandBase): def test_perf(self, base=None, date=None, submit=False): self.set_software_rendering_env(True, False) - self.ensure_bootstrapped() env = self.build_env() cmd = ["bash", "test_perf.sh"] if base: @@ -370,8 +369,6 @@ class MachCommands(CommandBase): @CommandArgument('tests', default=None, nargs="...", help="Specific tests to run, relative to the tests directory") def test_webidl(self, quiet, tests): - self.ensure_bootstrapped() - test_file_dir = path.abspath(path.join(PROJECT_TOPLEVEL_PATH, "components", "script", "dom", "bindings", "codegen", "parser")) # For the `import WebIDL` in runtests.py @@ -389,7 +386,6 @@ class MachCommands(CommandBase): category='testing', parser=create_parser_wpt) def test_wpt_failure(self, **kwargs): - self.ensure_bootstrapped() kwargs["pause_after_test"] = False kwargs["include"] = ["infrastructure/failing-test.html"] return not self._test_wpt(**kwargs) @@ -399,7 +395,6 @@ class MachCommands(CommandBase): category='testing', parser=create_parser_wpt) def test_wpt(self, **kwargs): - self.ensure_bootstrapped() ret = self.run_test_list_or_dispatch(kwargs["test_list"], "wpt", self._test_wpt, **kwargs) if kwargs["always_succeed"]: return 0 @@ -499,7 +494,6 @@ class MachCommands(CommandBase): category='testing', parser=updatecommandline.create_parser()) def update_wpt(self, **kwargs): - self.ensure_bootstrapped() run_file = path.abspath(path.join("tests", "wpt", "update.py")) patch = kwargs.get("patch", False) @@ -717,7 +711,6 @@ class MachCommands(CommandBase): str(c1).ljust(width_col3), str(d1).ljust(width_col4))) def jquery_test_runner(self, cmd, release, dev): - self.ensure_bootstrapped() base_dir = path.abspath(path.join("tests", "jquery")) jquery_dir = path.join(base_dir, "jquery") run_file = path.join(base_dir, "run_jquery.py") @@ -737,7 +730,6 @@ class MachCommands(CommandBase): return call([run_file, cmd, bin_path, base_dir]) def dromaeo_test_runner(self, tests, release, dev): - self.ensure_bootstrapped() base_dir = path.abspath(path.join("tests", "dromaeo")) dromaeo_dir = path.join(base_dir, "dromaeo") run_file = path.join(base_dir, "run_dromaeo.py") @@ -970,8 +962,6 @@ testing/web-platform/mozilla/tests for Servo-only tests""" % reference_path) @CommandArgument('--version', default='2.0.0', help='WebGL conformance suite version') def update_webgl(self, version=None): - self.ensure_bootstrapped() - base_dir = path.abspath(path.join(PROJECT_TOPLEVEL_PATH, "tests", "wpt", "mozilla", "tests", "webgl")) run_file = path.join(base_dir, "tools", "import-conformance-tests.py")