From bca9eb05d1c0b55176cc3659cadfe894467352fa Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Tue, 15 Nov 2022 05:22:42 +0000 Subject: [PATCH] dev-cmd/unbottled: simulate target tag --- Library/Homebrew/dev-cmd/unbottled.rb | 11 +++++++++++ Library/Homebrew/hardware.rb | 11 ++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/dev-cmd/unbottled.rb b/Library/Homebrew/dev-cmd/unbottled.rb index 587240e728..be766a15f2 100644 --- a/Library/Homebrew/dev-cmd/unbottled.rb +++ b/Library/Homebrew/dev-cmd/unbottled.rb @@ -44,6 +44,15 @@ module Homebrew Utils::Bottles.tag end + Homebrew::SimulateSystem.os = @bottle_tag.system + Homebrew::SimulateSystem.arch = if Hardware::CPU::INTEL_ARCHS.include?(@bottle_tag.arch) + :intel + elsif Hardware::CPU::ARM_ARCHS.include?(@bottle_tag.arch) + :arm + else + raise "Unknown arch #{@bottle_tag.arch}." + end + all = args.eval_all? if args.total? if !all && !Homebrew::EnvConfig.eval_all? @@ -82,6 +91,8 @@ module Homebrew end output_unbottled(formulae, deps_hash, noun, hash, args.named.present?) + ensure + Homebrew::SimulateSystem.clear end def formulae_all_installs_from_args(args, all) diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb index 804085f0e8..02c6bec9df 100644 --- a/Library/Homebrew/hardware.rb +++ b/Library/Homebrew/hardware.rb @@ -9,15 +9,16 @@ module Hardware class CPU INTEL_32BIT_ARCHS = [:i386].freeze INTEL_64BIT_ARCHS = [:x86_64].freeze + INTEL_ARCHS = (INTEL_32BIT_ARCHS + INTEL_64BIT_ARCHS).freeze PPC_32BIT_ARCHS = [:ppc, :ppc32, :ppc7400, :ppc7450, :ppc970].freeze PPC_64BIT_ARCHS = [:ppc64, :ppc64le, :ppc970].freeze + PPC_ARCHS = (PPC_32BIT_ARCHS + PPC_64BIT_ARCHS).freeze ARM_64BIT_ARCHS = [:arm64, :aarch64].freeze + ARM_ARCHS = ARM_64BIT_ARCHS ALL_ARCHS = [ - *INTEL_32BIT_ARCHS, - *INTEL_64BIT_ARCHS, - *PPC_32BIT_ARCHS, - *PPC_64BIT_ARCHS, - *ARM_64BIT_ARCHS, + *INTEL_ARCHS, + *PPC_ARCHS, + *ARM_ARCHS, ].freeze INTEL_64BIT_OLDEST_CPU = :core2