aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/keg.rb
diff options
context:
space:
mode:
authorAlyssa Ross2016-12-27 17:26:21 +0000
committerAlyssa Ross2016-12-27 18:03:05 +0000
commite5d7e13c63e7e942f3acdd5c0fac7bed624f52c4 (patch)
tree6c69f7425fec3c2fbd4994ab3b9438d892501ff9 /Library/Homebrew/keg.rb
parent0a20edf9454423537a7f4d3b3659ad56f0151775 (diff)
downloadbrew-e5d7e13c63e7e942f3acdd5c0fac7bed624f52c4.tar.bz2
keg: installed dependencies of unknown formulae
Previously, trying to resolve the dependencies of a keg would raise an exception if the formulae for any of the dependencies could not be found (e.g. if it had been moved to another tap). This commit updates the dependency finding logic to catch these exceptions, and fall back to comparing names and taps of formulae, which should give the correct behaviour. Fixes #1586.
Diffstat (limited to 'Library/Homebrew/keg.rb')
-rw-r--r--Library/Homebrew/keg.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index 1de4ce1f0..3d2d21d69 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -139,6 +139,10 @@ class Keg
raise NotAKegError, "#{path} is not inside a keg"
end
+ def self.all
+ Formula.racks.flat_map(&:subdirs).map { |d| new(d) }
+ end
+
attr_reader :path, :name, :linked_keg_record, :opt_record
protected :path
@@ -353,14 +357,21 @@ class Keg
end
def installed_dependents
- Formula.installed.flat_map(&:installed_kegs).select do |keg|
+ my_tab = Tab.for_keg(self)
+ Keg.all.select do |keg|
tab = Tab.for_keg(keg)
next if tab.runtime_dependencies.nil? # no dependency information saved.
tab.runtime_dependencies.any? do |dep|
# Resolve formula rather than directly comparing names
# in case of conflicts between formulae from different taps.
- dep_formula = Formulary.factory(dep["full_name"])
- dep_formula == to_formula && dep["version"] == version.to_s
+ begin
+ dep_formula = Formulary.factory(dep["full_name"])
+ next false unless dep_formula == to_formula
+ rescue FormulaUnavailableError
+ next false unless my_tab["full_name"] = dep["full_name"]
+ end
+
+ dep["version"] == version.to_s
end
end
end