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

Unified Diff: tools/dartium/download_multivm.py

Issue 291153010: Add multivm archive download script for buildbot use. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use subprocess.check_output Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dartium/download_multivm.py
diff --git a/tools/dartium/download_multivm.py b/tools/dartium/download_multivm.py
new file mode 100755
index 0000000000000000000000000000000000000000..8f02a025563d3113a280a9259b905054540e3a4d
--- /dev/null
+++ b/tools/dartium/download_multivm.py
@@ -0,0 +1,75 @@
+#!/usr/bin/python
+
+# Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+"""Download archived multivm or dartium builds.
+
+ Usage: download_multivm.py revision build_directory target_directory
+"""
+
+import os
+import platform
+import shutil
+import subprocess
+import sys
+
+BUILDER_NAME = 'BUILDBOT_BUILDERNAME'
+
+if platform.system() == 'Windows':
ricow1 2014/05/22 13:18:11 if we are not on a bot we should default to just g
Bill Hesse 2014/05/22 16:23:41 Done. But we will fail earlier if BUILDBOT_BUILDE
+ GSUTIL = 'e:\\b\\build\\scripts\\slave\\gsutil.bat'
+else:
+ GSUTIL = '/b/build/scripts/slave/gsutil'
+GSUTIL = '/usr/local/google/home/whesse/ssd/gsutil/gsutil'
ricow1 2014/05/22 13:18:11 I don't think you want to do that :-)
Bill Hesse 2014/05/22 16:23:41 Done.
+
+GS_SITE = 'gs://'
+GS_BUCKET = 'dartium-archive'
+# We are in [checkout dir]/src/dart/tools/dartium in a dartium/multivm checkout
+SRC_DIR = os.path.dirname(
+ os.path.dirname(
+ os.path.dirname(
+ os.path.dirname(__file__))))
+
+def DownloadArchive(bucket, revision, build_dir, target_dir):
+ dartium_bucket = bucket.replace('multivm', 'multivm-dartium')
+ dartium_archive = dartium_bucket + '-' + revision + '.zip'
ricow1 2014/05/22 13:18:11 dartium_archive -> filename
Bill Hesse 2014/05/22 16:23:41 archive_file
+
+ source = '/'.join([GS_SITE + GS_BUCKET, dartium_bucket, dartium_archive])
+ zip_file = '/'.join([build_dir, dartium_archive])
+
+ if not os.path.exists(GSUTIL):
+ print('download_multivm.py must be run in a dartium or multivm checkout'
+ ' on a buildbot slave.\nCould not find gsutil at %s' % GSUTIL)
+ sys.exit(-1)
+ ExecuteCommand([GSUTIL, 'cp', source, zip_file])
+ unzip_result_dir = zip_file.replace('.zip', '')
+ if os.path.exists(unzip_result_dir):
+ shutil.rmtree(unzip_result_dir)
+
+ if platform.system() == 'Windows':
+ executable = os.path.join(SRC_DIR, 'third_party', 'lzma_sdk',
+ 'Executable', '7za.exe')
+ ExecuteCommand([executable, 'x', '-aoa', '-o%s' % build_dir, zip_file])
+ else:
+ ExecuteCommand(['unzip', zip_file, '-d', build_dir])
+ os.remove(zip_file)
+ if os.path.exists(target_dir):
+ shutil.rmtree(target_dir)
+ shutil.move(zip_file.replace('.zip', ''), target_dir)
+ return 0
+
+
+def ExecuteCommand(cmd):
+ print 'Executing: ' + ' '.join(cmd)
+ subprocess.check_output(cmd)
+
+def main():
+ revision = sys.argv[1]
+ build_dir = sys.argv[2]
+ target_dir = sys.argv[3]
+ bucket = os.environ[BUILDER_NAME].replace('linux', 'lucid64')
ricow1 2014/05/22 13:18:11 do all the renaming here, remove from DownloadArch
Bill Hesse 2014/05/22 16:23:41 Done.
+ DownloadArchive(bucket, revision, build_dir, target_dir)
+
+if __name__ == '__main__':
+ sys.exit(main())
« 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