diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index 19348c6a4cd60..66937919c49b5 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -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 @@ -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 diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 87d58992598f5..50ac367efa992 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -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? @@ -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 diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 3fdda640b25c1..1094c7e517bf6 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -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 diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 3b65c6248be60..9dd88c03650b0 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -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 diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index 2285785cc177e..93fdc1f0f386b 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -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? @@ -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) @@ -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 diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 61019d9cfcca3..622f9ffb4e11f 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -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