| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 """Download archived multivm or dartium builds. | 7 """Download archived multivm or dartium builds. |
| 8 | 8 |
| 9 Usage: download_multivm.py revision target_directory | 9 Usage: download_multivm.py revision target_directory |
| 10 """ | 10 """ |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 def ExecuteCommand(cmd): | 30 def ExecuteCommand(cmd): |
| 31 print 'Executing: ' + ' '.join(cmd) | 31 print 'Executing: ' + ' '.join(cmd) |
| 32 subprocess.check_output(cmd) | 32 subprocess.check_output(cmd) |
| 33 | 33 |
| 34 def main(): | 34 def main(): |
| 35 revision = sys.argv[1] | 35 revision = sys.argv[1] |
| 36 target_dir = sys.argv[2] | 36 target_dir = sys.argv[2] |
| 37 archive_dir = (os.environ['BUILDBOT_BUILDERNAME'] | 37 archive_dir = (os.environ['BUILDBOT_BUILDERNAME'] |
| 38 .replace('linux', 'lucid64') | 38 .replace('linux', 'lucid64') |
| 39 .replace('multivm', 'multivm-dartium')) | 39 .replace('multivm', 'multivm-dartium') |
| 40 .replace('perf', 'build')) |
| 40 utils = imp.load_source('utils', os.path.join(TOOLS_DIR, 'utils.py')) | 41 utils = imp.load_source('utils', os.path.join(TOOLS_DIR, 'utils.py')) |
| 41 with utils.TempDir() as temp_dir: | 42 with utils.TempDir() as temp_dir: |
| 42 archive_file = archive_dir + '-' + revision + '.zip' | 43 archive_file = archive_dir + '-' + revision + '.zip' |
| 43 gs_source = '/'.join([GS_BUCKET, archive_dir, archive_file]) | 44 gs_source = '/'.join([GS_BUCKET, archive_dir, archive_file]) |
| 44 zip_file = os.path.join(temp_dir, archive_file) | 45 zip_file = os.path.join(temp_dir, archive_file) |
| 45 ExecuteCommand([GSUTIL, 'cp', gs_source, zip_file]) | 46 ExecuteCommand([GSUTIL, 'cp', gs_source, zip_file]) |
| 46 | 47 |
| 47 unzip_dir = zip_file.replace('.zip', '') | 48 unzip_dir = zip_file.replace('.zip', '') |
| 48 if platform.system() == 'Windows': | 49 if platform.system() == 'Windows': |
| 49 executable = os.path.join(SRC_DIR, 'third_party', 'lzma_sdk', | 50 executable = os.path.join(SRC_DIR, 'third_party', 'lzma_sdk', |
| 50 'Executable', '7za.exe') | 51 'Executable', '7za.exe') |
| 51 ExecuteCommand([executable, 'x', '-aoa', '-o' + temp_dir, zip_file]) | 52 ExecuteCommand([executable, 'x', '-aoa', '-o' + temp_dir, zip_file]) |
| 52 else: | 53 else: |
| 53 ExecuteCommand(['unzip', zip_file, '-d', temp_dir]) | 54 ExecuteCommand(['unzip', zip_file, '-d', temp_dir]) |
| 54 | 55 |
| 55 if os.path.exists(target_dir): | 56 if os.path.exists(target_dir): |
| 56 shutil.rmtree(target_dir) | 57 shutil.rmtree(target_dir) |
| 57 shutil.move(unzip_dir, target_dir) | 58 shutil.move(unzip_dir, target_dir) |
| 58 | 59 |
| 59 if __name__ == '__main__': | 60 if __name__ == '__main__': |
| 60 sys.exit(main()) | 61 sys.exit(main()) |
| OLD | NEW |