Remove MacOS definition from generic OS
We don't want to define `MacOS` in the generic OS, so let's make sure we refer to it as `OS::Mac` in the places we need it. This reverts commit 575cb0263cb1428c63b9428bbd913ffde83bd317.
This commit is contained in:
parent
575cb0263c
commit
a4ebb96fe6
@ -46,7 +46,7 @@ class TestRunnerFormula
|
|||||||
formula.requirements.find { |r| r.is_a?(MacOSRequirement) && r.version_specified? }
|
formula.requirements.find { |r| r.is_a?(MacOSRequirement) && r.version_specified? }
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(macos_version: MacOS::Version).returns(T::Boolean) }
|
sig { params(macos_version: OS::Mac::Version).returns(T::Boolean) }
|
||||||
def compatible_with?(macos_version)
|
def compatible_with?(macos_version)
|
||||||
# Assign to a variable to assist type-checking.
|
# Assign to a variable to assist type-checking.
|
||||||
requirement = versioned_macos_requirement
|
requirement = versioned_macos_requirement
|
||||||
@ -93,7 +93,7 @@ module Homebrew
|
|||||||
testing_formulae: T::Array[TestRunnerFormula],
|
testing_formulae: T::Array[TestRunnerFormula],
|
||||||
reject_platform: T.nilable(Symbol),
|
reject_platform: T.nilable(Symbol),
|
||||||
reject_arch: T.nilable(Symbol),
|
reject_arch: T.nilable(Symbol),
|
||||||
select_macos_version: T.nilable(MacOS::Version),
|
select_macos_version: T.nilable(OS::Mac::Version),
|
||||||
).returns(T::Boolean)
|
).returns(T::Boolean)
|
||||||
}
|
}
|
||||||
def self.formulae_have_untested_dependents?(testing_formulae, reject_platform:, reject_arch:, select_macos_version:)
|
def self.formulae_have_untested_dependents?(testing_formulae, reject_platform:, reject_arch:, select_macos_version:)
|
||||||
@ -123,7 +123,7 @@ module Homebrew
|
|||||||
deleted_formulae: T.nilable(T::Array[String]),
|
deleted_formulae: T.nilable(T::Array[String]),
|
||||||
reject_platform: T.nilable(Symbol),
|
reject_platform: T.nilable(Symbol),
|
||||||
reject_arch: T.nilable(Symbol),
|
reject_arch: T.nilable(Symbol),
|
||||||
select_macos_version: T.nilable(MacOS::Version),
|
select_macos_version: T.nilable(OS::Mac::Version),
|
||||||
).returns(T::Boolean)
|
).returns(T::Boolean)
|
||||||
}
|
}
|
||||||
def self.add_runner?(formulae,
|
def self.add_runner?(formulae,
|
||||||
@ -200,7 +200,7 @@ module Homebrew
|
|||||||
ephemeral_suffix = "-#{github_run_id}-#{github_run_attempt}"
|
ephemeral_suffix = "-#{github_run_id}-#{github_run_attempt}"
|
||||||
|
|
||||||
MacOSVersions::SYMBOLS.each do |symbol, version|
|
MacOSVersions::SYMBOLS.each do |symbol, version|
|
||||||
macos_version = MacOS::Version.new(version)
|
macos_version = OS::Mac::Version.new(version)
|
||||||
next if macos_version.outdated_release? || macos_version.prerelease?
|
next if macos_version.outdated_release? || macos_version.prerelease?
|
||||||
|
|
||||||
if args.dependents?
|
if args.dependents?
|
||||||
|
|||||||
@ -28,13 +28,13 @@ module OnSystem
|
|||||||
|
|
||||||
return false if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
return false if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
|
|
||||||
base_os = MacOS::Version.from_symbol(os_name)
|
base_os = OS::Mac::Version.from_symbol(os_name)
|
||||||
current_os = if Homebrew::SimulateSystem.current_os == :macos
|
current_os = if Homebrew::SimulateSystem.current_os == :macos
|
||||||
# Assume the oldest macOS version when simulating a generic macOS version
|
# Assume the oldest macOS version when simulating a generic macOS version
|
||||||
# Version::NULL is always treated as less than any other version.
|
# Version::NULL is always treated as less than any other version.
|
||||||
Version::NULL
|
Version::NULL
|
||||||
else
|
else
|
||||||
MacOS::Version.from_symbol(Homebrew::SimulateSystem.current_os)
|
OS::Mac::Version.from_symbol(Homebrew::SimulateSystem.current_os)
|
||||||
end
|
end
|
||||||
|
|
||||||
return current_os >= base_os if or_condition == :or_newer
|
return current_os >= base_os if or_condition == :or_newer
|
||||||
|
|||||||
@ -55,7 +55,6 @@ module OS
|
|||||||
LINUX_PREFERRED_GCC_COMPILER_FORMULA = "gcc@11" # https://packages.ubuntu.com/jammy/gcc
|
LINUX_PREFERRED_GCC_COMPILER_FORMULA = "gcc@11" # https://packages.ubuntu.com/jammy/gcc
|
||||||
LINUX_PREFERRED_GCC_RUNTIME_FORMULA = "gcc"
|
LINUX_PREFERRED_GCC_RUNTIME_FORMULA = "gcc"
|
||||||
|
|
||||||
require "os/generic"
|
|
||||||
if OS.mac?
|
if OS.mac?
|
||||||
require "os/mac"
|
require "os/mac"
|
||||||
# Don't tell people to report issues on unsupported configurations.
|
# Don't tell people to report issues on unsupported configurations.
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
# typed: strict
|
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module OS
|
|
||||||
module Mac
|
|
||||||
::MacOS = OS::Mac
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -54,6 +54,8 @@ module OS
|
|||||||
module Mac
|
module Mac
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
::MacOS = OS::Mac
|
||||||
|
|
||||||
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
||||||
|
|
||||||
def version
|
def version
|
||||||
|
|||||||
@ -13,6 +13,8 @@ module OS
|
|||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
::MacOS = OS::Mac
|
||||||
|
|
||||||
raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
||||||
|
|
||||||
VERSION = ENV.fetch("HOMEBREW_MACOS_VERSION").chomp.freeze
|
VERSION = ENV.fetch("HOMEBREW_MACOS_VERSION").chomp.freeze
|
||||||
|
|||||||
@ -23,9 +23,9 @@ class MacOSRequirement < Requirement
|
|||||||
def initialize(tags = [], comparator: ">=")
|
def initialize(tags = [], comparator: ">=")
|
||||||
@version = begin
|
@version = begin
|
||||||
if comparator == "==" && tags.first.respond_to?(:map)
|
if comparator == "==" && tags.first.respond_to?(:map)
|
||||||
tags.first.map { |s| MacOS::Version.from_symbol(s) }
|
tags.first.map { |s| OS::Mac::Version.from_symbol(s) }
|
||||||
else
|
else
|
||||||
MacOS::Version.from_symbol(tags.first) unless tags.empty?
|
OS::Mac::Version.from_symbol(tags.first) unless tags.empty?
|
||||||
end
|
end
|
||||||
rescue MacOSVersionError => e
|
rescue MacOSVersionError => e
|
||||||
if DISABLED_MACOS_VERSIONS.include?(e.version)
|
if DISABLED_MACOS_VERSIONS.include?(e.version)
|
||||||
@ -43,7 +43,7 @@ class MacOSRequirement < Requirement
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Otherwise fallback to the oldest allowed if comparator is >=.
|
# Otherwise fallback to the oldest allowed if comparator is >=.
|
||||||
MacOS::Version.new(HOMEBREW_MACOS_OLDEST_ALLOWED) if comparator == ">="
|
OS::Mac::Version.new(HOMEBREW_MACOS_OLDEST_ALLOWED) if comparator == ">="
|
||||||
end
|
end
|
||||||
|
|
||||||
@comparator = comparator
|
@comparator = comparator
|
||||||
@ -56,7 +56,7 @@ class MacOSRequirement < Requirement
|
|||||||
|
|
||||||
satisfy(build_env: false) do
|
satisfy(build_env: false) do
|
||||||
T.bind(self, MacOSRequirement)
|
T.bind(self, MacOSRequirement)
|
||||||
next Array(@version).any? { |v| MacOS.version.public_send(@comparator, v) } if OS.mac? && version_specified?
|
next Array(@version).any? { |v| OS::Mac.version.public_send(@comparator, v) } if OS.mac? && version_specified?
|
||||||
next true if OS.mac?
|
next true if OS.mac?
|
||||||
next true if @version
|
next true if @version
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user