Spell out formula in parameter and attribute names
This commit is contained in:
		
							parent
							
								
									b46f8caa8f
								
							
						
					
					
						commit
						889996daf1
					
				@ -11,10 +11,10 @@ require "debrew" if ARGV.debug?
 | 
				
			|||||||
require "fcntl"
 | 
					require "fcntl"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Build
 | 
					class Build
 | 
				
			||||||
  attr_reader :f, :deps, :reqs
 | 
					  attr_reader :formula, :deps, :reqs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def initialize(f)
 | 
					  def initialize(formula)
 | 
				
			||||||
    @f = f
 | 
					    @formula = formula
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ARGV.ignore_deps?
 | 
					    if ARGV.ignore_deps?
 | 
				
			||||||
      @deps = []
 | 
					      @deps = []
 | 
				
			||||||
@ -28,14 +28,14 @@ class Build
 | 
				
			|||||||
  def post_superenv_hacks
 | 
					  def post_superenv_hacks
 | 
				
			||||||
    # Only allow Homebrew-approved directories into the PATH, unless
 | 
					    # Only allow Homebrew-approved directories into the PATH, unless
 | 
				
			||||||
    # a formula opts-in to allowing the user's path.
 | 
					    # a formula opts-in to allowing the user's path.
 | 
				
			||||||
    if f.env.userpaths? || reqs.any? { |rq| rq.env.userpaths? }
 | 
					    if formula.env.userpaths? || reqs.any? { |rq| rq.env.userpaths? }
 | 
				
			||||||
      ENV.userpaths!
 | 
					      ENV.userpaths!
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def pre_superenv_hacks
 | 
					  def pre_superenv_hacks
 | 
				
			||||||
    # Allow a formula to opt-in to the std environment.
 | 
					    # Allow a formula to opt-in to the std environment.
 | 
				
			||||||
    if (f.env.std? || deps.any? { |d| d.name == "scons" }) && ARGV.env != "super"
 | 
					    if (formula.env.std? || deps.any? { |d| d.name == "scons" }) && ARGV.env != "super"
 | 
				
			||||||
      ARGV.unshift "--env=std"
 | 
					      ARGV.unshift "--env=std"
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@ -47,11 +47,11 @@ class Build
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def expand_reqs
 | 
					  def expand_reqs
 | 
				
			||||||
    f.recursive_requirements do |dependent, req|
 | 
					    formula.recursive_requirements do |dependent, req|
 | 
				
			||||||
      build = effective_build_options_for(dependent)
 | 
					      build = effective_build_options_for(dependent)
 | 
				
			||||||
      if (req.optional? || req.recommended?) && build.without?(req)
 | 
					      if (req.optional? || req.recommended?) && build.without?(req)
 | 
				
			||||||
        Requirement.prune
 | 
					        Requirement.prune
 | 
				
			||||||
      elsif req.build? && dependent != f
 | 
					      elsif req.build? && dependent != formula
 | 
				
			||||||
        Requirement.prune
 | 
					        Requirement.prune
 | 
				
			||||||
      elsif req.satisfied? && req.default_formula? && (dep = req.to_dependency).installed?
 | 
					      elsif req.satisfied? && req.default_formula? && (dep = req.to_dependency).installed?
 | 
				
			||||||
        deps << dep
 | 
					        deps << dep
 | 
				
			||||||
@ -61,11 +61,11 @@ class Build
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def expand_deps
 | 
					  def expand_deps
 | 
				
			||||||
    f.recursive_dependencies do |dependent, dep|
 | 
					    formula.recursive_dependencies do |dependent, dep|
 | 
				
			||||||
      build = effective_build_options_for(dependent)
 | 
					      build = effective_build_options_for(dependent)
 | 
				
			||||||
      if (dep.optional? || dep.recommended?) && build.without?(dep)
 | 
					      if (dep.optional? || dep.recommended?) && build.without?(dep)
 | 
				
			||||||
        Dependency.prune
 | 
					        Dependency.prune
 | 
				
			||||||
      elsif dep.build? && dependent != f
 | 
					      elsif dep.build? && dependent != formula
 | 
				
			||||||
        Dependency.prune
 | 
					        Dependency.prune
 | 
				
			||||||
      elsif dep.build?
 | 
					      elsif dep.build?
 | 
				
			||||||
        Dependency.keep_but_prune_recursive_deps
 | 
					        Dependency.keep_but_prune_recursive_deps
 | 
				
			||||||
