Merge pull request #3915 from MikeMcQuaid/only-dependencies-fill-in

install: make --only-dependencies fill in missing.
This commit is contained in:
Mike McQuaid 2018-03-14 09:23:28 +00:00 committed by GitHub
commit c8533db23f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -159,6 +159,8 @@ module Homebrew
#{f.full_name} #{optlinked_version} is already installed
To upgrade to #{f.version}, run `brew upgrade #{f.name}`
EOS
elsif ARGV.only_deps?
formulae << f
else
opoo <<~EOS
#{f.full_name} #{f.pkg_version} is already installed
@ -188,8 +190,11 @@ module Homebrew
#{msg}, it's just not linked.
You can use `brew link #{f}` to link this version.
EOS
elsif ARGV.only_deps?
msg = nil
formulae << f
end
opoo msg
opoo msg if msg
elsif !f.any_version_installed? && old_formula = f.old_installed_formulae.first
msg = "#{old_formula.full_name} #{old_formula.installed_version} already installed"
if !old_formula.linked? && !old_formula.keg_only?

View File

@ -224,17 +224,19 @@ class FormulaInstaller
message = <<~EOS
#{formula.name} #{formula.linked_version} is already installed
EOS
message += if formula.outdated? && !formula.head?
<<~EOS
if formula.outdated? && !formula.head?
message += <<~EOS
To upgrade to #{formula.pkg_version}, run `brew upgrade #{formula.name}`
EOS
elsif only_deps?
message = nil
else
# some other version is already installed *and* linked
<<~EOS
message += <<~EOS
To install #{formula.pkg_version}, first run `brew unlink #{formula.name}`
EOS
end
raise CannotInstallFormulaError, message
raise CannotInstallFormulaError, message if message
end
# Warn if a more recent version of this formula is available in the tap.