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

Unified 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: Use gclient rsync and introduce versioning. Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« DEPS ('K') | « DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/download_sdk_extras.py
diff --git a/build/download_sdk_extras.py b/build/download_sdk_extras.py
new file mode 100755
index 0000000000000000000000000000000000000000..f5d965cd57f49568c85d5ef5ec61d918dc800a21
--- /dev/null
+++ b/build/download_sdk_extras.py
@@ -0,0 +1,45 @@
+#!/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(os.path.dirname(__file__), 'android'))
+from pylib import constants
+
+GSUTIL_PATH = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
+ 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(args):
+ if is_buildbot_checkout():
+ for arg in args[1:]:
+ package_bucket = '%s/%s' % (SDK_EXTRAS_BUCKET, arg)
navabi 2014/11/21 09:40:29 list of packages to download into third_party/andr
+ 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
+ SDK_EXTRAS_PATH]
+ stdout, rc = GetCmdOutputAndStatus(cmd_lst)
+ return rc
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
« DEPS ('K') | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698