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

Side by Side Diff: build/download_sdk_extras.py

Issue 709663002: Add gclient hook to download SDK extras on bots. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix assignment to rc and check for android_tools/sdk/extras dir. Created 6 years 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
« DEPS ('K') | « DEPS ('k') | 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
(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'
nyquist 2014/11/25 20:08:26 Does this already have the exact same content (exc
navabi 2014/11/25 20:40:49 Yes.
18 SDK_EXTRAS_PATH = os.path.join(constants.ANDROID_SDK_ROOT, 'extras')
nyquist 2014/11/25 20:08:26 It feels like there should be a .gitignore in http
navabi 2014/11/25 20:40:49 Yes. It is in place, in that the head of the andro
nyquist 2014/11/26 03:17:29 So you also cleaned out that folder? Or are you sa
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():
nyquist 2014/11/25 20:08:26 this is a little bit odd to me, but I don't have a
navabi 2014/11/25 20:40:49 I'll consider it. But even if we checked some othe
27 if not os.path.exists(GSUTIL_PATH) or not os.path.exists(SDK_EXTRAS_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 success = True
36 for arg in args[1:]:
37 package_bucket = '%s/%s' % (SDK_EXTRAS_BUCKET, arg)
38 cmd_lst = [GSUTIL_PATH, '-m', 'rsync', '-r', package_bucket,
nyquist 2014/11/25 20:08:26 would you want '-d' here to delete the files that
navabi 2014/11/25 20:40:49 No. That would remove other packages the way we cu
39 SDK_EXTRAS_PATH]
40 stdout, rc = GetCmdOutputAndStatus(cmd_lst)
41 success = (rc == 0) and success
42 if not success:
43 return 1
44 return 0
45
46
47 if __name__ == '__main__':
48 sys.exit(main(sys.argv))
OLDNEW
« DEPS ('K') | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698