Skip to content

Commit

Permalink
Fix toolchain downloads for Apple M1/OTP 24
Browse files Browse the repository at this point in the history
OTP 24 returns 'aarch64-apple-darwin20.4.0' for the system architecture.
Previous OTP versions returned 'arm-apple-darwin20.4.0'. The toolchain
filename is constructed from the first word in the triple, so toolchains
started failing of M1 Macs.

This is a quick workaround that normalizes the name to the old way.
  • Loading branch information
fhunleth committed Jun 23, 2021
1 parent a4d4917 commit 8ce0d6b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/nerves/artifact.ex
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,17 @@ defmodule Nerves.Artifact do
end

def host_tuple(_pkg) do
Nerves.Env.host_os() <> "_" <> Nerves.Env.host_arch()
(Nerves.Env.host_os() <> "_" <> Nerves.Env.host_arch())
|> normalize_osx()
end

# Workaround for OTP 24 returning 'aarch64-apple-darwin20.4.0'
# and OTP 23 and earlier returning 'arm-apple-darwin20.4.0'.
#
# The current Nerves tooling naming uses "arm".
defp normalize_osx("darwin_aarch64"), do: "darwin_arm"
defp normalize_osx(other), do: other

@doc """
Determines the extension for an artifact based off its type.
Toolchains use xz compression.
Expand Down

0 comments on commit 8ce0d6b

Please sign in to comment.