diff options
| author | Jack Nagel | 2014-03-02 14:02:18 -0600 | 
|---|---|---|
| committer | Jack Nagel | 2014-03-02 14:02:18 -0600 | 
| commit | 939da295e778e18c66d507968be79412f4d189f2 (patch) | |
| tree | 2769695f3ae44c67d81b17dd6998d74b7606d6cd | |
| parent | fac94c0d08d0192dfdc0511492c9c79382575293 (diff) | |
| download | homebrew-939da295e778e18c66d507968be79412f4d189f2.tar.bz2 | |
Stop mutating build options in upgrade
| -rw-r--r-- | Library/Homebrew/cmd/upgrade.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 17 | 
2 files changed, 16 insertions, 9 deletions
| diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index d222c5a98..644e61184 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -54,16 +54,10 @@ module Homebrew extend self    end    def upgrade_formula f -    tab = Tab.for_formula(f) - -    # Inject options from a previous install into the formula's -    # BuildOptions object. TODO clean this up. -    f.build.args += tab.used_options -      outdated_keg = Keg.new(f.linked_keg.realpath) rescue nil      installer = FormulaInstaller.new(f) -    installer.options |= tab.used_options +    installer.options |= Tab.for_formula(f).used_options      installer.show_header = false      oh1 "Upgrading #{f.name}" diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 93c3f7a84..c1ea8b9d5 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -217,7 +217,9 @@ class FormulaInstaller        ARGV.filter_for_dependencies do          f.recursive_requirements do |dependent, req| -          if (req.optional? || req.recommended?) && dependent.build.without?(req) +          build = effective_build_options_for(dependent) + +          if (req.optional? || req.recommended?) && build.without?(req)              Requirement.prune            elsif req.build? && install_bottle?(dependent)              Requirement.prune @@ -248,8 +250,9 @@ class FormulaInstaller      expanded_deps = ARGV.filter_for_dependencies do        Dependency.expand(f, deps) do |dependent, dep|          options = inherited_options[dep] = inherited_options_for(dep) +        build = effective_build_options_for(dependent) -        if (dep.optional? || dep.recommended?) && dependent.build.without?(dep) +        if (dep.optional? || dep.recommended?) && build.without?(dep)            Dependency.prune          elsif dep.build? && dependent == f && pour_bottle            Dependency.prune @@ -266,6 +269,16 @@ class FormulaInstaller      expanded_deps.map { |dep| [dep, inherited_options[dep]] }    end +  def effective_build_options_for(dependent) +    if dependent == f +      build = dependent.build.dup +      build.args |= options +      build +    else +      dependent.build +    end +  end +    def inherited_options_for(dep)      options = Options.new      if f.build.universal? && !dep.build? && dep.to_formula.build.has_option?("universal") | 
