Repository navigation
Mach: Add mach clean-cargo-cache command - #16593
Conversation
|
Heads up! This PR modifies the following files:
|
da57564 to
2c3b465
Compare
|
r? @Wafflespeanut |
ghost
left a comment
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
for git packages i use the same logic as in find_dep_path_newest, based on modification date.
|
Oh, and I have a nice (but ugly) hack in mind, which is, to make use of (also pinging @aneeshusa for comments) |
|
@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. |
mach clean-cargo-cache commandmach clean-cargo-cache command
|
It's ready for review. |
|
Looks good to me. Can you squash the fixup appropriately? @bors-servo delegate+ |
|
✌️ @UK992 can now approve this pull request |
|
@bors-servo r=wafflespeanut |
|
📌 Commit 63b19c5 has been approved by |
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 -->
|
☀️ 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 |
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 -->
…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
…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
…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
…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
…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
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is