Don't install dependencies that are already installed

This commit is contained in:
Max Howell 2009-09-10 14:11:04 +01:00
parent 0a31190fdc
commit fdaa267fb9
2 changed files with 21 additions and 15 deletions

View File

@ -155,7 +155,7 @@ def expand_deps fae
f.deps.each do |name| f.deps.each do |name|
f = Formula.factory name f = Formula.factory name
deps << expand_deps(f) if f.deps # hideous inefficient deps << expand_deps(f) if f.deps # hideous inefficient
deps << f deps << f unless f.installed?
end end
when Hash when Hash
# TODO implement optional and recommended # TODO implement optional and recommended
@ -166,6 +166,7 @@ def expand_deps fae
end end
deps << f deps << f
end end
# TODO much more efficient to use a set and not recurse stuff already done # TODO much more efficient to use a set and not recurse stuff already done
return deps.flatten.uniq return deps.flatten.uniq
end end

View File

@ -91,23 +91,28 @@ begin
end end
end end
unless system "which #{ENV['CC'] or 'cc'} &> /dev/null" and $?.success? unless ARGV.force?
raise "We cannot find a c compiler, have you installed the latest Xcode?" unless system "which #{ENV['CC'] or 'cc'} &> /dev/null" and $?.success?
end raise "We cannot find a c compiler, have you installed the latest Xcode?"
fae = ARGV.formulae.reject do |f|
if f.installed? and not ARGV.force?
message = "Formula already installed: #{f.prefix}"
if ARGV.formulae.count > 1
opoo message
else
puts message # if only one is being installed a warning looks severe
end
true
end end
fae = ARGV.formulae.reject do |f|
if f.installed?
message = "Formula already installed: #{f.prefix}"
if ARGV.formulae.count > 1
opoo message
else
puts message # if only one is being installed a warning looks severe
end
true
end
end
exit 0 if fae.empty?
else
fae=ARGV.formulae
end end
fae=expand_deps ARGV.formulae # the resulting order will be optimal for super-deps and deps
fae=expand_deps fae
require 'beer_events' require 'beer_events'