diff options
| author | Jack Nagel | 2013-06-09 13:44:59 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-06-09 13:45:25 -0500 |
| commit | 70069c5d75fe57620ee015fe63a80fa7365b0489 (patch) | |
| tree | 16b41b5eb4985a1949f5ddfac0c140a530714ce7 /Library/Homebrew/exceptions.rb | |
| parent | a1984aa3b8d847666984e4711fd0e5dd63201ed1 (diff) | |
| download | homebrew-70069c5d75fe57620ee015fe63a80fa7365b0489.tar.bz2 | |
Separate formula conflicts from requirements
Closes #20357.
Diffstat (limited to 'Library/Homebrew/exceptions.rb')
| -rw-r--r-- | Library/Homebrew/exceptions.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 9c812ce34..71ce3eccd 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -115,6 +115,38 @@ class UnsatisfiedRequirements < Homebrew::InstallationError end end +class FormulaConflictError < Homebrew::InstallationError + attr_reader :f, :conflicts + + def initialize(f, conflicts) + @f = f + @conflicts = conflicts + super f, message + end + + def conflict_message(conflict) + message = [] + message << " #{conflict.name}" + message << ": because #{conflict.reason}" if conflict.reason + message.join + end + + def message + message = [] + message << "Cannot install #{f.name} because conflicting formulae are installed.\n" + message.concat conflicts.map { |c| conflict_message(c) } << "" + message << <<-EOS.undent + Please `brew unlink #{conflicts.map(&:name)*' '}` before continuing. + + Unlinking removes a formula's symlinks from #{HOMEBREW_PREFIX}. You can + link the formula again after the install finishes. You can --force this + install, but the build may fail or cause obscure side-effects in the + resulting software. + EOS + message.join("\n") + end +end + class BuildError < Homebrew::InstallationError attr_reader :exit_status, :command, :env |
