BottleAPI: only fetch dependencies if they are outdated locally
This commit is contained in:
parent
a0f7711ab6
commit
98713e9cd1
@ -71,6 +71,14 @@ module BottleAPI
|
|||||||
download_bottle(hash, bottle_tag)
|
download_bottle(hash, bottle_tag)
|
||||||
|
|
||||||
hash["dependencies"].each do |dep_hash|
|
hash["dependencies"].each do |dep_hash|
|
||||||
|
existing_formula = begin
|
||||||
|
Formulary.factory dep_hash["name"]
|
||||||
|
rescue FormulaUnavailableError
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
next if existing_formula.present? && existing_formula.latest_version_installed?
|
||||||
|
|
||||||
download_bottle(dep_hash, bottle_tag)
|
download_bottle(dep_hash, bottle_tag)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -520,7 +520,13 @@ class Formula
|
|||||||
# exists and is not empty.
|
# exists and is not empty.
|
||||||
# @private
|
# @private
|
||||||
def latest_version_installed?
|
def latest_version_installed?
|
||||||
(dir = latest_installed_prefix).directory? && !dir.children.empty?
|
latest_prefix = if ENV["HOMEBREW_JSON_CORE"].present?
|
||||||
|
prefix BottleAPI.latest_pkg_version(name)
|
||||||
|
else
|
||||||
|
latest_installed_prefix
|
||||||
|
end
|
||||||
|
|
||||||
|
(dir = latest_prefix).directory? && !dir.children.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
# If at least one version of {Formula} is installed.
|
# If at least one version of {Formula} is installed.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user