From 7b97dca554459892f11f7ee28aa7eb12c763a549 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Fri, 25 Sep 2015 21:06:07 +0800 Subject: [PATCH] use `skip_deps_check?` instead of `ignore_deps?` hack We previously set `ignore_deps?` as true for DependencyInstaller to avoid duplicated dependencies resolution. (See a9fc82aea30506eeacbddeb8b53fb85de8acb9d4) However, this will cause problem when pouring bottle of a dependency is failed. In this case, it will try to build dependency from source but failed due to uninstalled build deps for this formula. Another disadvantage for using `ignore_deps?` hack is we cannot distinguish users passing `--ignore-dependencies` flag from we are in `DependencyInstaller`. So, let's differentiate these using `skip_deps_check?` --- Library/Homebrew/formula_installer.rb | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index caf4a7475f..0ac94a40ca 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -56,6 +56,10 @@ class FormulaInstaller @pour_failed = false end + def skip_deps_check? + ignore_deps? + end + # When no build tools are available and build flags are passed through ARGV, # it's necessary to interrupt the user before any sort of installation # can proceed. Only invoked when the user has no developer tools. @@ -97,7 +101,7 @@ class FormulaInstaller end def prelude - verify_deps_exist unless ignore_deps? + verify_deps_exist unless skip_deps_check? lock check_install_sanity end @@ -120,7 +124,7 @@ class FormulaInstaller def check_install_sanity raise FormulaInstallationAlreadyAttemptedError, formula if @@attempted.include?(formula) - unless ignore_deps? + unless skip_deps_check? unlinked_deps = formula.recursive_dependencies.map(&:to_formula).select do |dep| dep.installed? && !dep.keg_only? && !dep.linked_keg.directory? end @@ -159,7 +163,7 @@ class FormulaInstaller raise BuildToolsError.new([formula]) end - unless ignore_deps? + unless skip_deps_check? deps = compute_dependencies check_dependencies_bottled(deps) if pour_bottle? && !MacOS.has_apple_developer_tools? install_dependencies(deps) @@ -364,15 +368,8 @@ class FormulaInstaller end class DependencyInstaller < FormulaInstaller - def initialize(*) - super - @ignore_deps = true - end - - def sanitized_ARGV_options - args = super - args.delete "--ignore-dependencies" - args + def skip_deps_check? + true end end