@ -87,12 +87,12 @@ class Build
 | 
				
			|||||||
      ENV.keg_only_deps = keg_only_deps.map(&:name)
 | 
					      ENV.keg_only_deps = keg_only_deps.map(&:name)
 | 
				
			||||||
      ENV.deps = deps.map { |d| d.to_formula.name }
 | 
					      ENV.deps = deps.map { |d| d.to_formula.name }
 | 
				
			||||||
      ENV.x11 = reqs.any? { |rq| rq.kind_of?(X11Dependency) }
 | 
					      ENV.x11 = reqs.any? { |rq| rq.kind_of?(X11Dependency) }
 | 
				
			||||||
      ENV.setup_build_environment(f)
 | 
					      ENV.setup_build_environment(formula)
 | 
				
			||||||
      post_superenv_hacks
 | 
					      post_superenv_hacks
 | 
				
			||||||
      reqs.each(&:modify_build_environment)
 | 
					      reqs.each(&:modify_build_environment)
 | 
				
			||||||
      deps.each(&:modify_build_environment)
 | 
					      deps.each(&:modify_build_environment)
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      ENV.setup_build_environment(f)
 | 
					      ENV.setup_build_environment(formula)
 | 
				
			||||||
      reqs.each(&:modify_build_environment)
 | 
					      reqs.each(&:modify_build_environment)
 | 
				
			||||||
      deps.each(&:modify_build_environment)
 | 
					      deps.each(&:modify_build_environment)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -107,7 +107,7 @@ class Build
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    f.brew do
 | 
					    formula.brew do
 | 
				
			||||||
      if ARGV.flag? '--git'
 | 
					      if ARGV.flag? '--git'
 | 
				
			||||||
        system "git", "init"
 | 
					        system "git", "init"
 | 
				
			||||||
        system "git", "add", "-A"
 | 
					        system "git", "add", "-A"
 | 
				
			||||||
@ -115,7 +115,7 @@ class Build
 | 
				
			|||||||
      if ARGV.interactive?
 | 
					      if ARGV.interactive?
 | 
				
			||||||
        ohai "Entering interactive mode"
 | 
					        ohai "Entering interactive mode"
 | 
				
			||||||
        puts "Type `exit' to return and finalize the installation"
 | 
					        puts "Type `exit' to return and finalize the installation"
 | 
				
			||||||
        puts "Install to this prefix: #{f.prefix}"
 | 
					        puts "Install to this prefix: #{formula.prefix}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ARGV.flag? '--git'
 | 
					        if ARGV.flag? '--git'
 | 
				
			||||||
          puts "This directory is now a git repo. Make your changes and then use:"
 | 
					          puts "This directory is now a git repo. Make your changes and then use:"
 | 
				
			||||||
@ -123,34 +123,34 @@ class Build
 | 
				
			|||||||
          puts "to copy the diff to the clipboard."
 | 
					          puts "to copy the diff to the clipboard."
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        interactive_shell f
 | 
					        interactive_shell(formula)
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        f.prefix.mkpath
 | 
					        formula.prefix.mkpath
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        f.resources.each { |r| r.extend(ResourceDebugger) } if ARGV.debug?
 | 
					        formula.resources.each { |r| r.extend(ResourceDebugger) } if ARGV.debug?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        begin
 | 
					        begin
 | 
				
			||||||
          f.install
 | 
					          formula.install
 | 
				
			||||||
        rescue Exception => e
 | 
					        rescue Exception => e
 | 
				
			||||||
          if ARGV.debug?
 | 
					          if ARGV.debug?
 | 
				
			||||||
            debrew e, f
 | 
					            debrew(e, formula)
 | 
				
			||||||
          else
 | 
					          else
 | 
				
			||||||
            raise e
 | 
					            raise
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        stdlibs = detect_stdlibs
 | 
					        stdlibs = detect_stdlibs
 | 
				
			||||||
        Tab.create(f, ENV.compiler, stdlibs.first, f.build).write
 | 
					        Tab.create(formula, ENV.compiler, stdlibs.first, formula.build).write
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Find and link metafiles
 | 
					        # Find and link metafiles
 | 
				
			||||||
        f.prefix.install_metafiles Pathname.pwd
 | 
					        formula.prefix.install_metafiles Pathname.pwd
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def detect_stdlibs
 | 
					  def detect_stdlibs
 | 
				
			||||||
    keg = Keg.new(f.prefix)
 | 
					    keg = Keg.new(formula.prefix)
 | 
				
			||||||
    CxxStdlib.check_compatibility(f, deps, keg, ENV.compiler)
 | 
					    CxxStdlib.check_compatibility(formula, deps, keg, ENV.compiler)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # The stdlib recorded in the install receipt is used during dependency
 | 
					    # The stdlib recorded in the install receipt is used during dependency
 | 
				
			||||||
    # compatibility checks, so we only care about the stdlib that libraries
 | 
					    # compatibility checks, so we only care about the stdlib that libraries
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user