aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/install.rb
diff options
context:
space:
mode:
authorJack Nagel2013-01-08 19:54:32 -0600
committerJack Nagel2013-01-10 16:46:54 -0600
commit5c799ef8c8720306a9dfb4db1e47f647e06f9857 (patch)
tree5dec20f3007bc3aa74dfdab66213925d79277f9e /Library/Homebrew/cmd/install.rb
parent4291bc29db9b41554a5913b4dc28e62058f96652 (diff)
downloadbrew-5c799ef8c8720306a9dfb4db1e47f647e06f9857.tar.bz2
Don't attempt installation multiple times
When a dependency of a formula specified on the command-line is also specified, *after* the dependent formula, installation proceeds as part of the dependent's dependency tree and then is attempted again because the user asked for it explicitly. This results in the installer raising a CannotInstallFormulaError because it has already been installed. For example: $ brew install graphviz pkg-config ==> Installing graphviz dependency: pkg-config ... ==> Installing graphviz ... Error: pkg-config-0.27.1 already installed We already have a mechanism for dealing with this, but it does not kick in early enough. Move the installation attempt check into FormulaInstaller#check_install_sanity and catch the exception in the appropriate places. Fixes Homebrew/homebrew#16957.
Diffstat (limited to 'Library/Homebrew/cmd/install.rb')
-rw-r--r--Library/Homebrew/cmd/install.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 90acb0774..ef01d0452 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -78,16 +78,20 @@ module Homebrew extend self
unless formulae.empty?
perform_preinstall_checks
formulae.each do |f|
- begin
- fi = FormulaInstaller.new(f)
- fi.install
- fi.caveats
- fi.finish
- rescue CannotInstallFormulaError => e
- ofail e.message
- end
+ install_formula(f)
end
end
end
+ def install_formula f
+ fi = FormulaInstaller.new(f)
+ fi.install
+ fi.caveats
+ fi.finish
+ rescue FormulaInstallationAlreadyAttemptedError
+ # 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.
+ rescue CannotInstallFormulaError => e
+ ofail e.message
+ end
end