From bb1c783817ae9430c7aa15215c966a39ace09964 Mon Sep 17 00:00:00 2001 From: apainintheneck Date: Fri, 2 Sep 2022 23:02:07 -0700 Subject: [PATCH] Ignore renamed formulae when checking for unversioned formulae There is an audit for versioned formulae that makes sure an unversioned formulae of the same name exists already. This ignores that check when we exlicitly removed the unversioned formula by checking if it was renamed. Also, there is no need to check for formula.tap because formula.core_formula? guarantees the presence of formula.tap. --- Library/Homebrew/formula_auditor.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index 6c56204c56..0ac78d224a 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -52,14 +52,16 @@ module Homebrew def audit_file if formula.core_formula? && @versioned_formula + unversioned_name = formula.name.gsub(/@.*$/, "") + + # ignore when an unversioned formula doesn't exist after an explicit rename + return if formula.tap.formula_renames.key?(unversioned_name) + + # build this ourselves as we want e.g. homebrew/core to be present + full_name = "#{formula.tap}/#{unversioned_name}" + unversioned_formula = begin - # build this ourselves as we want e.g. homebrew/core to be present - full_name = if formula.tap - "#{formula.tap}/#{formula.name}" - else - formula.name - end - Formulary.factory(full_name.gsub(/@.*$/, "")).path + Formulary.factory(full_name).path rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError Pathname.new formula.path.to_s.gsub(/@.*\.rb$/, ".rb")