Skip to content

Mach: Add mach clean-cargo-cache command - #16593

Merged
bors-servo merged 2 commits into
servo:masterfrom
UK992:clean-cargo-cache
May 8, 2017
Merged

bors-servo merged 2 commits into
servo:masterfrom
UK992:clean-cargo-cache

Conversation

@UK992

@UK992 UK992 commented Apr 24, 2017 •

Copy link
Copy Markdown
Contributor

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #__ (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @wafflespeanut: python/servo/bootstrap_commands.py

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Apr 24, 2017
@UK992
UK992 force-pushed the clean-cargo-cache branch from da57564 to 2c3b465 Compare April 28, 2017 16:28
@UK992

UK992 commented Apr 28, 2017

Copy link
Copy Markdown
Contributor Author

r? @Wafflespeanut

@highfive highfive assigned ghost and unassigned nox Apr 28, 2017

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had a brief look. Will take a closer look tomorrow.

if os.path.isfile(path):
return os.path.getsize(path) / (1024 * 1024.0)
total_size = 0
for dirpath, dirnames, filenames in os.walk(path):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really comfortable doing a os.walk through the cache, without knowing how long it takes for, say, 50 outdated crates? (which, I guess, is a perfectly normal situation for people who build servo very often).

While displaying crate sizes is a nice feedback, walking through checked out repositories (and crates) is probably a bad idea (what if the repository is huge? I'm sure python will suck on that!). So, we should see how long it takes if we don't walk (i.e., don't display size information). Then, depending on the difference, we should either remove that code, or have a flag for disabling that (since we don't want to see the size information all the time).

Also, the back-ported scandir module is worth looking at for walking and getting file info.

@UK992 UK992 Apr 30, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scandir on Windows needs Visual C++ Compiler for Python 2.7

update:
In my case (to delete 3776.33 MB):
with os.walk: 27s
with scandir: 16s

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not much of a difference. I don't think having that dependency is worth it. Let's stick to os.walk then. Also, what if we avoid walking entirely? (i.e., don't display sizes?)

@UK992 UK992 May 8, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 seconds

@ghost ghost May 8, 2017 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's expected. So, it's good to have it as an option. Anyway, feel free to r=me once you've amended the fixup :)

if exist_item not in current_crate:
crate_count += 1
removing_anything = True
if int(crate_count) >= int(keep) or not current_crate:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious how tracking the keep count helps in keeping the "N" most recent deps. It may probably work for downloaded crates, but the git repos have their commit hashes instead of versions, which means we're not really doing a great job there, right?

@UK992 UK992 Apr 30, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for git packages i use the same logic as in find_dep_path_newest, based on modification date.

@ghost

ghost commented Apr 30, 2017

Copy link
Copy Markdown

Oh, and I have a nice (but ugly) hack in mind, which is, to make use of os.stat to get directory info (which has the mtime and ctime) which will help us to track the crates based on their creation/modification times (which may work for both git repos and downloaded crates).

(also pinging @aneeshusa for comments)

@ghost

ghost commented May 2, 2017

Copy link
Copy Markdown

@UK992 Is this still WIP? Do you have something else in mind? If not, I'll go over it once more and we'll land it.

@UK992 UK992 changed the title (WIP) Mach: Add mach clean-cargo-cache command Mach: Add mach clean-cargo-cache command May 2, 2017
@UK992

UK992 commented May 2, 2017

Copy link
Copy Markdown
Contributor Author

It's ready for review.

@ghost

ghost commented May 8, 2017

Copy link
Copy Markdown

Looks good to me. Can you squash the fixup appropriately?

@bors-servo delegate+

@bors-servo

Copy link
Copy Markdown
Contributor

✌️ @UK992 can now approve this pull request

@ghost ghost added S-needs-squash Some (or all) of the commits in the PR should be combined. and removed S-awaiting-review There is new code that needs to be reviewed. labels May 8, 2017
@UK992
UK992 force-pushed the clean-cargo-cache branch from 85b7fa9 to 63b19c5 Compare May 8, 2017 09:31
@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label May 8, 2017
@UK992

UK992 commented May 8, 2017

Copy link
Copy Markdown
Contributor Author

@bors-servo r=wafflespeanut

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 63b19c5 has been approved by wafflespeanut

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-squash Some (or all) of the commits in the PR should be combined. labels May 8, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 63b19c5 with merge f6bd158...

bors-servo pushed a commit that referenced this pull request May 8, 2017
Mach: Add `mach clean-cargo-cache` command

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/16593)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-msvc-dev
Approved by: wafflespeanut
Pushing f6bd158 to master...

@bors-servo
bors-servo merged commit 63b19c5 into servo:master May 8, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label May 8, 2017
bors-servo pushed a commit that referenced this pull request May 9, 2017
Try to re-enable unit tests on travis-ci

After #16573 and #16593, issue #15076 _could_ be fixed.

Edit:
Closes #14723
Closes #15076

<!-- 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/16767)
<!-- Reviewable:end -->
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request May 9, 2017
…UK992:travis); r=jdm

After servo/servo#16573 and servo/servo#16593, issue servo/servo#15076 _could_ be fixed.

Edit:
Closes #14723
Closes #15076

Source-Repo: https://github.com/servo/servo
Source-Revision: 8ff484d3fd0b092d64af8b0a2cfa51b318631b82

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : b2ee28ecf18792f3a1ebf50bcb548ede41fb2e70
aethanyc pushed a commit to aethanyc/gecko-dev that referenced this pull request May 10, 2017
…UK992:travis); r=jdm

After servo/servo#16573 and servo/servo#16593, issue servo/servo#15076 _could_ be fixed.

Edit:
Closes #14723
Closes #15076

Source-Repo: https://github.com/servo/servo
Source-Revision: 8ff484d3fd0b092d64af8b0a2cfa51b318631b82
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 1, 2019
…UK992:travis); r=jdm

After servo/servo#16573 and servo/servo#16593, issue servo/servo#15076 _could_ be fixed.

Edit:
Closes #14723
Closes #15076

Source-Repo: https://github.com/servo/servo
Source-Revision: 8ff484d3fd0b092d64af8b0a2cfa51b318631b82

UltraBlame original commit: 2445c1a53fe2bf66317fcbb495a528eb68fdabc3
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 1, 2019
…UK992:travis); r=jdm

After servo/servo#16573 and servo/servo#16593, issue servo/servo#15076 _could_ be fixed.

Edit:
Closes #14723
Closes #15076

Source-Repo: https://github.com/servo/servo
Source-Revision: 8ff484d3fd0b092d64af8b0a2cfa51b318631b82

UltraBlame original commit: 2445c1a53fe2bf66317fcbb495a528eb68fdabc3
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 1, 2019
…UK992:travis); r=jdm

After servo/servo#16573 and servo/servo#16593, issue servo/servo#15076 _could_ be fixed.

Edit:
Closes #14723
Closes #15076

Source-Repo: https://github.com/servo/servo
Source-Revision: 8ff484d3fd0b092d64af8b0a2cfa51b318631b82

UltraBlame original commit: 2445c1a53fe2bf66317fcbb495a528eb68fdabc3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants