diff options
| -rw-r--r-- | Library/Homebrew/dependency.rb | 11 | ||||
| -rw-r--r-- | Library/Homebrew/exceptions.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 26 | 
3 files changed, 27 insertions, 14 deletions
| diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb index 8ddeb90fd..02d981b01 100644 --- a/Library/Homebrew/dependency.rb +++ b/Library/Homebrew/dependency.rb @@ -36,12 +36,15 @@ class Dependency      to_formula.installed?    end -  def satisfied? -    installed? && missing_options.empty? +  def satisfied?(inherited_options) +    installed? && missing_options(inherited_options).empty?    end -  def missing_options -    options - Tab.for_formula(to_formula).used_options - to_formula.build.implicit_options +  def missing_options(inherited_options=[]) +    missing = options | inherited_options +    missing -= Tab.for_formula(to_formula).used_options +    missing -= to_formula.build.implicit_options +    missing    end    def universal! diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index f88b6fc57..6829c17a9 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -92,10 +92,10 @@ class FormulaInstallationAlreadyAttemptedError < Homebrew::InstallationError  end  class UnsatisfiedDependencyError < Homebrew::InstallationError -  def initialize(f, dep) +  def initialize(f, dep, inherited_options)      super f, <<-EOS.undent      #{f} dependency #{dep} not installed with: -      #{dep.missing_options * ', '} +      #{dep.missing_options(inherited_options) * ', '}      EOS    end  end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index e7c8ff0e7..3f3f72235 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -239,9 +239,11 @@ class FormulaInstaller      # because it depends on the contents of ARGV.      pour_bottle = pour_bottle? -    ARGV.filter_for_dependencies do +    inherited_options = {} + +    expanded_deps = ARGV.filter_for_dependencies do        Dependency.expand(f, deps) do |dependent, dep| -        dep.universal! if f.build.universal? && !dep.build? +        options = inherited_options[dep] = inherited_options_for(f, dep)          if (dep.optional? || dep.recommended?) && dependent.build.without?(dep)            Dependency.prune @@ -249,35 +251,43 @@ class FormulaInstaller            Dependency.prune          elsif dep.build? && dependent != f && install_bottle?(dependent)            Dependency.prune -        elsif dep.satisfied? +        elsif dep.satisfied?(options)            Dependency.skip          elsif dep.installed? -          raise UnsatisfiedDependencyError.new(f, dep) +          raise UnsatisfiedDependencyError.new(f, dep, options)          end        end      end + +    expanded_deps.map { |dep| [dep, inherited_options[dep]] } +  end + +  def inherited_options_for(f, dep) +    options = Options.new +    options << Option.new("universal") if f.build.universal? && !dep.build? +    options    end    def install_dependencies(deps)      if deps.length > 1 -      oh1 "Installing dependencies for #{f}: #{Tty.green}#{deps*", "}#{Tty.reset}" +      oh1 "Installing dependencies for #{f}: #{Tty.green}#{deps.map(&:first)*", "}#{Tty.reset}"      end      ARGV.filter_for_dependencies do -      deps.each { |dep| install_dependency(dep) } +      deps.each { |dep, options| install_dependency(dep, options) }      end      @show_header = true unless deps.empty?    end -  def install_dependency dep +  def install_dependency(dep, inherited_options)      df = dep.to_formula      outdated_keg = Keg.new(df.linked_keg.realpath) rescue nil      fi = FormulaInstaller.new(df)      fi.tab = Tab.for_formula(dep.to_formula) -    fi.options = dep.options +    fi.options = dep.options | inherited_options      fi.ignore_deps = true      fi.only_deps = false      fi.show_header = false | 
