Remove Formulary::tap_paths again.

This commit is contained in:
Markus Reiter 2024-02-08 21:29:26 +01:00
parent ecee4aed35
commit 0f4d912de5
No known key found for this signature in database
GPG Key ID: 245293B51702655B
2 changed files with 14 additions and 19 deletions

View File

@ -835,16 +835,23 @@ module Homebrew
kegs = Keg.all
deleted_formulae = kegs.map do |keg|
next if Formulary.tap_paths(keg.name).any?
unless EnvConfig.no_install_from_api?
# Formulae installed from the API should not count as deleted formulae
# but may not have a tap listed in their tab
tap = Tab.for_keg(keg).tap
next if (tap.blank? || tap.core_tap?) && Homebrew::API::Formula.all_formulae.key?(keg.name)
loadable = [
Formulary::FromAPILoader,
Formulary::FromNameLoader,
].any? do |loader_class|
if (loader = loader_class.try_new(keg.name, warn: false))
# If we know the tap, ignore all other taps.
next false if tap && loader.tap != tap
next true
end
keg.name
false
end
keg.name unless loadable
end.compact.uniq
return if deleted_formulae.blank?

View File

@ -1172,18 +1172,6 @@ module Formulary
find_formula_in_tap(name.to_s.downcase, CoreTap.instance)
end
def self.tap_paths(name)
name = name.to_s.downcase
Tap.map do |tap|
formula_path = find_formula_in_tap(name, tap)
alias_path = tap.alias_dir/name
next alias_path if !formula_path.exist? && alias_path.exist?
formula_path
end.select(&:file?)
end
sig { params(name: String, tap: Tap).returns(Pathname) }
def self.find_formula_in_tap(name, tap)
filename = if name.end_with?(".rb")