Fix loading formulae from core tap

This commit is contained in:
Rylan Polster 2021-10-30 23:54:01 -04:00
parent 268a32f0aa
commit ae457a8028
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64
3 changed files with 12 additions and 5 deletions

View File

@ -44,11 +44,6 @@ class Dependency
formula = Formulary.factory(name) formula = Formulary.factory(name)
formula.build = BuildOptions.new(options, formula.options) formula.build = BuildOptions.new(options, formula.options)
formula formula
rescue CoreTapFormulaUnavailableError
raise if !Homebrew::EnvConfig.install_from_api? || !Homebrew::API::Bottle.available?(name)
Homebrew::API::Bottle.fetch_bottles(name)
retry
end end
def unavailable_core_formula? def unavailable_core_formula?

View File

@ -212,6 +212,11 @@ class FormulaInstaller
def verify_deps_exist def verify_deps_exist
begin begin
compute_dependencies compute_dependencies
rescue CoreTapFormulaUnavailableError => e
raise unless Homebrew::API::Bottle.available? e.name
Homebrew::API::Bottle.fetch_bottles(e.name)
retry
rescue TapFormulaUnavailableError => e rescue TapFormulaUnavailableError => e
raise if e.tap.installed? || e.tap.core_tap? raise if e.tap.installed? || e.tap.core_tap?

View File

@ -535,6 +535,13 @@ module Formulary
when URL_START_REGEX when URL_START_REGEX
return FromUrlLoader.new(ref) return FromUrlLoader.new(ref)
when HOMEBREW_TAP_FORMULA_REGEX when HOMEBREW_TAP_FORMULA_REGEX
# If `homebrew/core` is specified and not installed, check whether the formula is already installed.
if ref.start_with?("homebrew/core/") && !CoreTap.instance.installed? && Homebrew::EnvConfig.install_from_api?
name = ref.split("/", 3).last
possible_keg_formula = Pathname.new("#{HOMEBREW_PREFIX}/opt/#{name}/.brew/#{name}.rb")
return FormulaLoader.new(name, possible_keg_formula) if possible_keg_formula.file?
end
return TapLoader.new(ref, from: from) return TapLoader.new(ref, from: from)
end end