upgrade: fix missed upgrades when an alias is changed to a formula

This commit is contained in:
Bo Anderson 2024-08-03 01:49:40 +01:00
parent 6cfa08333c
commit 993a0aec3a
No known key found for this signature in database

View File

@ -75,33 +75,8 @@ module Homebrew
# Don't need to install this bottle if all of the runtime
# dependencies have the same or newer version already installed.
next if dependents && fi.bottle_tab_runtime_dependencies.presence&.all? do |dependency, hash|
dependency_formula = begin
Formula[dependency]
rescue FormulaUnavailableError
nil
end
next false if dependency_formula.nil?
next true if dependency_formula.latest_version_installed?
installed_version = dependency_formula.any_installed_version
next false unless installed_version
next false if hash["version"].blank?
# Tabs prior to 4.1.18 did not have revision or pkg_version fields.
# As a result, we have to be more conversative when we do not have
# a revision in the tab and assume that if the formula has a
# the same version and a non-zero revision that it needs upgraded.
tab_version = Version.new(hash["version"])
if hash["revision"].present?
tab_pkg_version = PkgVersion.new(tab_version, hash["revision"])
installed_version >= tab_pkg_version
elsif installed_version.version == tab_version
dependency_formula.revision.zero?
else
installed_version.version > tab_version
end
minimum_version = Version.new(hash["version"]) if hash["version"].present?
Dependency.new(dependency).installed?(minimum_version:, minimum_revision: hash["revision"])
end
fi.fetch