1

Remove repo fetch-time uname dependency, use new os.arch instead

This commit is contained in:
Ken Micklas 2022-03-25 11:46:11 -04:00 committed by Motiejus Jakštys
parent f3bd9254ad
commit fc62c3a7b7

View File

@ -221,17 +221,14 @@ _ZIG_TOOLS = [
] ]
def _zig_repository_impl(repository_ctx): def _zig_repository_impl(repository_ctx):
res = repository_ctx.execute(["uname", "-m"]) arch = repository_ctx.os.arch
if res.return_code != 0: if arch == "amd64":
fail("failed to run uname -m") arch = "x86_64"
arch = res.stdout.strip()
os = "linux" os = repository_ctx.os.name.lower()
if repository_ctx.os.name.lower().startswith("mac os"): if os.startswith("mac os"):
os = "macos" os = "macos"
if arch == "arm64":
# uname -m reports arm64 on an M1 Mac.
arch = "aarch64"
host_platform = "{}-{}".format(os, arch) host_platform = "{}-{}".format(os, arch)
zig_include_root = repository_ctx.attr.host_platform_include_root[host_platform] zig_include_root = repository_ctx.attr.host_platform_include_root[host_platform]