Skip to content
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

cmd/uninstall: check for dependent casks #10575

Merged
merged 5 commits into from
Feb 12, 2021
Merged

cmd/uninstall: check for dependent casks #10575

merged 5 commits into from
Feb 12, 2021

Conversation

nandahkrishna
Copy link
Member

@nandahkrishna nandahkrishna commented Feb 9, 2021

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?
  • Have you successfully run brew man locally and committed any changes?

This PR aims to add the ability to check for casks dependent on formulae when running brew uninstall, as requested in #10570.

Output:

➜ brew uninstall mono                 
Error: Refusing to uninstall /usr/local/Cellar/mono/6.12.0.107
because it is required by godot-mono, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies mono

TODO: Comments for the new find_cask_dependents method and tests.

@BrewTestBot
Copy link
Member

Review period will end on 2021-02-10 at 01:23:57 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Feb 9, 2021
@nandahkrishna nandahkrishna linked an issue Feb 9, 2021 that may be closed by this pull request
6 tasks
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Great work so far!

@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Feb 10, 2021
@BrewTestBot
Copy link
Member

Review period ended.

@nandahkrishna
Copy link
Member Author

nandahkrishna commented Feb 10, 2021

I'm 👍🏻 on sharing code on them if it makes sense.

I've done this with the latest commit(s). I thought it would be better to have Keg.find_some_installed_dependents get dependents - irrespective of whether those dependents are kegs or casks (dependent on formulae). I hope my thinking isn't incorrect here.

I don't think there should be any references to casks in keg.rb though; casks never have/use kegs.

If I am wrong and/or this point (any references) takes precedence, I'll move the handling to cask/. I will admit I am new to the terminology so this is entirely possible.

@nandahkrishna
Copy link
Member Author

With the latest commit, I've moved find_some_installed_dependents from keg.rb to a new installed_dependents.rb (hope I understood the suggestion right).

This method had quite a few tests and so I've moved them as-is from the previous keg_spec.rb, along with an additional test that is cask-related.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

This is perfect, exactly what I had in mind. Great work @nandahkrishna 👏🏻 ❤️

@MikeMcQuaid MikeMcQuaid merged commit f9b4b69 into Homebrew:master Feb 12, 2021
@nandahkrishna nandahkrishna deleted the dependent-cask-check branch February 12, 2021 11:25
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Mar 15, 2021
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Mar 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I can uninstall a formula which is a dependency for a cask, without errors
3 participants