From 66d1b929a5b134ee93caf9237e7074a195c1b523 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 7 Dec 2020 12:09:29 +0000 Subject: [PATCH] Fix `:arm64_big_sur` bottle ordering. This wasn't being parsed correctly so was being put below the Linux bottle which is less readable, less intuitive and will cause a bunch of merge conflicts. --- Library/Homebrew/hardware.rb | 8 ++++++++ Library/Homebrew/os/mac/version.rb | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb index 88625b72a3..f03078f877 100644 --- a/Library/Homebrew/hardware.rb +++ b/Library/Homebrew/hardware.rb @@ -11,6 +11,14 @@ module Hardware INTEL_64BIT_ARCHS = [:x86_64].freeze PPC_32BIT_ARCHS = [:ppc, :ppc32, :ppc7400, :ppc7450, :ppc970].freeze PPC_64BIT_ARCHS = [:ppc64, :ppc64le, :ppc970].freeze + ARM_64BIT_ARCHS = [:arm64].freeze + ALL_ARCHS = [ + *INTEL_32BIT_ARCHS, + *INTEL_64BIT_ARCHS, + *PPC_32BIT_ARCHS, + *PPC_64BIT_ARCHS, + *ARM_64BIT_ARCHS, + ].freeze class << self extend T::Sig diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb index 6e73ffd6a4..75893a1058 100644 --- a/Library/Homebrew/os/mac/version.rb +++ b/Library/Homebrew/os/mac/version.rb @@ -25,7 +25,11 @@ module OS sig { params(sym: Symbol).returns(T.attached_class) } def self.from_symbol(sym) - str = SYMBOLS.fetch(sym) { raise MacOSVersionError, sym } + @all_archs_regex ||= /^#{Regexp.union(Hardware::CPU::ALL_ARCHS.map(&:to_s))}_/ + sym_without_arch = sym.to_s + .sub(@all_archs_regex, "") + .to_sym + str = SYMBOLS.fetch(sym_without_arch) { raise MacOSVersionError, sym } new(str) end