mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #16836 - servo:nightly, r=nox
Make `./mach rustup` use the latest nightly rather than master. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16836) <!-- Reviewable:end -->
This commit is contained in:
commit
d2fa2ae934
1 changed files with 16 additions and 4 deletions
|
@ -226,11 +226,23 @@ class MachCommands(CommandBase):
|
||||||
env=self.build_env())
|
env=self.build_env())
|
||||||
|
|
||||||
@Command('rustup',
|
@Command('rustup',
|
||||||
description='Update the Rust version to latest master',
|
description='Update the Rust version to latest Nightly',
|
||||||
category='devenv')
|
category='devenv')
|
||||||
def rustup(self):
|
@CommandArgument('--master',
|
||||||
url = "https://api.github.com/repos/rust-lang/rust/git/refs/heads/master"
|
action='store_true',
|
||||||
commit = json.load(urllib2.urlopen(url))["object"]["sha"]
|
help='Use the latest commit of the "master" branch')
|
||||||
|
def rustup(self, master=False):
|
||||||
|
if master:
|
||||||
|
url = "https://api.github.com/repos/rust-lang/rust/git/refs/heads/master"
|
||||||
|
commit = json.load(urllib2.urlopen(url))["object"]["sha"]
|
||||||
|
else:
|
||||||
|
import toml
|
||||||
|
import re
|
||||||
|
url = "https://static.rust-lang.org/dist/channel-rust-nightly.toml"
|
||||||
|
version = toml.load(urllib2.urlopen(url))["pkg"]["rustc"]["version"]
|
||||||
|
short_commit = re.search("\(([0-9a-f]+) ", version).group(1)
|
||||||
|
url = "https://api.github.com/repos/rust-lang/rust/commits/" + short_commit
|
||||||
|
commit = json.load(urllib2.urlopen(url))["sha"]
|
||||||
filename = path.join(self.context.topdir, "rust-commit-hash")
|
filename = path.join(self.context.topdir, "rust-commit-hash")
|
||||||
with open(filename, "w") as f:
|
with open(filename, "w") as f:
|
||||||
f.write(commit + "\n")
|
f.write(commit + "\n")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue