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

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: 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. 10 be extracted in the android_tools/sdk/extras directory.
(...skipping 30 matching lines...) Expand all
41 if not os.path.exists(GSUTIL_PATH) or not os.path.exists(SDK_EXTRAS_PATH): 41 if not os.path.exists(GSUTIL_PATH) or not os.path.exists(SDK_EXTRAS_PATH):
42 # This is not a buildbot checkout. 42 # This is not a buildbot checkout.
43 return 0 43 return 0
44 # Update the android_sdk_extras.json file to update downloaded packages. 44 # Update the android_sdk_extras.json file to update downloaded packages.
45 with open(SDK_EXTRAS_JSON_FILE) as json_file: 45 with open(SDK_EXTRAS_JSON_FILE) as json_file:
46 packages = json.load(json_file) 46 packages = json.load(json_file)
47 for package in packages: 47 for package in packages:
48 local_zip = '%s/%s' % (SDK_EXTRAS_PATH, package['zip']) 48 local_zip = '%s/%s' % (SDK_EXTRAS_PATH, package['zip'])
49 if not os.path.exists(local_zip): 49 if not os.path.exists(local_zip):
50 package_zip = '%s/%s' % (SDK_EXTRAS_BUCKET, package['zip']) 50 package_zip = '%s/%s' % (SDK_EXTRAS_BUCKET, package['zip'])
51 subprocess.check_call([GSUTIL_PATH, '--force-version', '4.7', 'cp', 51 try:
52 package_zip, local_zip]) 52 subprocess.check_call(['python', GSUTIL_PATH, '--force-version', '4.7',
hinoka 2015/02/18 21:33:07 s/'python'/sys.executable/
navabi 2015/02/18 22:47:03 I don't think this works on windows. I would expec
53 'cp', package_zip, local_zip])
54 except AccessDeniedException:
55 print ('WARNING: Bot does not have permission to download SDK packages.'
56 ' If this bot compiles for Android, it may have errors.')
hshi1 2015/02/18 21:32:27 why is android_sdk_extras among the packages in th
navabi 2015/02/18 22:47:03 If possible, we should only call download_sdk_pack
Sam Clegg 2015/02/19 01:24:30 There are other scripts that do this by inspecting
53 # Always clean dir and extract zip to ensure correct contents. 57 # Always clean dir and extract zip to ensure correct contents.
54 clean_and_extract(package['dir_name'], package['package'], package['zip']) 58 clean_and_extract(package['dir_name'], package['package'], package['zip'])
55 59
56 60
57 if __name__ == '__main__': 61 if __name__ == '__main__':
58 sys.exit(main()) 62 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