aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/command_base.py
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2017-08-31 11:17:33 +0200
committerSimon Sapin <simon.sapin@exyr.org>2017-08-31 14:30:28 +0200
commit56b4f3ae70a217834f88a4233eb9989ff9cfec92 (patch)
tree4abd8e7eef44d83185a17854952f4c9ca514be73 /python/servo/command_base.py
parentd795ceae17b2ce5346d4f211f73c62e5c25dce79 (diff)
downloadservo-56b4f3ae70a217834f88a4233eb9989ff9cfec92.tar.gz
servo-56b4f3ae70a217834f88a4233eb9989ff9cfec92.zip
Switch back to pinning Rust by Nightly date instead of commit hash…
… this time using a `rust-toolchain` file compatible with rustup: https://github.com/rust-lang-nursery/rustup.rs/#the-toolchain-file And upgrade to rustc 1.21.0-nightly (c11f689d2 2017-08-29) ---- Now if both `system-rust` and `system-cargo` are set to `true` in `.servobuild`’s `[tools]` section, and the corresponding `rustc` and `cargo` binaries are in fact rustup’s wrappers, then rustup will use the correct version based on `rust-toolchain`. CC https://github.com/servo/servo/issues/11361 Unlike https://github.com/servo/servo/pull/17927, this does not make mach use rustup directly.
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r--python/servo/command_base.py54
1 files changed, 32 insertions, 22 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index abaa643fbb3..dab4df1a772 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -285,14 +285,13 @@ class CommandBase(object):
self.set_use_stable_rust(False)
_use_stable_rust = False
- _rust_version = None
- _rust_version_is_stable = False
- _cargo_build_id = None
+ _rust_stable_version = None
+ _rust_nightly_date = None
def set_cargo_root(self):
if not self.config["tools"]["system-cargo"]:
self.config["tools"]["cargo-root"] = path.join(
- self.context.sharedir, "cargo", self.cargo_build_id())
+ self.context.sharedir, "cargo", self.rust_nightly_date())
def set_use_stable_rust(self, use_stable_rust=True):
self._use_stable_rust = use_stable_rust
@@ -308,28 +307,39 @@ class CommandBase(object):
def use_stable_rust(self):
return self._use_stable_rust
+ def rust_install_dir(self):
+ if self._use_stable_rust:
+ return self.rust_stable_version()
+ elif not self.config["build"]["llvm-assertions"]:
+ return self.rust_nightly_date() + "-alt"
+ else:
+ return self.rust_nightly_date()
+
def rust_path(self):
- version = self.rust_version()
if self._use_stable_rust:
- return os.path.join(version, "rustc-%s-%s" % (version, host_triple()))
- if not self.config["build"]["llvm-assertions"]:
- version += "-alt"
- return os.path.join(version, "rustc-nightly-%s" % (host_triple()))
-
- def rust_version(self):
- if self._rust_version is None or self._use_stable_rust != self._rust_version_is_stable:
- filename = path.join(self.context.topdir,
- "rust-stable-version" if self._use_stable_rust else "rust-commit-hash")
+ version = self.rust_stable_version()
+ else:
+ version = "nightly"
+
+ subdir = "rustc-%s-%s" % (version, host_triple())
+ return os.path.join(self.rust_install_dir(), subdir)
+
+ def rust_stable_version(self):
+ if self._rust_stable_version is None:
+ filename = path.join("rust-stable-version")
with open(filename) as f:
- self._rust_version = f.read().strip()
- return self._rust_version
+ self._rust_stable_version = f.read().strip()
+ return self._rust_stable_version
- def cargo_build_id(self):
- if self._cargo_build_id is None:
- filename = path.join(self.context.topdir, "rust-commit-hash")
+ def rust_nightly_date(self):
+ if self._rust_nightly_date is None:
+ filename = path.join(self.context.topdir, "rust-toolchain")
with open(filename) as f:
- self._cargo_build_id = "rust-" + f.read().strip()
- return self._cargo_build_id
+ toolchain = f.read().strip()
+ prefix = "nightly-"
+ assert toolchain.startswith(prefix)
+ self._rust_nightly_date = toolchain[len(prefix):]
+ return self._rust_nightly_date
def get_top_dir(self):
return self.context.topdir
@@ -587,7 +597,7 @@ class CommandBase(object):
Registrar.dispatch("bootstrap", context=self.context)
if not (self.config['tools']['system-rust'] or (rustc_binary_exists and target_exists)):
- print("looking for rustc at %s" % (rustc_path))
+ print("Looking for rustc at %s" % (rustc_path))
Registrar.dispatch("bootstrap-rust", context=self.context, target=filter(None, [target]),
stable=self._use_stable_rust)