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

View File

@ -91,23 +91,28 @@ begin
end
end
unless system "which #{ENV['CC'] or 'cc'} &> /dev/null" and $?.success?
raise "We cannot find a c compiler, have you installed the latest Xcode?"
end
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
unless ARGV.force?
unless system "which #{ENV['CC'] or 'cc'} &> /dev/null" and $?.success?
raise "We cannot find a c compiler, have you installed the latest Xcode?"
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
fae=expand_deps ARGV.formulae
# the resulting order will be optimal for super-deps and deps
fae=expand_deps fae
require 'beer_events'