Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macos_version: add KERNEL_MAJOR_VERSIONS map #18674

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Library/Homebrew/macos_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def initialize(version)

# NOTE: When removing symbols here, ensure that they are added
# to `DEPRECATED_MACOS_VERSIONS` in `MacOSRequirement`.
# When adding or removing symbols here, ensure that you
# also update the KERNEL_MAJOR_VERSIONS map below.
SYMBOLS = {
sequoia: "15",
sonoma: "14",
Expand All @@ -31,6 +33,21 @@ def initialize(version)
el_capitan: "10.11",
}.freeze

# Map of macOS version strings to kernel major versions.
# https://en.wikipedia.org/wiki/MacOS_version_history#Releases
KERNEL_MAJOR_VERSIONS = {
"15" => "24",
"14" => "23",
"13" => "22",
"12" => "21",
"11" => "20",
"10.15" => "19",
"10.14" => "18",
"10.13" => "17",
"10.12" => "16",
"10.11" => "15",
}.freeze

sig { params(version: Symbol).returns(T.attached_class) }
def self.from_symbol(version)
str = SYMBOLS.fetch(version) { raise MacOSVersion::Error, version }
Expand Down
Loading