Skip to content
Snippets Groups Projects
Commit 1947173b authored by Mike McQuaid's avatar Mike McQuaid Committed by GitHub
Browse files

Merge pull request #2093 from MikeMcQuaid/detect-recursive-dependencies

formula_installer: detect recursive dependencies.
parents 7ffb036b 42bb19a6
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment