From 48918bb5e33440d97c7ce12186b97fb0026e4bbf Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 3 May 2020 14:53:50 +0100 Subject: [PATCH] formula_installer: add fetch_dependency method. This uses `FormulaInstaller#fetch` to recursively fetch dependencies through the dependency tree and allows `install_dependency` to not do any fetching. --- Library/Homebrew/formula_installer.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 7c5e82cba9..9dbb75674e 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -561,6 +561,18 @@ class FormulaInstaller @show_header = true unless deps.empty? end + def fetch_dependency(dep) + df = dep.to_formula + fi = FormulaInstaller.new(df) + + fi.build_from_source = Homebrew.args.build_formula_from_source?(df) + fi.force_bottle = false + fi.verbose = verbose? + fi.quiet = quiet? + fi.debug = debug? + fi.fetch + end + def install_dependency(dep, inherited_options) df = dep.to_formula tab = Tab.for_formula(df) @@ -600,7 +612,6 @@ class FormulaInstaller fi.installed_as_dependency = true fi.installed_on_request = df.any_version_installed? && tab.installed_on_request fi.prelude - fi.fetch oh1 "Installing #{formula.full_name} dependency: #{Formatter.identifier(dep.name)}" fi.install fi.finish @@ -952,9 +963,7 @@ class FormulaInstaller return if deps.empty? || ignore_deps? - deps.each do |dep, _| - dep.to_formula.resources.each(&:fetch) - end + deps.each { |dep, _options| fetch_dependency(dep) } end def fetch