Unverified Commit 9daf5e2d authored by Rylan Polster's avatar Rylan Polster Committed by GitHub
Browse files

Merge pull request #12350 from Rylan12/install-from-api-core-deps

Handle `depends_on "homebrew/core/foo"` for `HOMEBREW_INSTALL_FROM_API`
parents 85077472 5f4d4fb3
......@@ -212,6 +212,11 @@ class FormulaInstaller
def verify_deps_exist
begin
compute_dependencies
rescue CoreTapFormulaUnavailableError => e
raise unless Homebrew::API::Bottle.available? e.name
Homebrew::API::Bottle.fetch_bottles(e.name)
retry
rescue TapFormulaUnavailableError => e
raise if e.tap.installed?
......
......@@ -343,6 +343,10 @@ module Formulary
rescue FormulaClassUnavailableError => e
raise TapFormulaClassUnavailableError.new(tap, name, e.path, e.class_name, e.class_list), "", e.backtrace
rescue FormulaUnavailableError => e
if tap.core_tap? && Homebrew::EnvConfig.install_from_api?
raise CoreTapFormulaUnavailableError.new(name), "", e.backtrace
end
raise TapFormulaUnavailableError.new(tap, name), "", e.backtrace
end
......@@ -533,6 +537,13 @@ module Formulary
when URL_START_REGEX
return FromUrlLoader.new(ref)
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)
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment