Stop mutating build options in upgrade
This commit is contained in:
parent
0eefded983
commit
de254f6cd6
@ -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}"
|
||||
|
||||
@ -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")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user