From 7b6fa8b7bb6538650c6915ec19b17c243ea36229 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Mon, 10 Mar 2014 14:56:02 -0500 Subject: [PATCH] Inline install_bottle? logic into the installer --- Library/Homebrew/bottles.rb | 16 --------------- Library/Homebrew/formula_installer.rb | 29 ++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb index 0c247e5d83..d0ee9941f8 100644 --- a/Library/Homebrew/bottles.rb +++ b/Library/Homebrew/bottles.rb @@ -8,22 +8,6 @@ def bottle_filename options={} "#{options[:name]}-#{options[:version]}#{bottle_native_suffix(options)}" end -def install_bottle? f, options={:warn=>false} - return true if f.local_bottle_path - return true if ARGV.force_bottle? - return false unless f.pour_bottle? - return false unless f.bottle - - unless f.bottle.compatible_cellar? - if options[:warn] - opoo "Building source; cellar of #{f}'s bottle is #{f.bottle.cellar}" - end - return false - end - - true -end - def built_as_bottle? f return false unless f.installed? tab = Tab.for_keg(f.installed_prefix) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index a1f77f52dd..a6e5a71b49 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -38,7 +38,28 @@ class FormulaInstaller def pour_bottle? install_bottle_options={:warn=>false} return false if @pour_failed return false if build_from_source || build_bottle - options.empty? && install_bottle?(f, install_bottle_options) + return false unless options.empty? + + return true if f.local_bottle_path + return true if ARGV.force_bottle? + return false unless f.bottle && f.pour_bottle? + + unless f.bottle.compatible_cellar? + if install_bottle_options[:warn] + opoo "Building source; cellar of #{f}'s bottle is #{f.bottle.cellar}" + end + return false + end + + true + end + + def install_bottle_for_dep?(dep, build) + return false if build_from_source + return false unless dep.bottle && dep.pour_bottle? + return false unless build.used_options.empty? + return false unless dep.bottle.compatible_cellar? + return true end def prelude @@ -227,7 +248,9 @@ class FormulaInstaller if (req.optional? || req.recommended?) && build.without?(req) Requirement.prune - elsif req.build? && install_bottle?(dependent) + elsif req.build? && dependent == f && pour_bottle? + Requirement.prune + elsif req.build? && dependent != f && install_bottle_for_dep?(dependent, build) Requirement.prune elsif req.satisfied? Requirement.prune @@ -258,7 +281,7 @@ class FormulaInstaller Dependency.prune elsif dep.build? && dependent == f && pour_bottle? Dependency.prune - elsif dep.build? && dependent != f && install_bottle?(dependent) + elsif dep.build? && dependent != f && install_bottle_for_dep?(dependent, build) Dependency.prune elsif dep.satisfied?(options) Dependency.skip