Remove FormulaAlreadyInstalledError
install is the only command that can trigger this warning, so it should be handled before instantiating the installer.
This commit is contained in:
parent
f55ad864e0
commit
9a356fc609
@ -25,6 +25,8 @@ module Homebrew
|
|||||||
end unless ARGV.force?
|
end unless ARGV.force?
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
formulae = []
|
||||||
|
|
||||||
ARGV.formulae.each do |f|
|
ARGV.formulae.each do |f|
|
||||||
# Building head-only without --HEAD is an error
|
# Building head-only without --HEAD is an error
|
||||||
if not ARGV.build_head? and f.stable.nil?
|
if not ARGV.build_head? and f.stable.nil?
|
||||||
@ -38,11 +40,19 @@ module Homebrew
|
|||||||
if ARGV.build_head? and f.head.nil?
|
if ARGV.build_head? and f.head.nil?
|
||||||
raise "No head is defined for #{f.name}"
|
raise "No head is defined for #{f.name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if f.installed?
|
||||||
|
msg = "#{f.name}-#{f.installed_version} already installed"
|
||||||
|
msg << ", it's just not linked" unless f.linked_keg.symlink? or f.keg_only?
|
||||||
|
opoo msg
|
||||||
|
else
|
||||||
|
formulae << f
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
perform_preinstall_checks
|
perform_preinstall_checks
|
||||||
|
|
||||||
ARGV.formulae.each { |f| install_formula(f) }
|
formulae.each { |f| install_formula(f) }
|
||||||
rescue FormulaUnavailableError => e
|
rescue FormulaUnavailableError => e
|
||||||
ofail e.message
|
ofail e.message
|
||||||
query = query_regexp(e.name)
|
query = query_regexp(e.name)
|
||||||
@ -126,8 +136,6 @@ module Homebrew
|
|||||||
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
|
||||||
check_macports
|
check_macports
|
||||||
|
@ -31,8 +31,6 @@ module Homebrew
|
|||||||
fi.finish
|
fi.finish
|
||||||
rescue FormulaInstallationAlreadyAttemptedError
|
rescue FormulaInstallationAlreadyAttemptedError
|
||||||
# next
|
# next
|
||||||
rescue FormulaAlreadyInstalledError => e
|
|
||||||
opoo e.message
|
|
||||||
rescue Exception
|
rescue Exception
|
||||||
ignore_interrupts { restore_backup(keg, f) }
|
ignore_interrupts { restore_backup(keg, f) }
|
||||||
raise
|
raise
|
||||||
|
@ -81,8 +81,6 @@ end
|
|||||||
|
|
||||||
class CannotInstallFormulaError < RuntimeError; end
|
class CannotInstallFormulaError < RuntimeError; end
|
||||||
|
|
||||||
class FormulaAlreadyInstalledError < RuntimeError; end
|
|
||||||
|
|
||||||
class FormulaInstallationAlreadyAttemptedError < RuntimeError
|
class FormulaInstallationAlreadyAttemptedError < RuntimeError
|
||||||
def initialize(formula)
|
def initialize(formula)
|
||||||
super "Formula installation already attempted: #{formula.name}"
|
super "Formula installation already attempted: #{formula.name}"
|
||||||
|
@ -104,12 +104,6 @@ class FormulaInstaller
|
|||||||
def check_install_sanity
|
def check_install_sanity
|
||||||
raise FormulaInstallationAlreadyAttemptedError, formula if @@attempted.include?(formula)
|
raise FormulaInstallationAlreadyAttemptedError, formula if @@attempted.include?(formula)
|
||||||
|
|
||||||
if formula.installed?
|
|
||||||
msg = "#{formula.name}-#{formula.installed_version} already installed"
|
|
||||||
msg << ", it's just not linked" unless formula.linked_keg.symlink? or formula.keg_only?
|
|
||||||
raise FormulaAlreadyInstalledError, msg
|
|
||||||
end
|
|
||||||
|
|
||||||
unless ignore_deps?
|
unless ignore_deps?
|
||||||
unlinked_deps = formula.recursive_dependencies.map(&:to_formula).select do |dep|
|
unlinked_deps = formula.recursive_dependencies.map(&:to_formula).select do |dep|
|
||||||
dep.installed? and not dep.keg_only? and not dep.linked_keg.directory?
|
dep.installed? and not dep.keg_only? and not dep.linked_keg.directory?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user