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}."
|
||||
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
|
||||
formulae_to_install = dependency_graph.tsort & formulae_to_install
|
||||
rescue TSort::Cyclic
|
||||
# Failed to sort formulae topologically because there are cyclic
|
||||
# dependencies. Let FormulaInstaller handle it.
|
||||
raise CyclicDependencyError, dependency_graph.strongly_connected_components if Homebrew::EnvConfig.developer?
|
||||
end
|
||||
|
||||
formula_installers = formulae_to_install.map do |formula|
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user