Add SimulateSystem::with.

This commit is contained in:
Markus Reiter 2023-05-13 22:35:08 +02:00
parent b0dc84b117
commit 0d56b97b07
No known key found for this signature in database
GPG Key ID: 245293B51702655B
11 changed files with 198 additions and 243 deletions

View File

@ -313,16 +313,13 @@ module Cask
hash_keys_to_skip = %w[outdated installed versions] hash_keys_to_skip = %w[outdated installed versions]
begin
if @dsl.on_system_blocks_exist? if @dsl.on_system_blocks_exist?
[:arm, :intel].each do |arch| begin
MacOSVersion::SYMBOLS.each_key do |os_name| MacOSVersion::SYMBOLS.keys.product(OnSystem::ARCH_OPTIONS).each do |os, arch|
bottle_tag = ::Utils::Bottles::Tag.new(system: os_name, arch: arch) bottle_tag = ::Utils::Bottles::Tag.new(system: os, arch: arch)
next unless bottle_tag.valid_combination? next unless bottle_tag.valid_combination?
Homebrew::SimulateSystem.os = os_name Homebrew::SimulateSystem.with os: os, arch: arch do
Homebrew::SimulateSystem.arch = arch
refresh refresh
to_h.each do |key, value| to_h.each do |key, value|
@ -334,12 +331,10 @@ module Cask
end end
end end
end end
end
ensure ensure
Homebrew::SimulateSystem.clear
end
refresh refresh
end
end
hash["variations"] = variations hash["variations"] = variations
hash hash

View File

@ -148,9 +148,8 @@ module Homebrew
tmp_cask = Cask::CaskLoader.load(tmp_contents) tmp_cask = Cask::CaskLoader.load(tmp_contents)
tmp_config = tmp_cask.config tmp_config = tmp_cask.config
[:arm, :intel].each do |arch| OnSystem::ARCH_OPTIONS.each do |arch|
Homebrew::SimulateSystem.arch = arch SimulateSystem.with arch: arch do
languages = cask.languages languages = cask.languages
languages = [nil] if languages.empty? languages = [nil] if languages.empty?
languages.each do |language| languages.each do |language|
@ -170,8 +169,7 @@ module Homebrew
replacement_pairs << [new_hash_cask.sha256.to_s, download.sha256] replacement_pairs << [new_hash_cask.sha256.to_s, download.sha256]
end end
ensure end
Homebrew::SimulateSystem.clear
end end
elsif new_hash elsif new_hash
opoo "Cask contains multiple hashes; only updating hash for current arch." if cask.on_system_blocks_exist? opoo "Cask contains multiple hashes; only updating hash for current arch." if cask.on_system_blocks_exist?

View File

@ -43,8 +43,8 @@ module Homebrew
Utils::Bottles.tag Utils::Bottles.tag
end end
Homebrew::SimulateSystem.os = @bottle_tag.system os = @bottle_tag.system
Homebrew::SimulateSystem.arch = if Hardware::CPU::INTEL_ARCHS.include?(@bottle_tag.arch) arch = if Hardware::CPU::INTEL_ARCHS.include?(@bottle_tag.arch)
:intel :intel
elsif Hardware::CPU::ARM_ARCHS.include?(@bottle_tag.arch) elsif Hardware::CPU::ARM_ARCHS.include?(@bottle_tag.arch)
:arm :arm
@ -52,6 +52,7 @@ module Homebrew
raise "Unknown arch #{@bottle_tag.arch}." raise "Unknown arch #{@bottle_tag.arch}."
end end
Homebrew::SimulateSystem.with os: os, arch: arch do
all = args.eval_all? all = args.eval_all?
if args.total? if args.total?
if !all && !Homebrew::EnvConfig.eval_all? if !all && !Homebrew::EnvConfig.eval_all?
@ -90,8 +91,7 @@ module Homebrew
end end
output_unbottled(formulae, deps_hash, noun, hash, args.named.present?) output_unbottled(formulae, deps_hash, noun, hash, args.named.present?)
ensure end
Homebrew::SimulateSystem.clear
end end
def formulae_all_installs_from_args(args, all) def formulae_all_installs_from_args(args, all)

View File

