mirror of
https://github.com/servo/servo.git
synced 2025-06-19 06:38:59 +01:00
Update to cargo 0.21.0-nightly (eb6cf012a 2017-07-02)
Cargo binaries are now produced on Rust’s CI, not Cargo’s. Remove cargo-commit-hash and find Cargo based on rust-commit-hash.
This commit is contained in:
parent
b0e3005dc7
commit
8303f5b926
5 changed files with 22 additions and 46 deletions
|
@ -207,8 +207,8 @@ class MachCommands(CommandBase):
|
|||
os.makedirs(cargo_dir)
|
||||
|
||||
tgz_file = "cargo-nightly-%s.tar.gz" % host_triple()
|
||||
nightly_url = "https://s3.amazonaws.com/rust-lang-ci/cargo-builds/%s/%s" % \
|
||||
(self.cargo_build_id(), tgz_file)
|
||||
nightly_url = "https://s3.amazonaws.com/rust-lang-ci/rustc-builds/%s/%s" % \
|
||||
(self.cargo_build_id()[len("rust-"):], tgz_file)
|
||||
|
||||
download_file("Cargo nightly", nightly_url, tgz_file)
|
||||
|
||||
|
@ -295,34 +295,24 @@ class MachCommands(CommandBase):
|
|||
rust_current_nightly = self.rust_version()
|
||||
self.set_use_stable_rust(True)
|
||||
rust_current_stable = self.rust_version()
|
||||
cargo_current = self.cargo_build_id()
|
||||
print("Current Rust nightly version: {}".format(rust_current_nightly))
|
||||
print("Current Rust stable version: {}".format(rust_current_stable))
|
||||
print("Current Cargo version: {}".format(cargo_current))
|
||||
to_keep = {
|
||||
'rust': set(),
|
||||
'cargo': set(),
|
||||
}
|
||||
to_keep = set()
|
||||
if int(keep) == 1:
|
||||
# Optimize keep=1 case to not invoke git
|
||||
to_keep['rust'].add(rust_current_nightly)
|
||||
to_keep['rust'].add(rust_current_stable)
|
||||
to_keep['cargo'].add(cargo_current)
|
||||
to_keep.add(rust_current_nightly)
|
||||
to_keep.add(rust_current_stable)
|
||||
else:
|
||||
for tool, version_files in {
|
||||
'rust': ['rust-commit-hash', 'rust-stable-version'],
|
||||
'cargo': ['cargo-commit-hash'],
|
||||
}.items():
|
||||
for version_file in version_files:
|
||||
cmd = subprocess.Popen(
|
||||
['git', 'log', '--oneline', '--no-color', '-n', keep, '--patch', version_file],
|
||||
stdout=subprocess.PIPE,
|
||||
universal_newlines=True
|
||||
)
|
||||
stdout, _ = cmd.communicate()
|
||||
for line in stdout.splitlines():
|
||||
if line.startswith(b"+") and not line.startswith(b"+++"):
|
||||
to_keep[tool].add(line[1:])
|
||||
for version_file in ['rust-commit-hash', 'rust-stable-version']:
|
||||
cmd = subprocess.Popen(
|
||||
['git', 'log', '--oneline', '--no-color', '-n', keep, '--patch', version_file],
|
||||
stdout=subprocess.PIPE,
|
||||
universal_newlines=True
|
||||
)
|
||||
stdout, _ = cmd.communicate()
|
||||
for line in stdout.splitlines():
|
||||
if line.startswith(b"+") and not line.startswith(b"+++"):
|
||||
to_keep.add(line[1:])
|
||||
|
||||
removing_anything = False
|
||||
for tool in ["rust", "cargo"]:
|
||||
|
@ -330,11 +320,13 @@ class MachCommands(CommandBase):
|
|||
if not path.isdir(base):
|
||||
continue
|
||||
for name in os.listdir(base):
|
||||
if name.startswith("rust-"):
|
||||
name = name[len("rust-"):]
|
||||
# We append `-alt` if LLVM assertions aren't enabled,
|
||||
# so use just the commit hash itself.
|
||||
# This may occasionally leave an extra nightly behind
|
||||
# but won't remove too many nightlies.
|
||||
if name.partition('-')[0] not in to_keep[tool]:
|
||||
if name.partition('-')[0] not in to_keep:
|
||||
removing_anything = True
|
||||
full_path = path.join(base, name)
|
||||
if force:
|
||||
|
|
|
@ -326,9 +326,9 @@ class CommandBase(object):
|
|||
|
||||
def cargo_build_id(self):
|
||||
if self._cargo_build_id is None:
|
||||
filename = path.join(self.context.topdir, "cargo-commit-hash")
|
||||
filename = path.join(self.context.topdir, "rust-commit-hash")
|
||||
with open(filename) as f:
|
||||
self._cargo_build_id = f.read().strip()
|
||||
self._cargo_build_id = "rust-" + f.read().strip()
|
||||
return self._cargo_build_id
|
||||
|
||||
def get_top_dir(self):
|
||||
|
|
|
@ -284,21 +284,6 @@ class MachCommands(CommandBase):
|
|||
# Reset self.config["tools"]["rust-root"]
|
||||
self._rust_version = None
|
||||
self.set_use_stable_rust(False)
|
||||
|
||||
self.fetch()
|
||||
|
||||
@Command('cargoup',
|
||||
description='Update the Cargo version to latest master',
|
||||
category='devenv')
|
||||
def cargoup(self):
|
||||
url = "https://api.github.com/repos/rust-lang/cargo/git/refs/heads/master"
|
||||
commit = json.load(urllib2.urlopen(url))["object"]["sha"]
|
||||
filename = path.join(self.context.topdir, "cargo-commit-hash")
|
||||
with open(filename, "w") as f:
|
||||
f.write(commit + "\n")
|
||||
|
||||
# Reset self.config["tools"]["cargo-root"]
|
||||
self._cargo_build_id = None
|
||||
self.set_cargo_root()
|
||||
|
||||
self.fetch()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue