-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clean: add --with-downloads option #10070
Conversation
This patch adds the `--include-cache` flag to `cargo clean`, which allows the command to also remove related artifacts from `CARGO_HOME` such as downloaded `.crate` files in `~/.cargo/cache/` and extracted source directories in `~/.cargo/src/`. Note that this feature is not intended to replace the `cargo-cache` command which does smart cache management. Instead, this command simply blows away whatever it's asked to delete with no smarts whatsoever. Fixes rust-lang#3289.
(rust-highfive has picked a reviewer for you, use r? to override) |
Hmm I also have the feeling that the arg name could be improved. I think something like |
Oooh, yeah, I like |
☔ The latest upstream changes (presumably #10080) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #10072) made this pull request unmergeable. Please resolve the merge conflicts. |
Can you say more about what your use case is? I would not expect anyone to ever need to run such a command. BTW, I've been working on some experiments with automating cleaning of stale cache files. Related to that, I think we will likely want to separate out cache-related actions to a separate subcommand (probably as a subcommand to |
For As for There's also the completeness argument: if we have
What does "stale" mean in this context? I definitely like the sound of that though! |
The idea is to track the last time something was used, and remove unused things after some period of time. The trick is doing that efficiently, which so far has been difficult. When I get a chance, I'll try to follow back with some ideas about the interface for manual cleaning. |
☔ The latest upstream changes (presumably #10168) made this pull request unmergeable. Please resolve the merge conflicts. |
This would be a useful feature, what is blocking this from getting merged? |
I'm going to go ahead and close this as this is fairly stale and there is more design work to be done before we get back to a PR. |
@abhizer you can look if https://crates.io/crates/cargo-cache suits your needs |
Closing this now as I assume you just hit the wrong button 😅 I still think a flag like this might be useful, but don't have a direct need for it myself any more. |
This patch adds the
--with-downloads
flag tocargo clean
, whichallows the command to also remove related artifacts from
CARGO_HOME
such as downloaded
.crate
files in~/.cargo/cache/
and extractedsource directories in
~/.cargo/src/
.Note that this feature is not intended to replace the
cargo-cache
command which does smart cache management. Instead, this command simply
blows away whatever it's asked to delete with no smarts whatsoever.
Fixes #3289.
/cc @matthiaskrgr since it seems likely you might have thoughts.
I realize the exact name of this argument is likely going to be subject to some bikeshedding. Alex suggested
--global
in #3289 (comment), but I didn't go with that since this specifically hitsCARGO_HOME
, which isn't necessarily "global". I initially used--include-cache
, which seemed sufficiently unambiguous, but landed on--with-downloads
following Matthias' suggestion.This PR is also my first encounter with the
Filesystem
type, so observations about my (potential mis-)use of that would be helpful! Same thing with whether I'm dealing correctly with the package cache lock (specifically in the no-p
case).