Fix support of formulae aliases in taps

Resolves: #16636
This commit is contained in:
Stephan Jorek 2024-02-11 00:38:47 +01:00
parent 6797edf425
commit 1570a4b8a3
No known key found for this signature in database
GPG Key ID: 02A7AB406A7A38D2

View File

@ -906,9 +906,10 @@ module Formulary
user, repo, name = tapped_name.split("/", 3).map(&:downcase) user, repo, name = tapped_name.split("/", 3).map(&:downcase)
tap = Tap.fetch user, repo tap = Tap.fetch user, repo
type = nil type = nil
alias_name = tap.core_tap? ? name : "#{tap}/#{name}"
if (possible_alias = tap.alias_table[name].presence) if (possible_alias = tap.alias_table[alias_name].presence)
name = possible_alias name = possible_alias[HOMEBREW_TAP_FORMULA_REGEX, 3]
type = :alias type = :alias
elsif (new_name = tap.formula_renames[name].presence) elsif (new_name = tap.formula_renames[name].presence)
old_name = name old_name = name
@ -942,14 +943,14 @@ module Formulary
if tap.core_tap? && !Homebrew::EnvConfig.no_install_from_api? if tap.core_tap? && !Homebrew::EnvConfig.no_install_from_api?
if type == :alias if type == :alias
alias_name = tapped_name[HOMEBREW_TAP_FORMULA_REGEX, 3] return AliasAPILoader.new(name)
return AliasAPILoader.new(alias_name)
elsif Homebrew::API::Formula.all_formulae.key?(name) elsif Homebrew::API::Formula.all_formulae.key?(name)
return FormulaAPILoader.new(name) return FormulaAPILoader.new(name)
end end
end end
path = find_formula_in_tap(name, tap) path = find_formula_in_tap(name, tap)
TapLoader.new(name, path, tap: tap) TapLoader.new(name, path, tap: tap)
end end