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

View File

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