mirror of
https://github.com/Homebrew/brew.git
synced 2024-11-25 16:33:34 +08:00
Merge pull request #18784 from Homebrew/uninstall-unignore-deps
Some checks failed
CodeQL / Analyze (push) Waiting to run
Docker / docker (Ubuntu ${{ matrix.version }}) (18.04) (push) Waiting to run
Docker / docker (Ubuntu ${{ matrix.version }}) (20.04) (push) Waiting to run
Docker / docker (Ubuntu ${{ matrix.version }}) (22.04) (push) Waiting to run
Docker / docker (Ubuntu ${{ matrix.version }}) (24.04) (push) Waiting to run
Documentation CI / docs (push) Waiting to run
Ruby Documentation CI / rubydoc (push) Waiting to run
CI / syntax (push) Waiting to run
CI / tap syntax (push) Blocked by required conditions
CI / formula audit (push) Blocked by required conditions
CI / cask audit (push) Blocked by required conditions
CI / vendored gems (push) Blocked by required conditions
CI / ${{ matrix.name }} (update-test (Ubuntu), ubuntu-latest) (push) Blocked by required conditions
CI / ${{ matrix.name }} (update-test (macOS), macos-15) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (Ubuntu 20.04), ubuntu-20.04, --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (Ubuntu 22.04), ubuntu-22.04, --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (Ubuntu 24.04), ubuntu-24.04, --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (generic OS), ubuntu-latest, --generic --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (macOS 13 x86_64), macos-13, --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (macOS 15 arm64), macos-15, --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (online), ubuntu-latest, --online --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (ghcr.io/homebrew/ubuntu20.04, test default formula (Ubuntu 20.04), ubuntu-latest) (push) Blocked by required conditions
CI / ${{ matrix.name }} (ghcr.io/homebrew/ubuntu22.04:master, test default formula (Ubuntu 22.04), ubuntu-latest) (push) Blocked by required conditions
CI / ${{ matrix.name }} (test default formula (macOS 13 x86_64), macos-13) (push) Blocked by required conditions
CI / ${{ matrix.name }} (test default formula (macOS 15 arm64), macos-15) (push) Blocked by required conditions
Update sponsors, maintainers, manpage and completions / updates (push) Has been cancelled
Some checks failed
CodeQL / Analyze (push) Waiting to run
Docker / docker (Ubuntu ${{ matrix.version }}) (18.04) (push) Waiting to run
Docker / docker (Ubuntu ${{ matrix.version }}) (20.04) (push) Waiting to run
Docker / docker (Ubuntu ${{ matrix.version }}) (22.04) (push) Waiting to run
Docker / docker (Ubuntu ${{ matrix.version }}) (24.04) (push) Waiting to run
Documentation CI / docs (push) Waiting to run
Ruby Documentation CI / rubydoc (push) Waiting to run
CI / syntax (push) Waiting to run
CI / tap syntax (push) Blocked by required conditions
CI / formula audit (push) Blocked by required conditions
CI / cask audit (push) Blocked by required conditions
CI / vendored gems (push) Blocked by required conditions
CI / ${{ matrix.name }} (update-test (Ubuntu), ubuntu-latest) (push) Blocked by required conditions
CI / ${{ matrix.name }} (update-test (macOS), macos-15) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (Ubuntu 20.04), ubuntu-20.04, --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (Ubuntu 22.04), ubuntu-22.04, --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (Ubuntu 24.04), ubuntu-24.04, --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (generic OS), ubuntu-latest, --generic --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (macOS 13 x86_64), macos-13, --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (macOS 15 arm64), macos-15, --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (tests (online), ubuntu-latest, --online --coverage) (push) Blocked by required conditions
CI / ${{ matrix.name }} (ghcr.io/homebrew/ubuntu20.04, test default formula (Ubuntu 20.04), ubuntu-latest) (push) Blocked by required conditions
CI / ${{ matrix.name }} (ghcr.io/homebrew/ubuntu22.04:master, test default formula (Ubuntu 22.04), ubuntu-latest) (push) Blocked by required conditions
CI / ${{ matrix.name }} (test default formula (macOS 13 x86_64), macos-13) (push) Blocked by required conditions
CI / ${{ matrix.name }} (test default formula (macOS 15 arm64), macos-15) (push) Blocked by required conditions
Update sponsors, maintainers, manpage and completions / updates (push) Has been cancelled
uninstall: don't ignore deps even for developers
This commit is contained in:
commit
50cac383c7
@ -47,17 +47,7 @@ RSpec.describe Homebrew::Uninstall do
|
||||
end
|
||||
|
||||
describe "::handle_unsatisfied_dependents" do
|
||||
specify "when developer" do
|
||||
ENV["HOMEBREW_DEVELOPER"] = "1"
|
||||
|
||||
expect do
|
||||
described_class.handle_unsatisfied_dependents(kegs_by_rack)
|
||||
end.to output(/Warning/).to_stderr
|
||||
|
||||
expect(Homebrew).not_to have_failed
|
||||
end
|
||||
|
||||
specify "when not developer" do
|
||||
specify "when `ignore_dependencies` is false" do
|
||||
expect do
|
||||
described_class.handle_unsatisfied_dependents(kegs_by_rack)
|
||||
end.to output(/Error/).to_stderr
|
||||
@ -65,7 +55,7 @@ RSpec.describe Homebrew::Uninstall do
|
||||
expect(Homebrew).to have_failed
|
||||
end
|
||||
|
||||
specify "when not developer and `ignore_dependencies` is true" do
|
||||
specify "when `ignore_dependencies` is true" do
|
||||
expect do
|
||||
described_class.handle_unsatisfied_dependents(kegs_by_rack, ignore_dependencies: true)
|
||||
end.not_to output.to_stderr
|
||||
|
@ -106,12 +106,7 @@ module Homebrew
|
||||
def self.check_for_dependents(kegs, casks: [], named_args: [])
|
||||
return false unless (result = InstalledDependents.find_some_installed_dependents(kegs, casks:))
|
||||
|
||||
if Homebrew::EnvConfig.developer?
|
||||
DeveloperDependentsMessage.new(*result, named_args:).output
|
||||
else
|
||||
NondeveloperDependentsMessage.new(*result, named_args:).output
|
||||
end
|
||||
|
||||
DependentsMessage.new(*result, named_args:).output
|
||||
true
|
||||
end
|
||||
|
||||
@ -124,6 +119,15 @@ module Homebrew
|
||||
@named_args = named_args
|
||||
end
|
||||
|
||||
def output
|
||||
ofail <<~EOS
|
||||
Refusing to uninstall #{reqs.to_sentence}
|
||||
because #{(reqs.count == 1) ? "it" : "they"} #{are_required_by_deps}.
|
||||
You can override this and force removal with:
|
||||
#{sample_command}
|
||||
EOS
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def sample_command
|
||||
@ -136,27 +140,6 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
class DeveloperDependentsMessage < DependentsMessage
|
||||
def output
|
||||
opoo <<~EOS
|
||||
#{reqs.to_sentence} #{are_required_by_deps}.
|
||||
You can silence this warning with:
|
||||
#{sample_command}
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
||||
class NondeveloperDependentsMessage < DependentsMessage
|
||||
def output
|
||||
ofail <<~EOS
|
||||
Refusing to uninstall #{reqs.to_sentence}
|
||||
because #{(reqs.count == 1) ? "it" : "they"} #{are_required_by_deps}.
|
||||
You can override this and force removal with:
|
||||
#{sample_command}
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
||||
def self.rm_pin(rack)
|
||||
Formulary.from_rack(rack).unpin
|
||||
rescue
|
||||
|
Loading…
Reference in New Issue
Block a user