Don't error out when a package is already installed

Fixes Homebrew/homebrew#17010.
This commit is contained in:
Jack Nagel 2013-04-03 18:26:40 -05:00
parent d25b4e40c1
commit 12932a51b3
3 changed files with 6 additions and 1 deletions

View File

@ -91,6 +91,8 @@ module Homebrew extend self
rescue FormulaInstallationAlreadyAttemptedError rescue FormulaInstallationAlreadyAttemptedError
# We already attempted to install f as part of the dependency tree of # We already attempted to install f as part of the dependency tree of
# another formula. In that case, don't generate an error, just move on. # another formula. In that case, don't generate an error, just move on.
rescue FormulaAlreadyInstalledError => e
opoo e.message
rescue CannotInstallFormulaError => e rescue CannotInstallFormulaError => e
ofail e.message ofail e.message
end end

View File

@ -71,6 +71,9 @@ end
class CannotInstallFormulaError < RuntimeError class CannotInstallFormulaError < RuntimeError
end end
class FormulaAlreadyInstalledError < RuntimeError
end
class FormulaInstallationAlreadyAttemptedError < Homebrew::InstallationError class FormulaInstallationAlreadyAttemptedError < Homebrew::InstallationError
def message def message
"Formula installation already attempted: #{formula}" "Formula installation already attempted: #{formula}"

View File

@ -34,7 +34,7 @@ class FormulaInstaller
if f.installed? if f.installed?
msg = "#{f}-#{f.installed_version} already installed" msg = "#{f}-#{f.installed_version} already installed"
msg << ", it's just not linked" if not f.linked_keg.symlink? and not f.keg_only? msg << ", it's just not linked" if not f.linked_keg.symlink? and not f.keg_only?
raise CannotInstallFormulaError, msg raise FormulaAlreadyInstalledError, msg
end end
# Building head-only without --HEAD is an error # Building head-only without --HEAD is an error