Skip to content

Commit

Permalink
Rename aarch64_linux tag to arm64_linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo98 committed Jan 31, 2025
1 parent c071c77 commit 17464d2
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#####

case "${MACHTYPE}" in
arm64-*)
arm64-* | aarch64-*)
HOMEBREW_PROCESSOR="arm64"
;;
x86_64-*)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/github_packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, keep_old:
tar_gz_sha256 = write_tar_gz(local_file, blobs)

tab = tag_hash["tab"]
architecture = TAB_ARCH_TO_PLATFORM_ARCHITECTURE[tab["arch"].presence || bottle_tag.arch.to_s]
architecture = TAB_ARCH_TO_PLATFORM_ARCHITECTURE[tab["arch"].presence || bottle_tag.standardized_arch.to_s]

Check warning on line 353 in Library/Homebrew/github_packages.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/github_packages.rb#L353

Added line #L353 was not covered by tests
raise TypeError, "unknown tab['arch']: #{tab["arch"]}" if architecture.blank?

os = if tab["built_on"].present? && tab["built_on"]["os"].present?
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/software_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def initialize(name, version, tag, rebuild)
raise ArgumentError, "Invalid bottle version" unless Utils.safe_filename?(version.to_s)

@version = version
@tag = tag.to_s
@tag = tag.to_unstandardized_sym.to_s
@rebuild = rebuild
end

Expand Down
5 changes: 5 additions & 0 deletions Library/Homebrew/test/formula_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,11 @@ class FooVariations < Formula
"intel-formula",
"linux-formula"
]
},
"arm64_linux": {
"dependencies": [
"linux-formula"
]
}
}
JSON
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/test/utils/bottles/tag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@
expect(tag.valid_combination?).to be true
end

it "returns false for ARM on Linux" do
it "returns true for ARM on Linux" do
tag = described_class.new(system: :linux, arch: :arm64)
expect(tag.valid_combination?).to be false
expect(tag.valid_combination?).to be true
tag = described_class.new(system: :linux, arch: :arm)
expect(tag.valid_combination?).to be false
expect(tag.valid_combination?).to be true
end
end
end
39 changes: 27 additions & 12 deletions Library/Homebrew/utils/bottles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,27 +186,29 @@ def hash
sig { returns(Symbol) }
def standardized_arch
return :x86_64 if [:x86_64, :intel].include? arch
return :arm64 if [:arm64, :arm].include? arch
return :arm64 if [:arm64, :arm, :aarch64].include? arch

arch
end

sig { returns(Symbol) }
def to_sym
if system == :all && arch == :all
:all
elsif macos? && [:x86_64, :intel].include?(arch)
system
else
:"#{standardized_arch}_#{system}"
end
arch_to_symbol(standardized_arch)
end

sig { returns(String) }
def to_s
to_sym.to_s
end

def to_unstandardized_sym
# Never allow these generic names
return to_sym if [:intel, :arm].include? arch

# Backwards compatibility with older bottle names
arch_to_symbol(arch)
end

sig { returns(MacOSVersion) }
def to_macos_version
@to_macos_version ||= MacOSVersion.from_symbol(system)
Expand All @@ -224,8 +226,8 @@ def macos?

sig { returns(T::Boolean) }
def valid_combination?
return true unless [:arm64, :arm].include? arch
return false if linux?
return true unless [:arm64, :arm, :aarch64].include? arch
return true unless macos?

# Big Sur is the first version of macOS that runs on ARM
to_macos_version >= :big_sur
Expand All @@ -235,7 +237,7 @@ def valid_combination?
def default_prefix
if linux?
HOMEBREW_LINUX_DEFAULT_PREFIX
elsif arch == :arm64
elsif standardized_arch == :arm64
HOMEBREW_MACOS_ARM_DEFAULT_PREFIX
else
HOMEBREW_DEFAULT_PREFIX
Expand All @@ -246,12 +248,25 @@ def default_prefix
def default_cellar
if linux?
Homebrew::DEFAULT_LINUX_CELLAR
elsif arch == :arm64
elsif standardized_arch == :arm64
Homebrew::DEFAULT_MACOS_ARM_CELLAR
else
Homebrew::DEFAULT_MACOS_CELLAR
end
end

private

sig { params(arch: Symbol).returns(Symbol) }
def arch_to_symbol(arch)
if system == :all && arch == :all
:all
elsif macos? && standardized_arch == :x86_64
system
else
:"#{arch}_#{system}"
end
end
end

# The specification for a specific tag
Expand Down
2 changes: 1 addition & 1 deletion docs/Homebrew-on-Linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ To install build tools, paste at a terminal prompt:

### ARM (unsupported)

Homebrew can run on 32-bit ARM (Raspberry Pi and others) and 64-bit ARM (AArch64), but as they lack binary packages (bottles) they are unsupported. Pull requests are welcome to improve the experience on ARM platforms.
Homebrew can run on 32-bit ARM (Raspberry Pi and others) and 64-bit ARM (AArch64, also known as ARM64), but as they lack binary packages (bottles) they are unsupported. Pull requests are welcome to improve the experience on ARM platforms.

You may need to install your own Ruby using your system package manager, a PPA, or `rbenv/ruby-build` as we no longer distribute a Homebrew Portable Ruby for ARM.

Expand Down

0 comments on commit 17464d2

Please sign in to comment.