Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: build/download_sdk_extras.py

Issue 940633003: Catch AccessDeniedException on bots without permission to download SDK extras. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: If OS=android not in GYP_DEFINES then not Android bot, return 0. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Script to download sdk/extras packages on the bots from google storage. 6 """Script to download sdk/extras packages on the bots from google storage.
7 7
8 The script expects arguments that specify zips file in the google storage 8 The script expects arguments that specify zips file in the google storage
9 bucket named: <dir in SDK extras>_<package name>_<version>.zip. The file will 9 bucket named: <dir in SDK extras>_<package name>_<version>.zip. The file will
10 be extracted in the android_tools/sdk/extras directory on the test bots. This 10 be extracted in the android_tools/sdk/extras directory on the test bots. This
11 script will not do anything for developers. 11 script will not do anything for developers.
12
13 TODO(navabi): Move this script (crbug.com/459819).
12 """ 14 """
13 15
14 import json 16 import json
15 import os 17 import os
16 import shutil 18 import shutil
17 import subprocess 19 import subprocess
18 import sys 20 import sys
19 import zipfile 21 import zipfile
20 22
21 SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) 23 SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
(...skipping 18 matching lines...) Expand all
40 shutil.rmtree(local_dir) 42 shutil.rmtree(local_dir)
41 local_zip = '%s/%s' % (SDK_EXTRAS_PATH, zip_file) 43 local_zip = '%s/%s' % (SDK_EXTRAS_PATH, zip_file)
42 with zipfile.ZipFile(local_zip) as z: 44 with zipfile.ZipFile(local_zip) as z:
43 z.extractall(path=SDK_EXTRAS_PATH) 45 z.extractall(path=SDK_EXTRAS_PATH)
44 46
45 47
46 def main(): 48 def main():
47 if not os.environ.get('CHROME_HEADLESS'): 49 if not os.environ.get('CHROME_HEADLESS'):
48 # This is not a buildbot checkout. 50 # This is not a buildbot checkout.
49 return 0 51 return 0
52 elif 'OS=android' not in os.environ.get('GYP_DEFINES', ''):
53 # Not an Android buildbot.
54 return 0
50 # Update the android_sdk_extras.json file to update downloaded packages. 55 # Update the android_sdk_extras.json file to update downloaded packages.
51 with open(SDK_EXTRAS_JSON_FILE) as json_file: 56 with open(SDK_EXTRAS_JSON_FILE) as json_file:
52 packages = json.load(json_file) 57 packages = json.load(json_file)
53 for package in packages: 58 for package in packages:
54 local_zip = '%s/%s' % (SDK_EXTRAS_PATH, package['zip']) 59 local_zip = '%s/%s' % (SDK_EXTRAS_PATH, package['zip'])
55 if not os.path.exists(local_zip): 60 if not os.path.exists(local_zip):
56 package_zip = '%s/%s' % (SDK_EXTRAS_BUCKET, package['zip']) 61 package_zip = '%s/%s' % (SDK_EXTRAS_BUCKET, package['zip'])
57 subprocess.check_call(['python', GSUTIL_PATH, '--force-version', '4.7', 62 subprocess.check_call(['python', GSUTIL_PATH, '--force-version', '4.7',
58 'cp', package_zip, local_zip]) 63 'cp', package_zip, local_zip])
59 # Always clean dir and extract zip to ensure correct contents. 64 # Always clean dir and extract zip to ensure correct contents.
60 clean_and_extract(package['dir_name'], package['package'], package['zip']) 65 clean_and_extract(package['dir_name'], package['package'], package['zip'])
61 66
62 67
63 if __name__ == '__main__': 68 if __name__ == '__main__':
64 sys.exit(main()) 69 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698