improve audit_formula_name performance
Closes Homebrew/homebrew#40939. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
f1bf81dd55
commit
b363175401
@ -205,6 +205,11 @@ class FormulaAuditor
|
|||||||
end
|
end
|
||||||
|
|
||||||
@@aliases ||= Formula.aliases
|
@@aliases ||= Formula.aliases
|
||||||
|
@@remote_official_taps ||= if (homebrew_tapd = HOMEBREW_LIBRARY/"Taps/homebrew").directory?
|
||||||
|
OFFICIAL_TAPS - homebrew_tapd.subdirs.map(&:basename).map { |tap| tap.to_s.sub(/^homebrew-/, "") }
|
||||||
|
else
|
||||||
|
OFFICIAL_TAPS
|
||||||
|
end
|
||||||
|
|
||||||
def audit_formula_name
|
def audit_formula_name
|
||||||
return unless @strict
|
return unless @strict
|
||||||
@ -224,14 +229,11 @@ class FormulaAuditor
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
same_name_tap_formulae = Formula.tap_names.select { |f| f =~ %r{^homebrew/[^/]+/#{name}$} }
|
same_name_tap_formulae = Formula.tap_names.select do |tap_formula_name|
|
||||||
homebrew_tapd = HOMEBREW_LIBRARY/"Taps/homebrew"
|
user_name, _, formula_name = tap_formula_name.split("/", 3)
|
||||||
current_taps = if homebrew_tapd.directory?
|
user_name == "homebrew" && formula_name == name
|
||||||
homebrew_tapd.subdirs.map(&:basename).map { |tap| tap.to_s.sub(/^homebrew-/, "") }
|
|
||||||
else
|
|
||||||
[]
|
|
||||||
end
|
end
|
||||||
same_name_tap_formulae += (OFFICIAL_TAPS - current_taps).map do |tap|
|
same_name_tap_formulae += @@remote_official_taps.map do |tap|
|
||||||
Thread.new { Homebrew.search_tap "homebrew", tap, name }
|
Thread.new { Homebrew.search_tap "homebrew", tap, name }
|
||||||
end.map(&:value).flatten
|
end.map(&:value).flatten
|
||||||
same_name_tap_formulae.delete(full_name)
|
same_name_tap_formulae.delete(full_name)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user