Merge pull request #20509 from Homebrew/formula-analytics-os-names

Fix `formula-analytics` pretty OS name logic
This commit is contained in:
Rylan Polster 2025-08-19 07:30:46 +00:00 committed by GitHub
commit f4445d2fba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -370,10 +370,13 @@ module Homebrew
dimension = dimension.gsub(/^Intel ?/, "")
.gsub(/^macOS ?/, "")
.gsub(/ \(.+\)$/, "")
if (macos_pretty_name = ::MacOSVersion.analytics_pretty_name(dimension))
return macos_pretty_name
end
case dimension
when (macos_pretty_name = ::MacOSVersion.analytics_pretty_name(dimension))
macos_pretty_name
when /Ubuntu(-Server)? (14|16|18|20|22)\.04/ then "Ubuntu #{Regexp.last_match(2)}.04 LTS"
when /Ubuntu(-Server)? (14|16|18|20|22|24)\.04/ then "Ubuntu #{Regexp.last_match(2)}.04 LTS"
when /Ubuntu(-Server)? (\d+\.\d+).\d ?(LTS)?/
"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)}"