Index: build/download_sdk_extras.py |
diff --git a/build/download_sdk_extras.py b/build/download_sdk_extras.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f6fa7b2e5f4abab076708099ad0e7781d7fea7b0 |
--- /dev/null |
+++ b/build/download_sdk_extras.py |
@@ -0,0 +1,42 @@ |
+#!/usr/bin/env python |
+# Copyright (c) 2014 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+"""Script to download sdk/extras packages on the bots from google storage.""" |
+ |
+import os |
+import subprocess |
+import sys |
+ |
+sys.path.insert(0, os.path.join('android')) |
+from pylib import constants |
+ |
+GSUTIL_PATH = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, |
nyquist
2014/11/11 19:50:31
is gsutils checkout out into //third_party/gsutil/
navabi
2014/11/11 19:53:23
No. On the bots gsutils is in /b/build/third_party
nyquist
2014/11/11 19:56:53
Is there no other way for referring to buildbot pa
|
+ os.pardir, os.pardir, os.pardir, 'third_party', 'gsutil', 'gsutil') |
+SDK_EXTRAS_BUCKET = 'gs://chrome-sdk-extras' |
+SDK_EXTRAS_PATH = os.path.join(constants.ANDROID_SDK_ROOT, 'extras') |
+ |
+ |
+def GetCmdOutputAndStatus(cmd_lst): |
+ process = subprocess.Popen(cmd_lst, stdout=subprocess.PIPE) |
+ stdout, _ = process.communicate() |
+ return stdout, process.returncode |
+ |
+def is_buildbot_checkout(): |
+ if not os.path.exists(GSUTIL_PATH): |
+ return False |
+ stdout, rc = GetCmdOutputAndStatus([GSUTIL_PATH, 'ls', SDK_EXTRAS_BUCKET]) |
+ # If successfully read bucket, then this must be a bot with permissions |
+ return not rc |
+ |
+def main(): |
+ if is_buildbot_checkout(): |
+ cmd_lst = [GSUTIL_PATH, 'cp', '-r', SDK_EXTRAS_BUCKET, SDK_EXTRAS_PATH] |
navabi
2014/11/07 04:21:23
The idea is to put directories in the google bucke
|
+ stdout, rc = GetCmdOutputAndStatus(cmd_lst) |
+ return rc |
+ return 0 |
+ |
+ |
+if __name__ == '__main__': |
+ sys.exit(main()) |