missing: ignore unused optional and recommended deps

This commit is contained in:
Jack Nagel 2013-01-23 00:26:28 -06:00
parent cf08b71bf8
commit fe802f05ef
2 changed files with 13 additions and 13 deletions

View File

@ -872,7 +872,7 @@ end
def check_missing_deps
return unless HOMEBREW_CELLAR.exist?
s = Set.new
Homebrew.missing_deps(Homebrew.installed_brews).each do |_, deps|
Homebrew.missing_deps(Formula.installed).each do |_, deps|
s.merge deps
end

View File

@ -1,21 +1,21 @@
require 'formula'
require 'tab'
module Homebrew extend self
def installed_brews
formulae = []
HOMEBREW_CELLAR.subdirs.each do |rack|
f = Formula.factory rack.basename.to_s rescue nil
formulae << f if f and f.rack.exist? and f.rack.subdirs.length > 0
end
formulae
end
def missing_deps ff
missing = {}
ff.each do |f|
missing_deps = f.recursive_deps.uniq.reject do |dep|
dep.rack.exist? and dep.rack.subdirs.length > 0
missing_deps = f.recursive_dependencies do |dependent, dep|
if dep.optional? || dep.recommended?
tab = Tab.for_formula(dependent)
Dependency.prune unless tab.with?(dep.name)
elsif dep.build?
Dependency.prune
end
end
missing_deps.map!(&:to_formula)
missing_deps.reject! { |d| d.rack.exist? && d.rack.subdirs.length > 0 }
unless missing_deps.empty?
yield f.name, missing_deps if block_given?
@ -29,7 +29,7 @@ module Homebrew extend self
return unless HOMEBREW_CELLAR.exist?
ff = if ARGV.named.empty?
installed_brews
Formula.installed
else
ARGV.formulae
end