Auto merge of #16573 - UK992:travis, r=aneeshusa

Auto clean old nightlies on Travis

This could solve `no space left` problem.

<!-- 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/16573)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-22 19:17:12 -05:00 committed by GitHub
commit cc74b5b36f
2 changed files with 6 additions and 9 deletions

View file

@ -28,6 +28,8 @@ matrix:
- .cargo - .cargo
- .servo - .servo
- $HOME/.ccache - $HOME/.ccache
before_cache:
- ./mach clean-nightlies --keep 2 --force
env: CCACHE=/usr/bin/ccache env: CCACHE=/usr/bin/ccache
addons: addons:
apt: apt:

View file

@ -306,19 +306,14 @@ class MachCommands(CommandBase):
for tool in ["rust", "cargo"]: for tool in ["rust", "cargo"]:
commit_file = '{}-commit-hash'.format(tool) commit_file = '{}-commit-hash'.format(tool)
cmd = subprocess.Popen( cmd = subprocess.Popen(
['git', 'log', '--pretty=format:%H', '-n', keep, commit_file], ['git', 'log', '--oneline', '--no-color', '-n', keep, '--patch', commit_file],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
universal_newlines=True universal_newlines=True
) )
stdout, _ = cmd.communicate() stdout, _ = cmd.communicate()
for commit in stdout.splitlines(): for line in stdout.splitlines():
cmd = subprocess.Popen( if line.startswith("+") and not line.startswith("+++"):
['git', 'show', '{}:{}'.format(commit, commit_file)], to_keep[tool].add(line[1:])
stdout=subprocess.PIPE,
universal_newlines=True
)
commit_hash, _ = cmd.communicate()
to_keep[tool].add(commit_hash.rstrip())
removing_anything = False removing_anything = False
for tool in ["rust", "cargo"]: for tool in ["rust", "cargo"]: