From 73d08fcc1aa37059db2c0b4810fc8db8719df970 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Fri, 17 Oct 2014 00:07:35 -0500 Subject: [PATCH] Audit devel and head deps --- Library/Homebrew/cmd/audit.rb | 91 ++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index 380afc286c..88b3a819c2 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -117,55 +117,58 @@ class FormulaAuditor def audit_deps # Don't depend_on aliases; use full name @@aliases ||= Formula.aliases - f.deps.select { |d| @@aliases.include? d.name }.each do |d| - real_name = d.to_formula.name - problem "Dependency '#{d}' is an alias; use the canonical name '#{real_name}'." - end - # Check for things we don't like to depend on. - # We allow non-Homebrew installs whenever possible. - f.deps.each do |dep| - begin - dep_f = dep.to_formula - rescue TapFormulaUnavailableError - # Don't complain about missing cross-tap dependencies - next - rescue FormulaUnavailableError - problem "Can't find dependency #{dep.name.inspect}." - next + @specs.each do |spec| + spec.deps.select { |d| @@aliases.include? d.name }.each do |d| + real_name = d.to_formula.name + problem "Dependency '#{d}' is an alias; use the canonical name '#{real_name}'." end - dep.options.reject do |opt| - next true if dep_f.option_defined?(opt) - dep_f.requirements.detect do |r| - if r.recommended? - opt.name == "with-#{r.name}" - elsif r.optional? - opt.name == "without-#{r.name}" - end + # Check for things we don't like to depend on. + # We allow non-Homebrew installs whenever possible. + spec.deps.each do |dep| + begin + dep_f = dep.to_formula + rescue TapFormulaUnavailableError + # Don't complain about missing cross-tap dependencies + next + rescue FormulaUnavailableError + problem "Can't find dependency #{dep.name.inspect}." + next end - end.each do |opt| - problem "Dependency #{dep} does not define option #{opt.name.inspect}" - end - case dep.name - when *BUILD_TIME_DEPS - next if dep.build? or dep.run? - problem %{#{dep} dependency should be "depends_on '#{dep}' => :build"} - when "git", "ruby", "mercurial" - problem <<-EOS.undent - Don't use #{dep} as a dependency. We allow non-Homebrew - #{dep} installations. - EOS - when 'gfortran' - problem "Use `depends_on :fortran` instead of `depends_on 'gfortran'`" - when 'open-mpi', 'mpich2' - problem <<-EOS.undent - There are multiple conflicting ways to install MPI. Use an MPIDependency: - depends_on :mpi => [] - Where is a comma delimited list that can include: - :cc, :cxx, :f77, :f90 - EOS + dep.options.reject do |opt| + next true if dep_f.option_defined?(opt) + dep_f.requirements.detect do |r| + if r.recommended? + opt.name == "with-#{r.name}" + elsif r.optional? + opt.name == "without-#{r.name}" + end + end + end.each do |opt| + problem "Dependency #{dep} does not define option #{opt.name.inspect}" + end + + case dep.name + when *BUILD_TIME_DEPS + next if dep.build? or dep.run? + problem %{#{dep} dependency should be "depends_on '#{dep}' => :build"} + when "git", "ruby", "mercurial" + problem <<-EOS.undent + Don't use #{dep} as a dependency. We allow non-Homebrew + #{dep} installations. + EOS + when 'gfortran' + problem "Use `depends_on :fortran` instead of `depends_on 'gfortran'`" + when 'open-mpi', 'mpich2' + problem <<-EOS.undent + There are multiple conflicting ways to install MPI. Use an MPIDependency: + depends_on :mpi => [] + Where is a comma delimited list that can include: + :cc, :cxx, :f77, :f90 + EOS + end end end end