aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-03-10 14:56:02 -0500
committerJack Nagel2014-03-10 14:56:02 -0500
commit7b6fa8b7bb6538650c6915ec19b17c243ea36229 (patch)
tree8ad415d95472ca1ee04953de86d0d60ee5594d62
parent32ab18c189fadace3413985f1ea5cae850afe139 (diff)
downloadbrew-7b6fa8b7bb6538650c6915ec19b17c243ea36229.tar.bz2
Inline install_bottle? logic into the installer
-rw-r--r--Library/Homebrew/bottles.rb16
-rw-r--r--Library/Homebrew/formula_installer.rb29
2 files changed, 26 insertions, 19 deletions
diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb
index 0c247e5d8..d0ee9941f 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 a1f77f52d..a6e5a71b4 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