Skip to content
Permalink
Browse files

Keep stable rustc versions in `clean-nightlies`

Check the `rust-stable-version` file to keep the last n
versions of both the nightly and the stable compiler.
  • Loading branch information
aneeshusa committed May 2, 2017
1 parent f284a15 commit cc86993857931f85cb4680f30e8f4087c9769998
Showing with 22 additions and 14 deletions.
  1. +22 −14 python/servo/bootstrap_commands.py
@@ -290,30 +290,38 @@ def bootstrap_pub_suffix(self, force=False):
default='1',
help='Keep up to this many most recent nightlies')
def clean_nightlies(self, force=False, keep=None):
rust_current = self.rust_version()
self.set_use_stable_rust(False)
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 version: {}".format(rust_current))
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(),
}
if int(keep) == 1:
# Optimize keep=1 case to not invoke git
to_keep['rust'].add(rust_current)
to_keep['rust'].add(rust_current_nightly)
to_keep['rust'].add(rust_current_stable)
to_keep['cargo'].add(cargo_current)
else:
for tool in ["rust", "cargo"]:
commit_file = '{}-commit-hash'.format(tool)
cmd = subprocess.Popen(
['git', 'log', '--oneline', '--no-color', '-n', keep, '--patch', commit_file],
stdout=subprocess.PIPE,
universal_newlines=True
)
stdout, _ = cmd.communicate()
for line in stdout.splitlines():
if line.startswith("+") and not line.startswith("+++"):
to_keep[tool].add(line[1:])
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("+") and not line.startswith("+++"):
to_keep[tool].add(line[1:])

removing_anything = False
for tool in ["rust", "cargo"]:

0 comments on commit cc86993

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