Fix formula-analytics pretty OS name logic

This commit is contained in:
Rylan Polster 2025-08-19 03:12:32 -04:00
parent 99cdd7d8c0
commit 4b4378943a
No known key found for this signature in database

View File

@ -370,10 +370,13 @@ module Homebrew
dimension = dimension.gsub(/^Intel ?/, "") dimension = dimension.gsub(/^Intel ?/, "")
.gsub(/^macOS ?/, "") .gsub(/^macOS ?/, "")
.gsub(/ \(.+\)$/, "") .gsub(/ \(.+\)$/, "")
if (macos_pretty_name = ::MacOSVersion.analytics_pretty_name(dimension))
return macos_pretty_name
end
case dimension case dimension
when (macos_pretty_name = ::MacOSVersion.analytics_pretty_name(dimension)) when /Ubuntu(-Server)? (14|16|18|20|22|24)\.04/ then "Ubuntu #{Regexp.last_match(2)}.04 LTS"
macos_pretty_name
when /Ubuntu(-Server)? (14|16|18|20|22)\.04/ then "Ubuntu #{Regexp.last_match(2)}.04 LTS"
when /Ubuntu(-Server)? (\d+\.\d+).\d ?(LTS)?/ when /Ubuntu(-Server)? (\d+\.\d+).\d ?(LTS)?/
"Ubuntu #{Regexp.last_match(2)} #{Regexp.last_match(3)}".strip "Ubuntu #{Regexp.last_match(2)} #{Regexp.last_match(3)}".strip
when %r{Debian GNU/Linux (\d+)\.\d+} then "Debian #{Regexp.last_match(1)} #{Regexp.last_match(2)}" when %r{Debian GNU/Linux (\d+)\.\d+} then "Debian #{Regexp.last_match(1)} #{Regexp.last_match(2)}"