@ -2251,17 +2251,13 @@ class Formula
os_versions = [*MacOSVersion::SYMBOLS.keys, :linux] os_versions = [*MacOSVersion::SYMBOLS.keys, :linux]
begin
if path.exist? && self.class.on_system_blocks_exist? if path.exist? && self.class.on_system_blocks_exist?
formula_contents = path.read formula_contents = path.read
[:arm, :intel].each do |arch| os_versions.product(OnSystem::ARCH_OPTIONS).each do |os, arch|
os_versions.each do |os_name| bottle_tag = Utils::Bottles::Tag.new(system: os, arch: arch)
bottle_tag = Utils::Bottles::Tag.new(system: os_name, arch: arch)
next unless bottle_tag.valid_combination? next unless bottle_tag.valid_combination?
Homebrew::SimulateSystem.os = os_name Homebrew::SimulateSystem.with os: os, arch: arch do
Homebrew::SimulateSystem.arch = arch
variations_namespace = Formulary.class_s("Variations#{bottle_tag.to_sym.capitalize}") variations_namespace = Formulary.class_s("Variations#{bottle_tag.to_sym.capitalize}")
variations_formula_class = Formulary.load_formula(name, path, formula_contents, variations_namespace, variations_formula_class = Formulary.load_formula(name, path, formula_contents, variations_namespace,
flags: self.class.build_flags, ignore_errors: true) flags: self.class.build_flags, ignore_errors: true)
@ -2277,9 +2273,6 @@ class Formula
end end
end end
end end
ensure
Homebrew::SimulateSystem.clear
end
hash["variations"] = variations hash["variations"] = variations
hash hash

View File

@ -893,9 +893,8 @@ module Homebrew
# The formula has no variations, so all OS-version-arch triples depend on GCC. # The formula has no variations, so all OS-version-arch triples depend on GCC.
return false if variations.blank? return false if variations.blank?
MacOSVersion::SYMBOLS.each_key do |macos_version| MacOSVersion::SYMBOLS.keys.product(OnSystem::ARCH_OPTIONS).each do |os, arch|
[:arm, :intel].each do |arch| bottle_tag = Utils::Bottles::Tag.new(system: os, arch: arch)
bottle_tag = Utils::Bottles::Tag.new(system: macos_version, arch: arch)
next unless bottle_tag.valid_combination? next unless bottle_tag.valid_combination?
variation_dependencies = variations.dig(bottle_tag.to_sym, "dependencies") variation_dependencies = variations.dig(bottle_tag.to_sym, "dependencies")
@ -908,7 +907,6 @@ module Homebrew
# We found a non-Linux variation that depends on GCC. # We found a non-Linux variation that depends on GCC.
return false if variation_dependencies.include?("gcc") return false if variation_dependencies.include?("gcc")
end end
end
true true
end end

View File

@ -68,6 +68,7 @@ module Readall
def valid_tap?(tap, options = {}) def valid_tap?(tap, options = {})
success = true success = true
if options[:aliases] if options[:aliases]
valid_aliases = valid_aliases?(tap.alias_dir, tap.formula_dir) valid_aliases = valid_aliases?(tap.alias_dir, tap.formula_dir)
success = false unless valid_aliases success = false unless valid_aliases
@ -76,25 +77,18 @@ module Readall
success = false unless valid_formulae?(tap.formula_files) success = false unless valid_formulae?(tap.formula_files)
success = false unless valid_casks?(tap.cask_files) success = false unless valid_casks?(tap.cask_files)
else else
arches = [:arm, :intel]
os_names = [*MacOSVersion::SYMBOLS.keys, :linux] os_names = [*MacOSVersion::SYMBOLS.keys, :linux]
arches.each do |arch| os_names.product(OnSystem::ARCH_OPTIONS).each do |os, arch|
os_names.each do |os_name| bottle_tag = Utils::Bottles::Tag.new(system: os, arch: arch)
bottle_tag = Utils::Bottles::Tag.new(system: os_name, arch: arch)
next unless bottle_tag.valid_combination? next unless bottle_tag.valid_combination?
begin Homebrew::SimulateSystem.with os: os, arch: arch do
Homebrew::SimulateSystem.arch = arch
Homebrew::SimulateSystem.os = os_name
success = false unless valid_formulae?(tap.formula_files, bottle_tag: bottle_tag) success = false unless valid_formulae?(tap.formula_files, bottle_tag: bottle_tag)
success = false unless valid_casks?(tap.cask_files, os_name: os_name, arch: arch) success = false unless valid_casks?(tap.cask_files, os_name: os, arch: arch)
ensure
Homebrew::SimulateSystem.clear
end
end end
end end
end end
success success
end end

