aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharlie Sharpsteen2011-09-11 13:16:01 -0700
committerCharlie Sharpsteen2011-09-16 09:02:02 -0700
commit5b4d59d143c70167c6c319171ac700068c454de4 (patch)
tree66f7917f6ac3da7bff5e91ed64d904363ba0732e
parent00cd16f866fb341dcbcef6d8333d6bb030f03fee (diff)
downloadhomebrew-5b4d59d143c70167c6c319171ac700068c454de4.tar.bz2
brew-upgrade: Fix installation of dependencies
Fixes #7528. Closes #7572.
-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}" } * ", "