aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/keg.rb
diff options
context:
space:
mode:
authorAlyssa Ross2016-12-31 13:14:27 +0000
committerAlyssa Ross2016-12-31 17:53:06 +0000
commit8b30abe0600df5c9d3da5b4c31ca88a71a1c3e03 (patch)
tree6f4d26a070a713250b62410eed0aa6e169e8bfdf /Library/Homebrew/keg.rb
parent9fa95d721820919eff3193c3c5bded37f6589831 (diff)
downloadbrew-8b30abe0600df5c9d3da5b4c31ca88a71a1c3e03.tar.bz2
keg: handle dependencies of moved/renamed formulae
In #1497 I switched from Keg#to_formula for comparing kegs to formulae to comparing the name and tap in the keg's tab to the name and tap of the formula. However, this fails to match if the name and tap of the formula have changed since the keg was installed, so it's clearly better to use Keg#to_formula where possible, and fall back to the information in the tab when #to_formula can't be used.
Diffstat (limited to 'Library/Homebrew/keg.rb')
-rw-r--r--Library/Homebrew/keg.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index e64fd9b33..74fd88c2e 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -126,7 +126,18 @@ class Keg
end
keg_names = kegs.map(&:name)
- kegs_by_source = kegs.group_by { |k| [k.name, Tab.for_keg(k).tap] }
+ kegs_by_source = kegs.group_by do |keg|
+ begin
+ # First, attempt to resolve the keg to a formula
+ # to get up-to-date name and tap information.
+ f = keg.to_formula
+ [f.name, f.tap]
+ rescue FormulaUnavailableError
+ # If the formula for the keg can't be found,
+ # fall back to the information in the tab.
+ [keg.name, Tab.for_keg(keg).tap]
+ end
+ end
remaining_formulae.each do |dependent|
required = dependent.missing_dependencies(hide: keg_names)