View File

@ -9,6 +9,31 @@ module Homebrew
class << self class << self
attr_reader :arch, :os attr_reader :arch, :os
sig {
type_parameters(:U).params(
os: Symbol,
arch: Symbol,
_block: T.proc.returns(T.type_parameter(:U)),
).returns(T.type_parameter(:U))
}
def with(os: T.unsafe(nil), arch: T.unsafe(nil), &_block)
raise ArgumentError, "At least one of `os` or `arch` must be specified." if !os && !arch
if self.os || self.arch
raise "Cannot simulate#{os&.inspect&.prepend(" ")}#{arch&.inspect&.prepend(" ")} while already " \
"simulating#{self.os&.inspect&.prepend(" ")}#{self.arch&.inspect&.prepend(" ")}."
end
begin
self.os = os if os
self.arch = arch if arch
yield
ensure
clear
end
end
sig { params(new_os: Symbol).void } sig { params(new_os: Symbol).void }
def os=(new_os) def os=(new_os)
os_options = [:macos, :linux, *MacOSVersion::SYMBOLS.keys] os_options = [:macos, :linux, *MacOSVersion::SYMBOLS.keys]
@ -19,7 +44,7 @@ module Homebrew
sig { params(new_arch: Symbol).void } sig { params(new_arch: Symbol).void }
def arch=(new_arch) def arch=(new_arch)
raise "New arch must be :arm or :intel" unless [:arm, :intel].include?(new_arch) raise "New arch must be :arm or :intel" unless OnSystem::ARCH_OPTIONS.include?(new_arch)
@arch = new_arch @arch = new_arch
end end

View File

@ -247,11 +247,6 @@ describe Cask::Cask, :cask do
let(:expected_versions_variations) do let(:expected_versions_variations) do
<<~JSON <<~JSON
{ {
"arm64_big_sur": {
"url": "file://#{TEST_FIXTURE_DIR}/cask/caffeine/darwin-arm64/1.2.0/arm.zip",
"version": "1.2.0",
"sha256": "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
},
"monterey": { "monterey": {
"url": "file://#{TEST_FIXTURE_DIR}/cask/caffeine/darwin/1.2.3/intel.zip" "url": "file://#{TEST_FIXTURE_DIR}/cask/caffeine/darwin/1.2.3/intel.zip"
}, },
@ -260,6 +255,11 @@ describe Cask::Cask, :cask do
"version": "1.2.0", "version": "1.2.0",
"sha256": "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" "sha256": "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
}, },
"arm64_big_sur": {
"url": "file://#{TEST_FIXTURE_DIR}/cask/caffeine/darwin-arm64/1.2.0/arm.zip",
"version": "1.2.0",
"sha256": "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
},
"catalina": { "catalina": {
"url": "file://#{TEST_FIXTURE_DIR}/cask/caffeine/darwin/1.0.0/intel.zip", "url": "file://#{TEST_FIXTURE_DIR}/cask/caffeine/darwin/1.0.0/intel.zip",
"version": "1.0.0", "version": "1.0.0",

View File

@ -932,11 +932,6 @@ describe Formula do
let(:expected_variations) do let(:expected_variations) do
<<~JSON <<~JSON
{ {
"arm64_big_sur": {
"dependencies": [
"big-sur-formula"
]
},
"monterey": { "monterey": {
"dependencies": [ "dependencies": [
"intel-formula" "intel-formula"
@ -948,6 +943,11 @@ describe Formula do
"big-sur-formula" "big-sur-formula"
] ]
}, },
"arm64_big_sur": {
"dependencies": [
"big-sur-formula"
]
},
"catalina": { "catalina": {
"dependencies": [ "dependencies": [
"intel-formula", "intel-formula",
@ -1656,10 +1656,6 @@ describe Formula do
end end
describe "#on_system" do describe "#on_system" do
after do
Homebrew::SimulateSystem.clear
end
let(:f) do let(:f) do
Class.new(Testball) do Class.new(Testball) do
attr_reader :foo attr_reader :foo
@ -1679,50 +1675,47 @@ describe Formula do
end end
it "doesn't call code on Ventura", :needs_macos do it "doesn't call code on Ventura", :needs_macos do
Homebrew::SimulateSystem.os = :ventura Homebrew::SimulateSystem.with os: :ventura do
f.brew { f.install } f.brew { f.install }
expect(f.foo).to eq(0) expect(f.foo).to eq(0)
expect(f.bar).to eq(0) expect(f.bar).to eq(0)
end end
end
it "calls code on Linux", :needs_linux do it "calls code on Linux", :needs_linux do
Homebrew::SimulateSystem.os = :linux Homebrew::SimulateSystem.with os: :linux do
f.brew { f.install } f.brew { f.install }
expect(f.foo).to eq(1) expect(f.foo).to eq(1)
expect(f.bar).to eq(1) expect(f.bar).to eq(1)
end end
end
it "calls code within `on_system :linux, macos: :monterey` on Monterey", :needs_macos do it "calls code within `on_system :linux, macos: :monterey` on Monterey", :needs_macos do
Homebrew::SimulateSystem.os = :monterey Homebrew::SimulateSystem.with os: :monterey do
f.brew { f.install } f.brew { f.install }
expect(f.foo).to eq(1) expect(f.foo).to eq(1)
expect(f.bar).to eq(0) expect(f.bar).to eq(0)
end end
end
it "calls code within `on_system :linux, macos: :big_sur_or_older` on Big Sur", :needs_macos do it "calls code within `on_system :linux, macos: :big_sur_or_older` on Big Sur", :needs_macos do
Homebrew::SimulateSystem.os = :big_sur Homebrew::SimulateSystem.with os: :big_sur do
f.brew { f.install } f.brew { f.install }
expect(f.foo).to eq(0) expect(f.foo).to eq(0)
expect(f.bar).to eq(1) expect(f.bar).to eq(1)
end end
end
it "calls code within `on_system :linux, macos: :big_sur_or_older` on Catalina", :needs_macos do it "calls code within `on_system :linux, macos: :big_sur_or_older` on Catalina", :needs_macos do
Homebrew::SimulateSystem.os = :catalina Homebrew::SimulateSystem.with os: :catalina do
f.brew { f.install } f.brew { f.install }
expect(f.foo).to eq(0) expect(f.foo).to eq(0)
expect(f.bar).to eq(1) expect(f.bar).to eq(1)
end end
end end
end
describe "on_{os_version} blocks", :needs_macos do describe "on_{os_version} blocks", :needs_macos do
before do
Homebrew::SimulateSystem.os = :monterey
end
after do
Homebrew::SimulateSystem.clear
end
let(:f) do let(:f) do
Class.new(Testball) do Class.new(Testball) do
attr_reader :test attr_reader :test
@ -1743,35 +1736,40 @@ describe Formula do
end end
it "only calls code within `on_monterey`" do it "only calls code within `on_monterey`" do
Homebrew::SimulateSystem.os = :monterey Homebrew::SimulateSystem.with os: :monterey do
f.brew { f.install } f.brew { f.install }
expect(f.test).to eq(1) expect(f.test).to eq(1)
end end
end
it "only calls code within `on_monterey :or_newer`" do it "only calls code within `on_monterey :or_newer`" do
Homebrew::SimulateSystem.os = :ventura Homebrew::SimulateSystem.with os: :ventura do
f.brew { f.install } f.brew { f.install }
expect(f.test).to eq(1) expect(f.test).to eq(1)
end end
end
it "only calls code within `on_big_sur`" do it "only calls code within `on_big_sur`" do
Homebrew::SimulateSystem.os = :big_sur Homebrew::SimulateSystem.with os: :big_sur do
f.brew { f.install } f.brew { f.install }
expect(f.test).to eq(2) expect(f.test).to eq(2)
end end
end
it "only calls code within `on_catalina`" do it "only calls code within `on_catalina`" do
Homebrew::SimulateSystem.os = :catalina Homebrew::SimulateSystem.with os: :catalina do
f.brew { f.install } f.brew { f.install }
expect(f.test).to eq(3) expect(f.test).to eq(3)
end end
end
it "only calls code within `on_catalina :or_older`" do it "only calls code within `on_catalina :or_older`" do
Homebrew::SimulateSystem.os = :mojave Homebrew::SimulateSystem.with os: :mojave do
f.brew { f.install } f.brew { f.install }
expect(f.test).to eq(3) expect(f.test).to eq(3)
end end
end end
end
describe "#on_arm" do describe "#on_arm" do
before do before do

View File

@ -302,9 +302,6 @@ describe TestRunnerFormula do
expect(described_class.new(old_non_portable_software).dependents(current_system)).to eq([]) expect(described_class.new(old_non_portable_software).dependents(current_system)).to eq([])
expect(described_class.new(fancy_new_software).dependents(current_system)).to eq([]) expect(described_class.new(fancy_new_software).dependents(current_system)).to eq([])
expect(described_class.new(needs_modern_compiler).dependents(current_system)).to eq([]) expect(described_class.new(needs_modern_compiler).dependents(current_system)).to eq([])
expect(Homebrew::SimulateSystem.os).to be_nil
expect(Homebrew::SimulateSystem.arch).to be_nil
end end
end end
@ -322,9 +319,6 @@ describe TestRunnerFormula do
expect( expect(
described_class.new(testball_user, eval_all: true).dependents(current_system).map(&:name), described_class.new(testball_user, eval_all: true).dependents(current_system).map(&:name),
).to eq(["recursive_testball_dependent"]) ).to eq(["recursive_testball_dependent"])
expect(Homebrew::SimulateSystem.os).to be_nil
expect(Homebrew::SimulateSystem.arch).to be_nil
end end
context "when called with arguments" do context "when called with arguments" do
@ -347,102 +341,62 @@ describe TestRunnerFormula do
end end
context "when given { platform: :linux, arch: :x86_64 }" do context "when given { platform: :linux, arch: :x86_64 }" do
before do
Homebrew::SimulateSystem.os = :linux
Homebrew::SimulateSystem.arch = :intel
end
it "returns only the dependents for the requested platform and architecture" do it "returns only the dependents for the requested platform and architecture" do
allow(Formula).to receive(:all).and_return(testball_and_dependents) allow(Formula).to receive(:all).and_wrap_original { testball_and_dependents }
expect( expect(
described_class.new(testball, eval_all: true).dependents( described_class.new(testball, eval_all: true).dependents(
platform: :linux, arch: :x86_64, macos_version: nil, platform: :linux, arch: :x86_64, macos_version: nil,
).map(&:name).sort, ).map(&:name).sort,
).to eq(["testball_user", "testball_user-intel", "testball_user-linux"].sort) ).to eq(["testball_user", "testball_user-intel", "testball_user-linux"].sort)
expect(Homebrew::SimulateSystem.os).to be_nil
expect(Homebrew::SimulateSystem.arch).to be_nil
end end
end end
context "when given { platform: :macos, arch: :x86_64 }" do context "when given { platform: :macos, arch: :x86_64 }" do
before do
Homebrew::SimulateSystem.os = :macos
Homebrew::SimulateSystem.arch = :intel
end
it "returns only the dependents for the requested platform and architecture" do it "returns only the dependents for the requested platform and architecture" do
allow(Formula).to receive(:all).and_return(testball_and_dependents) allow(Formula).to receive(:all).and_wrap_original { testball_and_dependents }
expect( expect(
described_class.new(testball, eval_all: true).dependents( described_class.new(testball, eval_all: true).dependents(
platform: :macos, arch: :x86_64, macos_version: nil, platform: :macos, arch: :x86_64, macos_version: nil,
).map(&:name).sort, ).map(&:name).sort,
).to eq(["testball_user", "testball_user-intel", "testball_user-macos"].sort) ).to eq(["testball_user", "testball_user-intel", "testball_user-macos"].sort)
expect(Homebrew::SimulateSystem.os).to be_nil
expect(Homebrew::SimulateSystem.arch).to be_nil
end end
end end
context "when given `{ platform: :macos, arch: :arm64 }`" do context "when given `{ platform: :macos, arch: :arm64 }`" do
before do
Homebrew::SimulateSystem.os = :macos
Homebrew::SimulateSystem.arch = :arm
end
it "returns only the dependents for the requested platform and architecture" do it "returns only the dependents for the requested platform and architecture" do
allow(Formula).to receive(:all).and_return(testball_and_dependents) allow(Formula).to receive(:all).and_wrap_original { testball_and_dependents }
expect( expect(
described_class.new(testball, eval_all: true).dependents( described_class.new(testball, eval_all: true).dependents(
platform: :macos, arch: :arm64, macos_version: nil, platform: :macos, arch: :arm64, macos_version: nil,
).map(&:name).sort, ).map(&:name).sort,
).to eq(["testball_user", "testball_user-arm", "testball_user-macos"].sort) ).to eq(["testball_user", "testball_user-arm", "testball_user-macos"].sort)
expect(Homebrew::SimulateSystem.os).to be_nil
expect(Homebrew::SimulateSystem.arch).to be_nil
end end
end end
context "when given `{ platform: :macos, arch: :x86_64, macos_version: :mojave }`" do context "when given `{ platform: :macos, arch: :x86_64, macos_version: :mojave }`" do
before do
Homebrew::SimulateSystem.os = :mojave
Homebrew::SimulateSystem.arch = :intel
end
it "returns only the dependents for the requested platform and architecture" do it "returns only the dependents for the requested platform and architecture" do
allow(Formula).to receive(:all).and_return(testball_and_dependents) allow(Formula).to receive(:all).and_wrap_original { testball_and_dependents }
expect( expect(
described_class.new(testball, eval_all: true).dependents( described_class.new(testball, eval_all: true).dependents(
platform: :macos, arch: :x86_64, macos_version: :mojave, platform: :macos, arch: :x86_64, macos_version: :mojave,
).map(&:name).sort, ).map(&:name).sort,
).to eq(["testball_user", "testball_user-intel", "testball_user-macos"].sort) ).to eq(["testball_user", "testball_user-intel", "testball_user-macos"].sort)
expect(Homebrew::SimulateSystem.os).to be_nil
expect(Homebrew::SimulateSystem.arch).to be_nil
end end
end end
context "when given `{ platform: :macos, arch: :arm64, macos_version: :ventura }`" do context "when given `{ platform: :macos, arch: :arm64, macos_version: :ventura }`" do
before do
Homebrew::SimulateSystem.os = :ventura
Homebrew::SimulateSystem.arch = :arm
end
it "returns only the dependents for the requested platform and architecture" do it "returns only the dependents for the requested platform and architecture" do
allow(Formula).to receive(:all).and_return(testball_and_dependents) allow(Formula).to receive(:all).and_wrap_original { testball_and_dependents }
expect( expect(
described_class.new(testball, eval_all: true).dependents( described_class.new(testball, eval_all: true).dependents(
platform: :macos, arch: :arm64, macos_version: :ventura, platform: :macos, arch: :arm64, macos_version: :ventura,
).map(&:name).sort, ).map(&:name).sort,
).to eq(%w[testball_user testball_user-arm testball_user-macos testball_user-ventura].sort) ).to eq(%w[testball_user testball_user-arm testball_user-macos testball_user-ventura].sort)
expect(Homebrew::SimulateSystem.os).to be_nil
expect(Homebrew::SimulateSystem.arch).to be_nil
end end
end end
end end

View File

@ -90,8 +90,7 @@ class TestRunnerFormula
cache_key = :"#{platform}_#{arch}_#{macos_version}" cache_key = :"#{platform}_#{arch}_#{macos_version}"
@dependent_hash[cache_key] ||= begin @dependent_hash[cache_key] ||= begin
all = eval_all || Homebrew::EnvConfig.eval_all? formula_selector, eval_all_env = if eval_all
formula_selector, eval_all_env = if all
[:all, "1"] [:all, "1"]
else else
[:installed, nil] [:installed, nil]
@ -99,15 +98,16 @@ class TestRunnerFormula
with_env(HOMEBREW_EVAL_ALL: eval_all_env) do with_env(HOMEBREW_EVAL_ALL: eval_all_env) do
Formulary.clear_cache Formulary.clear_cache
Homebrew::SimulateSystem.arch = SIMULATE_SYSTEM_SYMBOLS.fetch(arch)
Homebrew::SimulateSystem.os = macos_version || platform
os = macos_version || platform
arch = SIMULATE_SYSTEM_SYMBOLS.fetch(arch)
Homebrew::SimulateSystem.with os: os, arch: arch do
Formula.public_send(formula_selector) Formula.public_send(formula_selector)
.select { |candidate_f| candidate_f.deps.map(&:name).include?(name) } .select { |candidate_f| candidate_f.deps.map(&:name).include?(name) }
.map { |f| TestRunnerFormula.new(f, eval_all: all) } .map { |f| TestRunnerFormula.new(f, eval_all: eval_all) }
.freeze .freeze
ensure end
Homebrew::SimulateSystem.clear
end end
end end