Skip to content

Commit

Permalink
Remove unused TapFormulaWithOldnameAmbiguityError.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Feb 14, 2024
1 parent 177e916 commit b717f5d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 34 deletions.
4 changes: 2 additions & 2 deletions Library/Homebrew/cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def stale_formula?(pathname, scrub)

formula = begin
Formulary.from_rack(HOMEBREW_CELLAR/formula_name)
rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
rescue FormulaUnavailableError, TapFormulaAmbiguityError
nil
end

Expand Down Expand Up @@ -300,7 +300,7 @@ def clean!(quiet: false, periodic: false)
args.each do |arg|
formula = begin
Formulary.resolve(arg)
rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
rescue FormulaUnavailableError, TapFormulaAmbiguityError
nil
end

Expand Down
5 changes: 2 additions & 3 deletions Library/Homebrew/diagnostic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,7 @@ def check_for_unreadable_installed_formula
rescue FormulaUnreadableError, FormulaClassUnavailableError,
TapFormulaUnreadableError, TapFormulaClassUnavailableError => e
formula_unavailable_exceptions << e
rescue FormulaUnavailableError,
TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
rescue FormulaUnavailableError, TapFormulaAmbiguityError
nil
end
return if formula_unavailable_exceptions.empty?
Expand All @@ -752,7 +751,7 @@ def check_for_unlinked_but_not_keg_only
else
begin
Formulary.from_rack(rack).keg_only?
rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
rescue FormulaUnavailableError, TapFormulaAmbiguityError
false
end
end
Expand Down
21 changes: 0 additions & 21 deletions Library/Homebrew/exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,27 +277,6 @@ def initialize(name, loaders)
end
end

# Raised when a formula's old name in a specific tap is found in multiple taps.
class TapFormulaWithOldnameAmbiguityError < RuntimeError
attr_reader :name, :possible_tap_newname_formulae, :taps

def initialize(name, possible_tap_newname_formulae)
@name = name
@possible_tap_newname_formulae = possible_tap_newname_formulae

@taps = possible_tap_newname_formulae.map do |newname|
newname =~ HOMEBREW_TAP_FORMULA_REGEX
"#{Regexp.last_match(1)}/#{Regexp.last_match(2)}"
end

super <<~EOS
Formulae with '#{name}' old name found in multiple taps: #{taps.map { |t| "\n * #{t}" }.join}
Please use the fully-qualified name (e.g. #{taps.first}/#{name}) to refer to the formula or use its new name.
EOS
end
end

# Raised when a tap is unavailable.
class TapUnavailableError < RuntimeError
attr_reader :name
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ def link_overwrite?(path)
f = Formulary.factory(keg.name)
rescue FormulaUnavailableError
# formula for this keg is deleted, so defer to allowlist
rescue TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
rescue TapFormulaAmbiguityError
return false # this keg belongs to another formula
else
# this keg belongs to another unrelated formula
Expand Down
8 changes: 2 additions & 6 deletions Library/Homebrew/formula_auditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ def audit_file

unversioned_formula = begin
Formulary.factory(full_name).path
rescue FormulaUnavailableError, TapFormulaAmbiguityError,
TapFormulaWithOldnameAmbiguityError
rescue FormulaUnavailableError, TapFormulaAmbiguityError
Pathname.new formula.path.to_s.gsub(/@.*\.rb$/, ".rb")
end
unless unversioned_formula.exist?
Expand Down Expand Up @@ -285,9 +284,6 @@ def audit_deps
rescue TapFormulaAmbiguityError
problem "Ambiguous dependency '#{dep.name.inspect}'."
next
rescue TapFormulaWithOldnameAmbiguityError
problem "Ambiguous oldname dependency '#{dep.name.inspect}'."
next
end

if dep_f.oldnames.include?(dep.name.split("/").last)
Expand Down Expand Up @@ -461,7 +457,7 @@ def audit_conflicts
next
rescue FormulaUnavailableError
problem "Can't find conflicting formula #{conflict.name.inspect}."
rescue TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
rescue TapFormulaAmbiguityError
problem "Ambiguous conflicting formula #{conflict.name.inspect}."
end
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/formulary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ def self.from_rack(
# Return whether given rack is keg-only.
def self.keg_only?(rack)
Formulary.from_rack(rack).keg_only?
rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
rescue FormulaUnavailableError, TapFormulaAmbiguityError
false
end

Expand Down

0 comments on commit b717f5d

Please sign in to comment.