From a404ceb29ad49c3829b63bebdceed19385fde3d9 Mon Sep 17 00:00:00 2001 From: Charlie Sharpsteen Date: Sun, 11 Sep 2011 13:16:01 -0700 Subject: brew-upgrade: Fix installation of dependencies Fixes Homebrew/homebrew#7528. Closes Homebrew/homebrew#7572. --- Library/Homebrew/cmd/upgrade.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Library') diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 97d32bbf6..f0682262f 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -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}" } * ", " -- cgit v1.2.3