aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2017-02-25 14:21:55 +0000
committerGitHub2017-02-25 14:21:55 +0000
commit1947173b5f9a5f1deab67a2a83af9ac9e1d54c15 (patch)
treedef7748d93993b2a94cc907ba784b6aee46a821a /Library
parent7ffb036b52bbea84026aac274936850eba237d3c (diff)
parent42bb19a6317172804cd149024115f6973fa2fd4f (diff)
downloadbrew-1947173b5f9a5f1deab67a2a83af9ac9e1d54c15.tar.bz2
Merge pull request #2093 from MikeMcQuaid/detect-recursive-dependencies
formula_installer: detect recursive dependencies.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula_installer.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index c9f478bb1..1f91ad5c4 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -151,6 +151,28 @@ class FormulaInstaller
recursive_deps = formula.recursive_dependencies
recursive_formulae = recursive_deps.map(&:to_formula)
+ recursive_dependencies = []
+ recursive_formulae.each do |dep|
+ dep_recursive_dependencies = dep.recursive_dependencies.map(&:to_s)
+ if dep_recursive_dependencies.include?(formula.name)
+ recursive_dependencies << "#{formula.full_name} depends on #{dep.full_name}"
+ recursive_dependencies << "#{dep.full_name} depends on #{formula.full_name}"
+ end
+ end
+
+ unless recursive_dependencies.empty?
+ raise CannotInstallFormulaError, <<-EOS.undent
+ #{formula.full_name} contains a recursive dependency on itself:
+ #{recursive_dependencies.join("\n ")}
+ EOS
+ end
+
+ if recursive_formulae.flat_map(&:recursive_dependencies).map(&:to_s).include?(formula.name)
+ raise CannotInstallFormulaError, <<-EOS.undent
+ #{formula.full_name} contains a recursive dependency on itself!
+ EOS
+ end
+
if ENV["HOMEBREW_CHECK_RECURSIVE_VERSION_DEPENDENCIES"]
version_hash = {}
version_conflicts = Set.new