aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorCharlie Sharpsteen2011-09-11 13:16:01 -0700
committerCharlie Sharpsteen2011-09-16 09:02:02 -0700
commita404ceb29ad49c3829b63bebdceed19385fde3d9 (patch)
treee70933bb192b95a5b21ed2fdf95e86736f2775f6 /Library
parent2492c6564d76d4a000f99f69e1aae85d5a707c10 (diff)
downloadbrew-a404ceb29ad49c3829b63bebdceed19385fde3d9.tar.bz2
brew-upgrade: Fix installation of dependencies
Fixes Homebrew/homebrew#7528. Closes Homebrew/homebrew#7572.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/upgrade.rb9
1 files changed, 9 insertions, 0 deletions
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}" } * ", "