Repository navigation
Implement the HOMEBREW_INSTALL_CLEANUP env to trigger cleanup on reinstall/install/upgrade - #5165
Conversation
| setup_test_formula "testball" | ||
| # allow(ENV).to receive(:[]).and_call_original | ||
| # allow(ENV).to receive(:[]).with("HOMEBREW_INSTALL_CLEANUP").and_return("1") | ||
| ENV["HOMEBREW_INSTALL_CLEANUP"] = "1" |
There was a problem hiding this comment.
I've tried both manually setting into ENV and mocking it out as shown in the 2 commented lines. I wasn't able to get either working even though I could confirm the functionality manually.
There was a problem hiding this comment.
@Wojonatior Ideally we wouldn't add another integration test for this (they are really slow). Either add a unit test or omit one entirely.
| #: Options for the `install` command are also valid here. | ||
| #: | ||
| #: If `--cleanup` is specified or `HOMEBREW_UPGRADE_CLEANUP` is set then remove | ||
| #: If `--cleanup` is specified, `HOMEBREW_INSTALL_CLEANUP` or `HOMEBREW_UPGRADE_CLEANUP` is set then remove |
There was a problem hiding this comment.
As a clarification around the original feature, is the intent to keep both ENVs or to enhance what the old one did as well a rename it?
There was a problem hiding this comment.
@Wojonatior Good question 馃憤 Let's remove the documentation for HOMEBREW_UPGRADE_CLEANUP in favour of HOMEBREW_INSTALL_CLEANUP but keep the HOMEBREW_UPGRADE_CLEANUP variable functional for people who are still using it.
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Nice start here! I'd like to see cmd/install changed similarly before this is merged.
| setup_test_formula "testball" | ||
| # allow(ENV).to receive(:[]).and_call_original | ||
| # allow(ENV).to receive(:[]).with("HOMEBREW_INSTALL_CLEANUP").and_return("1") | ||
| ENV["HOMEBREW_INSTALL_CLEANUP"] = "1" |
There was a problem hiding this comment.
@Wojonatior Ideally we wouldn't add another integration test for this (they are really slow). Either add a unit test or omit one entirely.
| #: Options for the `install` command are also valid here. | ||
| #: | ||
| #: If `--cleanup` is specified or `HOMEBREW_UPGRADE_CLEANUP` is set then remove | ||
| #: If `--cleanup` is specified, `HOMEBREW_INSTALL_CLEANUP` or `HOMEBREW_UPGRADE_CLEANUP` is set then remove |
There was a problem hiding this comment.
@Wojonatior Good question 馃憤 Let's remove the documentation for HOMEBREW_UPGRADE_CLEANUP in favour of HOMEBREW_INSTALL_CLEANUP but keep the HOMEBREW_UPGRADE_CLEANUP variable functional for people who are still using it.
|
I've added the formula cleanup to the |
| #: creating patches to the software. | ||
| #: | ||
| #: If `HOMEBREW_INSTALL_CLEANUP` is set then remove previously installed versions | ||
| #: of upgraded <formulae>. |
There was a problem hiding this comment.
This also will clean up the HOMEBREW_CACHE for that formula
|
@Wojonatior After fixing the docs please run |
Formula cleanup 馃憤. Could have regular cleanup occurring every e.g. 100 installs or something, though? Thoughts?
Nothing specifically but there may be leftover cache and cellar entries that it's worth cleaning up at this stage. |
|
@MikeMcQuaid I updated the docs and the manpage. I like the idea of the occasional full clean. Would it make sense to count that in the formula clean or specifically for the install? Is there a pattern established somewhere for how I would persist the number of installs? |
I was thinking that rather than being by installs it could be by days. |
|
Thanks so much for your first contribution! Without people like you submitting PRs we couldn't run this project. You rock, @Wojonatior! This is useful as-is so figured it was worth merging. Would still love to see the stuff we talked about in a follow-up PR! |
|
@MikeMcQuaid Thanks! Sorry about the lack of communication on my part. I definitely want to make the follow-up PR for this, you should hopefully see something around it in the next week or so. |
|
@Wojonatior No worries, looking forward to it! |
brew stylewith your changes locally?brew testswith your changes locally?This PR is thethe implementation of the
HOMEBREW_INSTALL_CLEANUPENV and associated features as discussed in #4760.