Commit 17e920f4 authored by Nico Weber's avatar Nico Weber Committed by Chromium LUCI CQ

mac: Pull arm64 gn binary on M1 hosts.

...at least once there's an arm cipd binary.

gclient's DEPS variables have a host_cpu variable (backed by
detect_host_arch.py in depot_tools, which even correctly returns "arm64" on
M1s), but it can't be queried via Var() in DEPS (and even if that was possible,
the x64 value is "x64" and not "amd64" like we'd need for the cipd package
name) and we can't use it in a gclient `condition` here either since we'd have
to do something like

  'src/buildtools/mac': {
    ...'gn/gn/mac-amd64'
    condition: 'host_os == "mac" and host_cpu == "x64"'
  }
  'src/buildtools/mac': {
    ...'gn/gn/mac-arm64'
    condition: 'host_os == "mac" and host_cpu == "arm64"'
  }

and then gclient would complain that we have two entries for the key
'src/buildtools/mac'. So gclient variables and cipd deps don't synergize very
well here.

However, cipd has a bunch of built-in variables too, and ${arch} is populated
based on runtime.GOARCH and that is "amd64" in x64 and "arm64" on arm64, so we
can use that:

  https://chromium.googlesource.com/infra/luci/luci-go/+/master/cipd/client/cipd/ensure/doc.go

(In fact, we could use `gn/gn/${{platform}}` and remove the conditional on
host_os. That might confuse linux/arm and windows/arm machines since we might
not have gn prebuilts for those, but trying to build on those platforms
probably doesn't work great for other reasons already?)

Bug: 1103319
Change-Id: I2d445a02e5e05f9553929404a3d569f7fe7a2213
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2602663
Commit-Queue: Nico Weber <thakis@chromium.org>
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarDirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#839584}
parent 9cbfd86b
...@@ -411,7 +411,7 @@ deps = { ...@@ -411,7 +411,7 @@ deps = {
'src/buildtools/mac': { 'src/buildtools/mac': {
'packages': [ 'packages': [
{ {
'package': 'gn/gn/mac-amd64', 'package': 'gn/gn/mac-${{arch}}',
'version': Var('gn_version'), 'version': Var('gn_version'),
} }
], ],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment