Add HOMEBREW_SIMULATE_MACOS_ON_LINUX

This commit is contained in:
Bo Anderson 2021-03-03 00:30:40 +00:00
parent 7448a6be58
commit abb2b26a93
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
6 changed files with 12 additions and 4 deletions

View File

@ -260,6 +260,11 @@ module Homebrew
description: "If set, use Pry for the `brew irb` command.",
boolean: true,
},
HOMEBREW_SIMULATE_MACOS_ON_LINUX: {
description: "If set, running Homebrew on Linux will simulate certain macOS code paths. This is useful " \
"when auditing macOS formulae while on Linux.",
boolean: true,
},
HOMEBREW_SKIP_OR_LATER_BOTTLES: {
description: "If set along with `HOMEBREW_DEVELOPER`, do not use bottles from older versions " \
"of macOS. This is useful in development on new macOS versions.",

View File

@ -15,7 +15,8 @@ class SoftwareSpec
end
bounds = bounds.transform_values { |v| MacOS::Version.from_symbol(v) }
if MacOS.version >= bounds[:since]
if MacOS.version >= bounds[:since] ||
(Homebrew::EnvConfig.simulate_macos_on_linux? && !bounds.key?(:since))
@uses_from_macos_elements << deps
else
depends_on deps

View File

@ -1,7 +1,7 @@
# typed: strict
# frozen_string_literal: true
if OS.mac?
if OS.mac? || Homebrew::EnvConfig.simulate_macos_on_linux?
require "extend/os/mac/on_os"
elsif OS.linux?
require "extend/os/linux/on_os"

View File

@ -2,7 +2,7 @@
# frozen_string_literal: true
# This logic will need to be more nuanced if this file includes more than `uses_from_macos`.
if OS.mac? || Homebrew::EnvConfig.force_homebrew_on_linux?
if OS.mac? || Homebrew::EnvConfig.simulate_macos_on_linux?
require "extend/os/mac/software_spec"
elsif OS.linux?
require "extend/os/linux/software_spec"

View File

@ -282,7 +282,7 @@ module Homebrew
# The number of conflicts on Linux is absurd.
# TODO: remove this and check these there too.
return if OS.linux? && !Homebrew::EnvConfig.force_homebrew_on_linux?
return if OS.linux? && !Homebrew::EnvConfig.simulate_macos_on_linux?
recursive_runtime_formulae = formula.runtime_formula_dependencies(undeclared: false)
version_hash = {}

View File

@ -8234,6 +8234,8 @@ module Homebrew::EnvConfig
def self.pry?(); end
def self.simulate_macos_on_linux?(); end
def self.skip_or_later_bottles?(); end
def self.sorbet_runtime?(); end