upgrade: raise error if developer and there are cyclic dependencies
This commit is contained in:
parent
0c3e49092c
commit
c0795b5029
@ -758,3 +758,13 @@ class ShebangDetectionError < RuntimeError
|
|||||||
super "Cannot detect #{type} shebang: #{reason}."
|
super "Cannot detect #{type} shebang: #{reason}."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Raised when one or more formulae have cyclic dependencies.
|
||||||
|
class CyclicDependencyError < RuntimeError
|
||||||
|
def initialize(strongly_connected_components)
|
||||||
|
super <<~EOS
|
||||||
|
The following packages contain cyclic dependencies:
|
||||||
|
#{strongly_connected_components.select { |packages| packages.count > 1 }.map(&:to_sentence).join("\n ")}
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
@ -47,8 +47,7 @@ module Homebrew
|
|||||||
begin
|
begin
|
||||||
formulae_to_install = dependency_graph.tsort & formulae_to_install
|
formulae_to_install = dependency_graph.tsort & formulae_to_install
|
||||||
rescue TSort::Cyclic
|
rescue TSort::Cyclic
|
||||||
# Failed to sort formulae topologically because there are cyclic
|
raise CyclicDependencyError, dependency_graph.strongly_connected_components if Homebrew::EnvConfig.developer?
|
||||||
# dependencies. Let FormulaInstaller handle it.
|
|
||||||
end
|
end
|
||||||
|
|
||||||
formula_installers = formulae_to_install.map do |formula|
|
formula_installers = formulae_to_install.map do |formula|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user