Skip to content
Permalink
Browse files

Auto merge of #17780 - servo:cargoup, r=nox,SimonSapin

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.

Unfortunately, Cargo binaries are not available for every Cargo PR anymore: rust-lang/cargo#4123 (comment)

<!-- 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/17780)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Jul 18, 2017
2 parents 38e8086 + 8303f5b commit d403f404382c66485d9744787ce021556be59d6c
Showing with 32 additions and 49 deletions.
  1. +10 −3 Cargo.lock
  2. +2 −2 appveyor.yml
  3. +0 −1 cargo-commit-hash
  4. +18 −26 python/servo/bootstrap_commands.py
  5. +2 −2 python/servo/command_base.py
  6. +0 −15 python/servo/devenv_commands.py

Some generated files are not rendered by default. Learn more.

@@ -36,8 +36,8 @@ branches:
- master

cache:
- .servo -> rust-commit-hash, cargo-commit-hash
- .cargo -> rust-commit-hash, cargo-commit-hash
- .servo -> rust-commit-hash
- .cargo -> rust-commit-hash
- .ccache

# Uncomment these lines to expose RDP access information to the build machine in the build log.

This file was deleted.

@@ -207,8 +207,8 @@ def bootstrap_cargo(self, force=False):
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,46 +295,38 @@ def clean_nightlies(self, force=False, keep=None):
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"]:
base = path.join(self.context.sharedir, tool)
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 @@ def rust_version(self):

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 @@ def rustup(self, master=False):
# 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()

0 comments on commit d403f40

Please sign in to comment.
You can’t perform that action at this time.