aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/bootstrap_commands.py
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2023-08-01 16:44:57 +0200
committerGitHub <noreply@github.com>2023-08-01 14:44:57 +0000
commitfef332f38552ae8af83cf69993dd6aabdebffd6a (patch)
tree577bca564e78c7b8a2e02e7e9b3431518533edae /python/servo/bootstrap_commands.py
parent4061d13ba6d06f775e1a4a0fe50662ea3b16d2fa (diff)
downloadservo-fef332f38552ae8af83cf69993dd6aabdebffd6a.tar.gz
servo-fef332f38552ae8af83cf69993dd6aabdebffd6a.zip
Make rustup a requirement and switch to `rust-toolchain.toml` (#30056)
This change makes rustup a requirement for building Servo with `./mach` and switches to the newer `rust-toolchain.toml` format. The goal here is to make mach builds more similar to non-mach builds. - The new format allows listing the required components, removing some of the complexity from our mach scripts. - This means we must raise the required version of rustup to 1.23. The current version is 1.26. - We no longer wrap every call to cargo and rustc in "rustup run" calls as both cargo and rustc will take care of installing and using all necessary components specified in `rust-toolchain.toml` when run inside the project directory.
Diffstat (limited to 'python/servo/bootstrap_commands.py')
-rw-r--r--python/servo/bootstrap_commands.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py
index f8e64754b23..b5b833d1e2d 100644
--- a/python/servo/bootstrap_commands.py
+++ b/python/servo/bootstrap_commands.py
@@ -21,6 +21,8 @@ import sys
import traceback
import urllib
+import toml
+
from mach.decorators import (
CommandArgument,
CommandProvider,
@@ -283,15 +285,16 @@ class MachCommands(CommandBase):
default='1',
help='Keep up to this many most recent nightlies')
def clean_nightlies(self, force=False, keep=None):
- print("Current Rust version for Servo: {}".format(self.rust_toolchain()))
+ print(f"Current Rust version for Servo: {self.rust_toolchain()}")
old_toolchains = []
keep = int(keep)
- stdout = subprocess.check_output(['git', 'log', '--format=%H', 'rust-toolchain'])
+ stdout = subprocess.check_output(['git', 'log', '--format=%H', 'rust-toolchain.toml'])
for i, commit_hash in enumerate(stdout.split(), 1):
if i > keep:
- toolchain = subprocess.check_output(
- ['git', 'show', '%s:rust-toolchain' % commit_hash])
- old_toolchains.append(toolchain.strip())
+ toolchain_config_text = subprocess.check_output(
+ ['git', 'show', f'{commit_hash}:rust-toolchain.toml'])
+ toolchain = toml.loads(toolchain_config_text)['toolchain']['channel']
+ old_toolchains.append(toolchain)
removing_anything = False
stdout = subprocess.check_output(['rustup', 'toolchain', 'list'])
@@ -300,10 +303,10 @@ class MachCommands(CommandBase):
if toolchain_with_host.startswith(old):
removing_anything = True
if force:
- print("Removing {}".format(toolchain_with_host))
+ print(f"Removing {toolchain_with_host}")
check_call(["rustup", "uninstall", toolchain_with_host])
else:
- print("Would remove {}".format(toolchain_with_host))
+ print(f"Would remove {toolchain_with_host}")
if not removing_anything:
print("Nothing to remove.")
elif not force: