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

--cleanup: "Refusing to untap [tap] because it contains the following installed formulae or casks" #1246

Open
MatthiasPortzel opened this issue Sep 11, 2023 · 4 comments

Comments

@MatthiasPortzel
Copy link

My Brewfile contains

tap "sass/sass"
brew "sass/sass/sass"

Sass has a build dependency on dart-lang/dart/dart (src). So in order to install/upgrade/build sass, Homebrew taps dart-lang/dart and installs dart.

When running brew bundle install --cleanup:

  • dart is not un-installed, even though it is not specified in the Brewfile.
  • Then, Brew prints the error Refusing to untap dart-lang/dart because it contains the following installed formulae or casks: dart

This seems like a logic error where dart isn't uninstalled because it's a build dependency, but Brew attempts to untap dart-lang/dart anyways. If I manually uninstall dart and then re-run, Brew will successfully untap.

@MikeMcQuaid
Copy link
Member

Good catch. This is a limitation in the tap cleanup logic.

def taps_to_untap(global: false, file: nil)
@dsl ||= Bundle::Dsl.new(Brewfile.read(global: global, file: file))
kept_taps = @dsl.entries.select { |e| e.type == :tap }.map(&:name)
current_taps = Bundle::TapDumper.tap_names
current_taps - kept_taps - IGNORED_TAPS
end
needs to be updated to consider current_formulae. For now, though, the obvious workaround is to add that tap to your Brewfile as brew bundle dump will just unconditionally dump all of those anyway (and that's what we expect to have as the input to brew bundle cleanup rather than hand-crafted Brewfiles)

@MatthiasPortzel
Copy link
Author

MatthiasPortzel commented Sep 12, 2023

In this case, is it correct that dart should be installed at all after the initial build? My first instinct is that since it's not listed in the Brewfile, it should be removed when passed --cleanup. It's weird that dart isn't removed, but also isn't directly installed by the Brewfile (in the case where sass is already installed but dart isn't).

I'm definitely using brew in a way that isn't intended. (Writeup of my workflow.) I've worked around this issue by installing sass through npm -g, but would like to help get brew bundle working more properly, since I use it often.

Edit: Is there a way to list build-dependencies that are currently installed? Build dependencies are handled differently from normal dependencies and I don't really understand how they interact with everything else.

@MikeMcQuaid
Copy link
Member

In this case, is it correct that dart should be installed at all after the initial build? My first instinct is that since it's not listed in the Brewfile, it should be removed when passed --cleanup.

It's a dependency so it should not be removed. --cleanup doesn't remove dependencies.

Writeup of my workflow.
The reason I ended up with this workflow is that Brew doesn’t remember what packages I’ve installed, vs. have been installed as a dependency of another package.

This is not actually correct, FYI.

Is there a way to list build-dependencies that are currently installed?

brew deps with various flags can do this.

Build dependencies are handled differently from normal dependencies and I don't really understand how they interact with everything else.

They are handled less differently when building from source, like you are here.

@MatthiasPortzel
Copy link
Author

Thanks for answering my questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants