brew-upgrade: Fix installation of dependencies

Fixes Homebrew/homebrew#7528.
Closes Homebrew/homebrew#7572.
This commit is contained in:
Charlie Sharpsteen 2011-09-11 13:16:01 -07:00
parent 2492c6564d
commit a404ceb29a

View File

@ -20,6 +20,15 @@ module Homebrew extend self
end
end
# Expand the outdated list to include outdated dependencies then sort and
# reduce such that dependencies are installed first and installation is not
# attempted twice. Sorting is implicit the way `recursive_deps` returns
# root dependencies at the head of the list and `uniq` keeps the first
# element it encounters and discards the rest.
outdated.map!{ |f| f.recursive_deps.reject{ |d| d.installed?} << f }
outdated.flatten!
outdated.uniq!
if outdated.length > 1
oh1 "Upgrading #{outdated.length} outdated package#{outdated.length.plural_s}, with result:"
puts outdated.map{ |f| "#{f.name} #{f.version}" } * ", "