diff options
| author | Jack Nagel | 2014-08-11 17:48:30 -0500 | 
|---|---|---|
| committer | Jack Nagel | 2014-08-11 17:48:30 -0500 | 
| commit | b7b8b88cea98ed4b24b813f13d7b06b538090fa6 (patch) | |
| tree | 1206e0721ffadbcf25c2d44740b22c2a69ad2a80 | |
| parent | 0b468c528c9207b2e43455f02e3042080abd19ca (diff) | |
| download | brew-b7b8b88cea98ed4b24b813f13d7b06b538090fa6.tar.bz2 | |
Replace the build object rather than mutate it
| -rw-r--r-- | Library/Homebrew/build_options.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/dependency.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 12 | 
3 files changed, 7 insertions, 15 deletions
| diff --git a/Library/Homebrew/build_options.rb b/Library/Homebrew/build_options.rb index e104a870a..58348da8a 100644 --- a/Library/Homebrew/build_options.rb +++ b/Library/Homebrew/build_options.rb @@ -1,7 +1,6 @@  require 'options'  class BuildOptions -  attr_accessor :args    attr_accessor :universal    def initialize(args, options) @@ -15,7 +14,7 @@ class BuildOptions    end    def include? name -    args.include? '--' + name +    @args.include?("--#{name}")    end    def with? val diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb index d3e8b607a..dfb337446 100644 --- a/Library/Homebrew/dependency.rb +++ b/Library/Homebrew/dependency.rb @@ -29,10 +29,9 @@ class Dependency    end    def to_formula -    f = Formulary.factory(name) -    # Add this dependency's options to the formula's build args -    f.build.args = f.build.args.concat(options) -    f +    formula = Formulary.factory(name) +    formula.build = BuildOptions.new(options, formula.options) +    formula    end    def installed? diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 63b7fa0df..266d005a2 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -303,15 +303,9 @@ class FormulaInstaller    end    def effective_build_options_for(dependent, inherited_options=[]) -    if dependent == f -      build = dependent.build.dup -      build.args |= options -      build -    else -      build = dependent.build.dup -      build.args |= inherited_options -      build -    end +    args  = dependent.build.used_options +    args |= dependent == f ? options : inherited_options +    BuildOptions.new(args, dependent.options)    end    def inherited_options_for(dep) | 
