From ec083231703757790968c8cbb8c988e573d6b727 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Mon, 20 Feb 2023 04:45:21 +0000 Subject: [PATCH] formula_auditor: fix handling of tap formulae --- Library/Homebrew/formula_auditor.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index 40530ef8e18f0..2aecc90f5bff4 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -256,21 +256,26 @@ def audit_deps # Check for things we don't like to depend on. # We allow non-Homebrew installs whenever possible. spec.deps.each do |dep| - begin - dep_f = dep.to_formula + use_git_formulae = @core_tap || + (!Homebrew::EnvConfig.install_from_api? && + !Homebrew::EnvConfig.automatically_set_no_install_from_api?) + + dep_f = with_env(HOMEBREW_NO_INSTALL_FROM_API: (use_git_formulae ? "1" : nil)) do + dep.to_formula rescue TapFormulaUnavailableError # Don't complain about missing cross-tap dependencies - next + nil rescue FormulaUnavailableError problem "Can't find dependency '#{dep.name.inspect}'." - next + nil rescue TapFormulaAmbiguityError problem "Ambiguous dependency '#{dep.name.inspect}'." - next + nil rescue TapFormulaWithOldnameAmbiguityError problem "Ambiguous oldname dependency '#{dep.name.inspect}'." - next + nil end + next if dep_f.nil? if dep_f.oldname && dep.name.split("/").last == dep_f.oldname problem "Dependency '#{dep.name}' was renamed; use new name '#{dep_f.name}'."