From 575cb0263cb1428c63b9428bbd913ffde83bd317 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 22:34:17 +0800 Subject: [PATCH] determine-test-runners: fix generic OS test failures Without this, testing on the generic OS results in errors like Error: uninitialized constant Homebrew::MacOS --- Library/Homebrew/os.rb | 1 + Library/Homebrew/os/generic.rb | 8 ++++++++ Library/Homebrew/os/linux.rb | 2 -- Library/Homebrew/os/mac.rb | 2 -- 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 Library/Homebrew/os/generic.rb diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb index da59954324..97f849c131 100644 --- a/Library/Homebrew/os.rb +++ b/Library/Homebrew/os.rb @@ -55,6 +55,7 @@ module OS LINUX_PREFERRED_GCC_COMPILER_FORMULA = "gcc@11" # https://packages.ubuntu.com/jammy/gcc LINUX_PREFERRED_GCC_RUNTIME_FORMULA = "gcc" + require "os/generic" if OS.mac? require "os/mac" # Don't tell people to report issues on unsupported configurations. diff --git a/Library/Homebrew/os/generic.rb b/Library/Homebrew/os/generic.rb new file mode 100644 index 0000000000..516c74764b --- /dev/null +++ b/Library/Homebrew/os/generic.rb @@ -0,0 +1,8 @@ +# typed: strict +# frozen_string_literal: true + +module OS + module Mac + ::MacOS = OS::Mac + end +end diff --git a/Library/Homebrew/os/linux.rb b/Library/Homebrew/os/linux.rb index 2b5df8cfc3..a48836ded1 100644 --- a/Library/Homebrew/os/linux.rb +++ b/Library/Homebrew/os/linux.rb @@ -54,8 +54,6 @@ module OS module Mac module_function - ::MacOS = OS::Mac - raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"] def version diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index b52a965130..f8e0f3bba7 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -13,8 +13,6 @@ module OS module_function - ::MacOS = OS::Mac - raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"] VERSION = ENV.fetch("HOMEBREW_MACOS_VERSION").chomp.freeze