Debian Codegraph @

infra/bots/assets/clang_mac_arm/create.py

raw
1 #!/usr/bin/env python3
2 #
3 # Copyright 2026 Google LLC
4 #
5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file.
7
8
9 """Create the asset."""
10
11
12 import argparse
13 import os
14 import subprocess
15 import sys
16
17 FILE_DIR = os.path.dirname(os.path.abspath(__file__))
18 INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir))
19 sys.path.insert(0, INFRA_BOTS_DIR)
20 import utils
21
22 # From a Chromium checkout, run the following script and look for the file that it downloads.
23 # $ tools/clang/scripts/update.py --output-dir /tmp/mac_clang --host-os mac-arm64
24 # Downloading https://commondatastorage.googleapis.com/chromium-browser-clang/Mac_arm64/$TAR_FILE
25
26 # This contains universal Arm binaries for clang, but does not contain pre-builts of libc++.
27 TAR_FILE = "clang-llvmorg-22-init-14273-gea10026b-2.tar.xz"
28 GS_URL = f'https://commondatastorage.googleapis.com/chromium-browser-clang/Mac_arm64/{TAR_FILE}'
29
30 def create_asset(target_dir):
31 """Create the asset."""
32 with utils.chdir(target_dir):
33 tarball = 'clang.tar.xz'
34 subprocess.check_call(['wget', '-O', tarball, GS_URL])
35 subprocess.check_call(['tar', 'xf', tarball])
36 os.remove(tarball)
37
38
39 def main():
40 parser = argparse.ArgumentParser()
41 parser.add_argument('--target_dir', '-t', required=True)
42 args = parser.parse_args()
43 create_asset(args.target_dir)
44
45
46 if __name__ == '__main__':
47 main()