aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRahul Chaudhry <rahulchaudhry@google.com>2017-09-18 10:45:53 -0700
committerRahul Chaudhry <rahulchaudhry@google.com>2017-09-18 10:45:53 -0700
commitdca601e5d2b032ac5cca1df90ac56077ccf5d665 (patch)
treed92ded022b89bcdf2816d44a29627b0c261fc8e3
parent08875d976f14a5c589c1cfcd17614adad06e43d4 (diff)
downloadtoolchain_gcc-dca601e5d2b032ac5cca1df90ac56077ccf5d665.tar.gz
toolchain_gcc-dca601e5d2b032ac5cca1df90ac56077ccf5d665.tar.bz2
toolchain_gcc-dca601e5d2b032ac5cca1df90ac56077ccf5d665.zip
update-prebuilts: use fetch_artifact for downloading prebuilts.
The old method of constructing a URL and downloading using sso_client has stopped working since the URLs have changed. Using fetch_artifact makes this step more robust against future changes in URL schemes. Bug: 37683243 Test: './update-prebuilts.py 4342532' works. Change-Id: I14053709bb9839990e8cf59418010862daf09236
-rwxr-xr-xupdate-prebuilts.py52
1 files changed, 16 insertions, 36 deletions
diff --git a/update-prebuilts.py b/update-prebuilts.py
index 1a2f405ef..660dee55c 100755
--- a/update-prebuilts.py
+++ b/update-prebuilts.py
@@ -62,30 +62,18 @@ class ArgParser(argparse.ArgumentParser):
help='Override the git commit message.')
-def host_to_build_host(host):
- """Gets the build host name for an NDK host tag.
+def build_target(host, arch):
+ """Gets the toolchain build target name for the specified host and arch.
- The Windows builds are done from Linux.
- """
- return {
- 'darwin': 'mac',
- 'linux': 'linux',
- 'windows': 'linux',
- }[host]
-
-
-def build_name(host, arch):
- """Gets the release build name for an NDK host tag.
+ The builds targets are named by combining the host and arch values.
- The builds are named by a short identifier like "linux" or "win64".
+ >>> build_target('darwin', 'arm')
+ 'arm_mac'
- >>> build_name('darwin', 'arm')
- 'arm'
+ >>> build_target('darwin', 'aarch64')
+ 'arm64_mac'
- >>> build_name('darwin', 'aarch64')
- 'arm64'
-
- >>> build_name('linux', 'x86')
+ >>> build_target('linux', 'x86')
'linux_x86'
"""
build_arch = arch
@@ -93,7 +81,7 @@ def build_name(host, arch):
build_arch = 'arm64'
if host == 'darwin':
- return build_arch
+ return build_arch + '_mac'
return host + '_' + build_arch
@@ -134,22 +122,14 @@ def download_build(host, arch, build_number, download_dir, dryrun, cachedir):
'{}'.format(pkg_name, cachedir))
return cached_pkg
- url_base = 'https://android-build-uber.corp.google.com'
- path = 'builds/{branch}-{build_host}-{build_name}/{build_num}'.format(
- branch=BRANCH,
- build_host=host_to_build_host(host),
- build_name=build_name(host, arch),
- build_num=build_number)
-
- url = '{}/{}/{}'.format(url_base, path, pkg_name)
- TIMEOUT = '60' # In seconds.
out_file_path = os.path.join(download_dir, pkg_name)
- with open(out_file_path, 'w') as out_file:
- print('Downloading {} to {}'.format(url, out_file_path))
- invoke_cmd(dryrun,
- ['sso_client', '--location',
- '--request_timeout', TIMEOUT, url],
- outfile=out_file)
+ print('Downloading {} to {}'.format(pkg_name, out_file_path))
+ invoke_cmd(dryrun,
+ ['/google/data/ro/projects/android/fetch_artifact',
+ '--branch={}'.format(BRANCH),
+ '--bid={}'.format(build_number),
+ '--target={}'.format(build_target(host, arch)),
+ pkg_name, out_file_path])
return out_file_path