diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index d555e99d22..1b17af76c6 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -612,11 +612,10 @@ module Homebrew metadata = SharedAudits.eol_data(name, formula.version.major.to_s) metadata ||= SharedAudits.eol_data(name, formula.version.major_minor.to_s) - return if metadata.blank? || (eol = metadata["eol"]).blank? + return if metadata.blank? || (metadata.dig("result", "isEol") != true) - is_eol = eol == true - is_eol ||= eol.is_a?(String) && (eol_date = Date.parse(eol)) <= Date.today - return unless is_eol + eol_from = metadata.dig("result", "eolFrom") + eol_date = Date.parse(eol_from) if eol_from.present? message = "Product is EOL" message += " since #{eol_date}" if eol_date.present? diff --git a/Library/Homebrew/utils/shared_audits.rb b/Library/Homebrew/utils/shared_audits.rb index 9ba8c9f9ac..2269e0ab1e 100644 --- a/Library/Homebrew/utils/shared_audits.rb +++ b/Library/Homebrew/utils/shared_audits.rb @@ -12,10 +12,15 @@ module SharedAudits def self.eol_data(product, cycle) @eol_data ||= T.let({}, T.nilable(T::Hash[String, T.untyped])) @eol_data["#{product}/#{cycle}"] ||= begin - result = Utils::Curl.curl_output("--location", "https://endoflife.date/api/#{product}/#{cycle}.json") - json = JSON.parse(result.stdout) if result.status.success? - json = nil if json&.dig("message")&.include?("Product not found") - json + result = Utils::Curl.curl_output("--location", "https://endoflife.date/api/v1/products/#{product}/releases/#{cycle}") + + if result.status.success? + begin + JSON.parse(result.stdout) + rescue JSON::ParserError + nil + end + end end end