mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Formulary.from_rack: better formula resolution strategy
The flow is as follow: * If tap is nil(DIY install), search using name. * If tap is found, search using full name. * If tap is found and full name searching failed, search using name. This usually means the formula may be migrated to different tap. Closes Homebrew/homebrew#44771. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
5b321ffb5a
commit
60ba8beefa
@ -217,10 +217,15 @@ class Formulary
|
|||||||
tap = tab.tap
|
tap = tab.tap
|
||||||
spec ||= tab.spec
|
spec ||= tab.spec
|
||||||
|
|
||||||
if tap.nil? || tap == "Homebrew/homebrew"
|
if tap.nil?
|
||||||
factory(rack.basename.to_s, spec)
|
factory(rack.basename.to_s, spec)
|
||||||
else
|
else
|
||||||
factory("#{tap.sub("homebrew-", "")}/#{rack.basename}", spec)
|
begin
|
||||||
|
factory("#{tap}/#{rack.basename}", spec)
|
||||||
|
rescue FormulaUnavailableError
|
||||||
|
# formula may be migrated to different tap. Try to search in core and all taps.
|
||||||
|
factory(rack.basename.to_s, spec)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user