Audit devel and head deps

This commit is contained in:
Jack Nagel 2014-10-17 00:07:35 -05:00
parent f82efb9d76
commit 73d08fcc1a

View File

@ -117,55 +117,58 @@ class FormulaAuditor
def audit_deps def audit_deps
# Don't depend_on aliases; use full name # Don't depend_on aliases; use full name
@@aliases ||= Formula.aliases @@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. @specs.each do |spec|
# We allow non-Homebrew installs whenever possible. spec.deps.select { |d| @@aliases.include? d.name }.each do |d|
f.deps.each do |dep| real_name = d.to_formula.name
begin problem "Dependency '#{d}' is an alias; use the canonical name '#{real_name}'."
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
dep.options.reject do |opt| # Check for things we don't like to depend on.
next true if dep_f.option_defined?(opt) # We allow non-Homebrew installs whenever possible.
dep_f.requirements.detect do |r| spec.deps.each do |dep|
if r.recommended? begin
opt.name == "with-#{r.name}" dep_f = dep.to_formula
elsif r.optional? rescue TapFormulaUnavailableError
opt.name == "without-#{r.name}" # Don't complain about missing cross-tap dependencies
end next
rescue FormulaUnavailableError
problem "Can't find dependency #{dep.name.inspect}."
next
end end
end.each do |opt|
problem "Dependency #{dep} does not define option #{opt.name.inspect}"
end
case dep.name dep.options.reject do |opt|
when *BUILD_TIME_DEPS next true if dep_f.option_defined?(opt)
next if dep.build? or dep.run? dep_f.requirements.detect do |r|
problem %{#{dep} dependency should be "depends_on '#{dep}' => :build"} if r.recommended?
when "git", "ruby", "mercurial" opt.name == "with-#{r.name}"
problem <<-EOS.undent elsif r.optional?
Don't use #{dep} as a dependency. We allow non-Homebrew opt.name == "without-#{r.name}"
#{dep} installations. end
EOS end
when 'gfortran' end.each do |opt|
problem "Use `depends_on :fortran` instead of `depends_on 'gfortran'`" problem "Dependency #{dep} does not define option #{opt.name.inspect}"
when 'open-mpi', 'mpich2' end
problem <<-EOS.undent
There are multiple conflicting ways to install MPI. Use an MPIDependency: case dep.name
depends_on :mpi => [<lang list>] when *BUILD_TIME_DEPS
Where <lang list> is a comma delimited list that can include: next if dep.build? or dep.run?
:cc, :cxx, :f77, :f90 problem %{#{dep} dependency should be "depends_on '#{dep}' => :build"}
EOS 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 => [<lang list>]
Where <lang list> is a comma delimited list that can include:
:cc, :cxx, :f77, :f90
EOS
end
end end
end end
end end