Inline install_bottle? logic into the installer
This commit is contained in:
		
							parent
							
								
									32ab18c189
								
							
						
					
					
						commit
						7b6fa8b7bb
					
				@ -8,22 +8,6 @@ def bottle_filename options={}
 | 
				
			|||||||
  "#{options[:name]}-#{options[:version]}#{bottle_native_suffix(options)}"
 | 
					  "#{options[:name]}-#{options[:version]}#{bottle_native_suffix(options)}"
 | 
				
			||||||
end
 | 
					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
 | 
					def built_as_bottle? f
 | 
				
			||||||
  return false unless f.installed?
 | 
					  return false unless f.installed?
 | 
				
			||||||
  tab = Tab.for_keg(f.installed_prefix)
 | 
					  tab = Tab.for_keg(f.installed_prefix)
 | 
				
			||||||
 | 
				
			|||||||
@ -38,7 +38,28 @@ class FormulaInstaller
 | 
				
			|||||||
  def pour_bottle? install_bottle_options={:warn=>false}
 | 
					  def pour_bottle? install_bottle_options={:warn=>false}
 | 
				
			||||||
    return false if @pour_failed
 | 
					    return false if @pour_failed
 | 
				
			||||||
    return false if build_from_source || build_bottle
 | 
					    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
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def prelude
 | 
					  def prelude
 | 
				
			||||||
@ -227,7 +248,9 @@ class FormulaInstaller
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
          if (req.optional? || req.recommended?) && build.without?(req)
 | 
					          if (req.optional? || req.recommended?) && build.without?(req)
 | 
				
			||||||
            Requirement.prune
 | 
					            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
 | 
					            Requirement.prune
 | 
				
			||||||
          elsif req.satisfied?
 | 
					          elsif req.satisfied?
 | 
				
			||||||
            Requirement.prune
 | 
					            Requirement.prune
 | 
				
			||||||
@ -258,7 +281,7 @@ class FormulaInstaller
 | 
				
			|||||||
          Dependency.prune
 | 
					          Dependency.prune
 | 
				
			||||||
        elsif dep.build? && dependent == f && pour_bottle?
 | 
					        elsif dep.build? && dependent == f && pour_bottle?
 | 
				
			||||||
          Dependency.prune
 | 
					          Dependency.prune
 | 
				
			||||||
        elsif dep.build? && dependent != f && install_bottle?(dependent)
 | 
					        elsif dep.build? && dependent != f && install_bottle_for_dep?(dependent, build)
 | 
				
			||||||
          Dependency.prune
 | 
					          Dependency.prune
 | 
				
			||||||
        elsif dep.satisfied?(options)
 | 
					        elsif dep.satisfied?(options)
 | 
				
			||||||
          Dependency.skip
 | 
					          Dependency.skip
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user