Compute recursive deps for default_formula deps

This commit is contained in:
Jack Nagel 2013-12-09 14:36:10 -06:00
parent 293bde278a
commit 901902b53b

View File

@ -17,7 +17,6 @@ class FormulaInstaller
attr_reader :f attr_reader :f
attr_accessor :tab, :options, :ignore_deps attr_accessor :tab, :options, :ignore_deps
attr_accessor :show_summary_heading, :show_header attr_accessor :show_summary_heading, :show_header
attr_reader :unsatisfied_deps
attr_reader :requirement_deps attr_reader :requirement_deps
def initialize ff def initialize ff
@ -26,7 +25,6 @@ class FormulaInstaller
@ignore_deps = ARGV.ignore_deps? || ARGV.interactive? @ignore_deps = ARGV.ignore_deps? || ARGV.interactive?
@options = Options.new @options = Options.new
@tab = Tab.dummy_tab(ff) @tab = Tab.dummy_tab(ff)
@unsatisfied_deps = []
@requirement_deps = [] @requirement_deps = []
@@attempted ||= Set.new @@attempted ||= Set.new
@ -172,13 +170,11 @@ class FormulaInstaller
perform_readline_hack perform_readline_hack
check_requirements check_requirements
unsatisfied_deps.concat(requirement_deps) deps = [].concat(f.deps).concat(requirement_deps)
unsatisfied_deps.concat(expand_dependencies)
install_dependencies(unsatisfied_deps) install_dependencies expand_dependencies(deps)
ensure ensure
requirement_deps.clear requirement_deps.clear
unsatisfied_deps.clear
end end
def check_requirements def check_requirements
@ -203,21 +199,13 @@ class FormulaInstaller
raise UnsatisfiedRequirements.new(f, fatals) unless fatals.empty? raise UnsatisfiedRequirements.new(f, fatals) unless fatals.empty?
end end
# Dependencies of f that were also explicitly requested on the command line. def expand_dependencies(deps)
# These honor options like --HEAD and --devel.
def requested_deps
f.recursive_dependencies.select { |dep| dep.requested? && !dep.installed? }
end
# All dependencies that we must install before installing f.
# These do not honor flags like --HEAD and --devel.
def necessary_deps
# FIXME: can't check this inside the block for the top-level dependent # FIXME: can't check this inside the block for the top-level dependent
# because it depends on the contents of ARGV. # because it depends on the contents of ARGV.
pour_bottle = pour_bottle? pour_bottle = pour_bottle?
ARGV.filter_for_dependencies do ARGV.filter_for_dependencies do
f.recursive_dependencies do |dependent, dep| Dependency.expand(f, deps) do |dependent, dep|
dep.universal! if f.build.universal? && !dep.build? dep.universal! if f.build.universal? && !dep.build?
if (dep.optional? || dep.recommended?) && dependent.build.without?(dep.name) if (dep.optional? || dep.recommended?) && dependent.build.without?(dep.name)
@ -235,12 +223,6 @@ class FormulaInstaller
end end
end end
# Combine requested_deps and necessary deps.
def expand_dependencies
deps = Set.new.merge(requested_deps).merge(necessary_deps)
f.recursive_dependencies.select { |d| deps.include? d }
end
def install_dependencies(deps) def install_dependencies(deps)
if deps.length > 1 if deps.length > 1
oh1 "Installing dependencies for #{f}: #{Tty.green}#{deps*", "}#{Tty.reset}" oh1 "Installing dependencies for #{f}: #{Tty.green}#{deps*", "}#{Tty.reset}"