OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 """Script to download sdk/extras packages on the bots from google storage.""" | |
7 | |
8 import os | |
9 import subprocess | |
10 import sys | |
11 | |
12 sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'android')) | |
13 from pylib import constants | |
14 | |
15 GSUTIL_PATH = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, | |
16 os.pardir, os.pardir, os.pardir, 'third_party', 'gsutil', 'gsutil') | |
17 SDK_EXTRAS_BUCKET = 'gs://chrome-sdk-extras' | |
18 SDK_EXTRAS_PATH = os.path.join(constants.ANDROID_SDK_ROOT, 'extras') | |
19 | |
20 | |
21 def GetCmdOutputAndStatus(cmd_lst): | |
22 process = subprocess.Popen(cmd_lst, stdout=subprocess.PIPE) | |
23 stdout, _ = process.communicate() | |
24 return stdout, process.returncode | |
25 | |
26 def is_buildbot_checkout(): | |
27 if not os.path.exists(GSUTIL_PATH): | |
28 return False | |
29 stdout, rc = GetCmdOutputAndStatus([GSUTIL_PATH, 'ls', SDK_EXTRAS_BUCKET]) | |
30 # If successfully read bucket, then this must be a bot with permissions | |
31 return not rc | |
32 | |
33 def main(args): | |
34 if is_buildbot_checkout(): | |
35 for arg in args[1:]: | |
36 package_bucket = '%s/%s' % (SDK_EXTRAS_BUCKET, arg) | |
navabi
2014/11/21 09:40:29
list of packages to download into third_party/andr
| |
37 cmd_lst = [GSUTIL_PATH, '-m', 'rsync', '-r', package_bucket, | |
navabi
2014/11/21 09:40:29
This will require us to upgrade the gsutil used on
| |
38 SDK_EXTRAS_PATH] | |
39 stdout, rc = GetCmdOutputAndStatus(cmd_lst) | |
40 return rc | |
41 return 0 | |
42 | |
43 | |
44 if __name__ == '__main__': | |
45 sys.exit(main(sys.argv)) | |
OLD | NEW |