info: show accurate bottle information

This commit is contained in:
Rylan Polster 2021-07-14 18:16:23 -04:00
parent 3e01e02a02
commit fb04053833
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64

View File

@ -243,7 +243,16 @@ module Homebrew
def info_formula(f, args:) def info_formula(f, args:)
specs = [] specs = []
if (stable = f.stable) if ENV["HOMEBREW_JSON_CORE"].present? && BottleAPI.bottle_available?(f.name)
info = BottleAPI.fetch(f.name)
latest_version = info["pkg_version"].split("_").first
bottle_exists = info["bottles"].key?(Utils::Bottles.tag.to_s) || info["bottles"].key?("all")
s = "stable #{latest_version}"
s += " (bottled)" if bottle_exists
specs << s
elsif (stable = f.stable)
latest_version = BottleAPI.latest_pkg_version(f.name).version if ENV["HOMEBREW_JSON_CORE"].present? latest_version = BottleAPI.latest_pkg_version(f.name).version if ENV["HOMEBREW_JSON_CORE"].present?
latest_version ||= stable.version latest_version ||= stable.version