mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
outdated/upgrade: fix upgrade alias edge case.
If you're going to follow an alias to find the outdated formula then ensure that the latest one isn't already installed. Fixes https://github.com/Homebrew/homebrew-core/issues/63971
This commit is contained in:
parent
0e36cdcf0f
commit
0606c9fd82
@ -97,7 +97,7 @@ module Homebrew
|
|||||||
if verbose?
|
if verbose?
|
||||||
outdated_kegs = f.outdated_kegs(fetch_head: args.fetch_HEAD?)
|
outdated_kegs = f.outdated_kegs(fetch_head: args.fetch_HEAD?)
|
||||||
|
|
||||||
current_version = if f.alias_changed?
|
current_version = if f.alias_changed? && !f.latest_formula.latest_version_installed?
|
||||||
latest = f.latest_formula
|
latest = f.latest_formula
|
||||||
"#{latest.name} (#{latest.pkg_version})"
|
"#{latest.name} (#{latest.pkg_version})"
|
||||||
elsif f.head? && outdated_kegs.any? { |k| k.version.to_s == f.pkg_version.to_s }
|
elsif f.head? && outdated_kegs.any? { |k| k.version.to_s == f.pkg_version.to_s }
|
||||||
|
@ -137,7 +137,14 @@ module Homebrew
|
|||||||
|
|
||||||
pinned = outdated.select(&:pinned?)
|
pinned = outdated.select(&:pinned?)
|
||||||
outdated -= pinned
|
outdated -= pinned
|
||||||
formulae_to_install = outdated.map(&:latest_formula)
|
formulae_to_install = outdated.map do |f|
|
||||||
|
f_latest = f.latest_formula
|
||||||
|
if f_latest.latest_version_installed?
|
||||||
|
f
|
||||||
|
else
|
||||||
|
f_latest
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if !pinned.empty? && !args.ignore_pinned?
|
if !pinned.empty? && !args.ignore_pinned?
|
||||||
ofail "Not upgrading #{pinned.count} pinned #{"package".pluralize(pinned.count)}:"
|
ofail "Not upgrading #{pinned.count} pinned #{"package".pluralize(pinned.count)}:"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user