Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/python | |
| 2 | |
| 3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 4 # for details. All rights reserved. Use of this source code is governed by a | |
| 5 # BSD-style license that can be found in the LICENSE file. | |
| 6 | |
| 7 """Download archived multivm or dartium builds. | |
| 8 | |
| 9 Usage: download_multivm.py revision build_directory target_directory | |
| 10 """ | |
| 11 | |
| 12 import os | |
| 13 import platform | |
| 14 import shutil | |
| 15 import subprocess | |
| 16 import sys | |
| 17 | |
| 18 BUILDER_NAME = 'BUILDBOT_BUILDERNAME' | |
| 19 | |
| 20 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
| |
| 21 GSUTIL = 'e:\\b\\build\\scripts\\slave\\gsutil.bat' | |
| 22 else: | |
| 23 GSUTIL = '/b/build/scripts/slave/gsutil' | |
| 24 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.
| |
| 25 | |
| 26 GS_SITE = 'gs://' | |
| 27 GS_BUCKET = 'dartium-archive' | |
| 28 # We are in [checkout dir]/src/dart/tools/dartium in a dartium/multivm checkout | |
| 29 SRC_DIR = os.path.dirname( | |
| 30 os.path.dirname( | |
| 31 os.path.dirname( | |
| 32 os.path.dirname(__file__)))) | |
| 33 | |
| 34 def DownloadArchive(bucket, revision, build_dir, target_dir): | |
| 35 dartium_bucket = bucket.replace('multivm', 'multivm-dartium') | |
| 36 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
| |
| 37 | |
| 38 source = '/'.join([GS_SITE + GS_BUCKET, dartium_bucket, dartium_archive]) | |
| 39 zip_file = '/'.join([build_dir, dartium_archive]) | |
| 40 | |
| 41 if not os.path.exists(GSUTIL): | |
| 42 print('download_multivm.py must be run in a dartium or multivm checkout' | |
| 43 ' on a buildbot slave.\nCould not find gsutil at %s' % GSUTIL) | |
| 44 sys.exit(-1) | |
| 45 ExecuteCommand([GSUTIL, 'cp', source, zip_file]) | |
| 46 unzip_result_dir = zip_file.replace('.zip', '') | |
| 47 if os.path.exists(unzip_result_dir): | |
| 48 shutil.rmtree(unzip_result_dir) | |
| 49 | |
| 50 if platform.system() == 'Windows': | |
| 51 executable = os.path.join(SRC_DIR, 'third_party', 'lzma_sdk', | |
| 52 'Executable', '7za.exe') | |
| 53 ExecuteCommand([executable, 'x', '-aoa', '-o%s' % build_dir, zip_file]) | |
| 54 else: | |
| 55 ExecuteCommand(['unzip', zip_file, '-d', build_dir]) | |
| 56 os.remove(zip_file) | |
| 57 if os.path.exists(target_dir): | |
| 58 shutil.rmtree(target_dir) | |
| 59 shutil.move(zip_file.replace('.zip', ''), target_dir) | |
| 60 return 0 | |
| 61 | |
| 62 | |
| 63 def ExecuteCommand(cmd): | |
| 64 print 'Executing: ' + ' '.join(cmd) | |
| 65 subprocess.check_output(cmd) | |
| 66 | |
| 67 def main(): | |
| 68 revision = sys.argv[1] | |
| 69 build_dir = sys.argv[2] | |
| 70 target_dir = sys.argv[3] | |
| 71 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.
| |
| 72 DownloadArchive(bucket, revision, build_dir, target_dir) | |
| 73 | |
| 74 if __name__ == '__main__': | |
| 75 sys.exit(main()) | |
| OLD | NEW |