diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index 300e5808f5..4ad1b538bd 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -587,10 +587,14 @@ module Homebrew metadata = SharedAudits.eol_data(name, formula.version.major) metadata ||= SharedAudits.eol_data(name, formula.version.major_minor) - return if metadata.blank? || (eol_date = metadata["eol"]).blank? + return if metadata.blank? || (eol = metadata["eol"]).blank? + + is_eol = eol == true + is_eol ||= eol.is_a?(String) && (eol_date = Date.parse(eol)) <= Date.today + return unless is_eol message = "Product is EOL" - message += " since #{eol_date}" if Date.parse(eol_date.to_s) <= Date.today + message += " since #{eol_date}" if eol_date.present? message += ", see #{Formatter.url("https://endoflife.date/#{name}")}" problem message diff --git a/Library/Homebrew/utils/shared_audits.rb b/Library/Homebrew/utils/shared_audits.rb index b7cd07a4c4..f8c0ed25a3 100644 --- a/Library/Homebrew/utils/shared_audits.rb +++ b/Library/Homebrew/utils/shared_audits.rb @@ -10,9 +10,9 @@ module SharedAudits module_function - sig { params(product: String, cycle: String).returns(T.nilable(T::Hash[String, T::Hash[Symbol, T.untyped]])) } + sig { params(product: String, cycle: String).returns(T.nilable(T::Hash[String, T.untyped])) } def eol_data(product, cycle) - @eol_data ||= T.let({}, T.nilable(T::Hash[String, T::Hash[String, T.untyped]])) + @eol_data ||= T.let({}, T.nilable(T::Hash[String, T.untyped])) @eol_data["#{product}/#{cycle}"] ||= begin out, _, status = Utils::Curl.curl_output("--location", "https://endoflife.date/api/#{product}/#{cycle}.json") json = JSON.parse(out) if status.success?