Stop mutating build options in upgrade
This commit is contained in:
parent
0eefded983
commit
de254f6cd6
@ -54,16 +54,10 @@ module Homebrew extend self
|
|||||||
end
|
end
|
||||||
|
|
||||||
def upgrade_formula f
|
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
|
outdated_keg = Keg.new(f.linked_keg.realpath) rescue nil
|
||||||
|
|
||||||
installer = FormulaInstaller.new(f)
|
installer = FormulaInstaller.new(f)
|
||||||
installer.options |= tab.used_options
|
installer.options |= Tab.for_formula(f).used_options
|
||||||
installer.show_header = false
|
installer.show_header = false
|
||||||
|
|
||||||
oh1 "Upgrading #{f.name}"
|
oh1 "Upgrading #{f.name}"
|
||||||
|
|||||||
@ -217,7 +217,9 @@ class FormulaInstaller
|
|||||||
|
|
||||||
ARGV.filter_for_dependencies do
|
ARGV.filter_for_dependencies do
|
||||||
f.recursive_requirements do |dependent, req|
|
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
|
Requirement.prune
|
||||||
elsif req.build? && install_bottle?(dependent)
|
elsif req.build? && install_bottle?(dependent)
|
||||||
Requirement.prune
|
Requirement.prune
|
||||||
@ -248,8 +250,9 @@ class FormulaInstaller
|
|||||||
expanded_deps = ARGV.filter_for_dependencies do
|
expanded_deps = ARGV.filter_for_dependencies do
|
||||||
Dependency.expand(f, deps) do |dependent, dep|
|
Dependency.expand(f, deps) do |dependent, dep|
|
||||||
options = inherited_options[dep] = inherited_options_for(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
|
Dependency.prune
|
||||||
elsif dep.build? && dependent == f && pour_bottle
|
elsif dep.build? && dependent == f && pour_bottle
|
||||||
Dependency.prune
|
Dependency.prune
|
||||||
@ -266,6 +269,16 @@ class FormulaInstaller
|
|||||||
expanded_deps.map { |dep| [dep, inherited_options[dep]] }
|
expanded_deps.map { |dep| [dep, inherited_options[dep]] }
|
||||||
end
|
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)
|
def inherited_options_for(dep)
|
||||||
options = Options.new
|
options = Options.new
|
||||||
if f.build.universal? && !dep.build? && dep.to_formula.build.has_option?("universal")
|
if f.build.universal? && !dep.build? && dep.to_formula.build.has_option?("universal")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user