| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Runs all the buildbot steps for ChromeDriver except for update/compile.""" | 6 """Runs all the buildbot steps for ChromeDriver except for update/compile.""" |
| 7 | 7 |
| 8 import bisect | 8 import bisect |
| 9 import csv | 9 import csv |
| 10 import datetime | 10 import datetime |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 import time | 21 import time |
| 22 import urllib2 | 22 import urllib2 |
| 23 import zipfile | 23 import zipfile |
| 24 | 24 |
| 25 import archive | 25 import archive |
| 26 import chrome_paths | 26 import chrome_paths |
| 27 import util | 27 import util |
| 28 | 28 |
| 29 _THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 29 _THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
| 30 GS_ARCHIVE_BUCKET = 'gs://chromedriver-prebuilts' | 30 GS_ARCHIVE_BUCKET = 'gs://chromedriver-prebuilts' |
| 31 GS_ZIP_PREFIX = 'chromedriver2_prebuilts' | 31 GS_ZIP_PREFIX = 'chromedriver_prebuilts' |
| 32 GS_RC_BUCKET = 'gs://chromedriver-rc' | 32 GS_RC_BUCKET = 'gs://chromedriver-rc' |
| 33 GS_RELEASE_PATH = GS_RC_BUCKET + '/releases' | 33 GS_RELEASE_PATH = GS_RC_BUCKET + '/releases' |
| 34 RC_LOG_FORMAT = '%s_log.json' | 34 RC_LOG_FORMAT = '%s_log.json' |
| 35 RC_ZIP_FORMAT = 'chromedriver_%s_%s_%s.zip' | 35 RC_ZIP_FORMAT = 'chromedriver_%s_%s_%s.zip' |
| 36 RC_ZIP_GLOB = 'chromedriver_%s_%s_*' | 36 RC_ZIP_GLOB = 'chromedriver_%s_%s_*' |
| 37 RELEASE_ZIP_FORMAT = 'chromedriver_%s_%s.zip' | 37 RELEASE_ZIP_FORMAT = 'chromedriver_%s_%s.zip' |
| 38 | 38 |
| 39 SCRIPT_DIR = os.path.join(_THIS_DIR, os.pardir, os.pardir, os.pardir, os.pardir, | 39 SCRIPT_DIR = os.path.join(_THIS_DIR, os.pardir, os.pardir, os.pardir, os.pardir, |
| 40 os.pardir, os.pardir, os.pardir, 'scripts') | 40 os.pardir, os.pardir, os.pardir, 'scripts') |
| 41 SITE_CONFIG_DIR = os.path.join(_THIS_DIR, os.pardir, os.pardir, os.pardir, | 41 SITE_CONFIG_DIR = os.path.join(_THIS_DIR, os.pardir, os.pardir, os.pardir, |
| 42 os.pardir, os.pardir, os.pardir, os.pardir, | 42 os.pardir, os.pardir, os.pardir, os.pardir, |
| 43 'site_config') | 43 'site_config') |
| 44 sys.path.append(SCRIPT_DIR) | 44 sys.path.append(SCRIPT_DIR) |
| 45 sys.path.append(SITE_CONFIG_DIR) | 45 sys.path.append(SITE_CONFIG_DIR) |
| 46 from slave import gsutil_download | 46 from slave import gsutil_download |
| 47 from slave import slave_utils | 47 from slave import slave_utils |
| 48 | 48 |
| 49 | 49 |
| 50 def ArchivePrebuilts(revision): | 50 def ArchivePrebuilts(revision): |
| 51 """Uploads the prebuilts to google storage.""" | 51 """Uploads the prebuilts to google storage.""" |
| 52 util.MarkBuildStepStart('archive') | 52 util.MarkBuildStepStart('archive') |
| 53 prebuilts = ['chromedriver2_server', | 53 prebuilts = ['chromedriver', |
| 54 'chromedriver2_unittests', 'chromedriver2_tests'] | 54 'chromedriver_unittests', 'chromedriver_tests'] |
| 55 build_dir = chrome_paths.GetBuildDir(prebuilts[0:1]) | 55 build_dir = chrome_paths.GetBuildDir(prebuilts[0:1]) |
| 56 zip_name = '%s_r%s.zip' % (GS_ZIP_PREFIX, revision) | 56 zip_name = '%s_r%s.zip' % (GS_ZIP_PREFIX, revision) |
| 57 temp_dir = util.MakeTempDir() | 57 temp_dir = util.MakeTempDir() |
| 58 zip_path = os.path.join(temp_dir, zip_name) | 58 zip_path = os.path.join(temp_dir, zip_name) |
| 59 print 'Zipping prebuilts %s' % zip_path | 59 print 'Zipping prebuilts %s' % zip_path |
| 60 f = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) | 60 f = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) |
| 61 for prebuilt in prebuilts: | 61 for prebuilt in prebuilts: |
| 62 f.write(os.path.join(build_dir, prebuilt), prebuilt) | 62 f.write(os.path.join(build_dir, prebuilt), prebuilt) |
| 63 f.close() | 63 f.close() |
| 64 if slave_utils.GSUtilCopyFile(zip_path, GS_ARCHIVE_BUCKET): | 64 if slave_utils.GSUtilCopyFile(zip_path, GS_ARCHIVE_BUCKET): |
| 65 util.MarkBuildStepError() | 65 util.MarkBuildStepError() |
| 66 | 66 |
| 67 | 67 |
| 68 def DownloadPrebuilts(): | 68 def DownloadPrebuilts(): |
| 69 """Downloads the most recent prebuilts from google storage.""" | 69 """Downloads the most recent prebuilts from google storage.""" |
| 70 util.MarkBuildStepStart('Download chromedriver prebuilts') | 70 util.MarkBuildStepStart('Download chromedriver prebuilts') |
| 71 | 71 |
| 72 temp_dir = util.MakeTempDir() | 72 temp_dir = util.MakeTempDir() |
| 73 zip_path = os.path.join(temp_dir, 'chromedriver2_prebuilts.zip') | 73 zip_path = os.path.join(temp_dir, 'chromedriver_prebuilts.zip') |
| 74 if gsutil_download.DownloadLatestFile(GS_ARCHIVE_BUCKET, GS_ZIP_PREFIX, | 74 if gsutil_download.DownloadLatestFile(GS_ARCHIVE_BUCKET, GS_ZIP_PREFIX, |
| 75 zip_path): | 75 zip_path): |
| 76 util.MarkBuildStepError() | 76 util.MarkBuildStepError() |
| 77 | 77 |
| 78 build_dir = chrome_paths.GetBuildDir(['host_forwarder']) | 78 build_dir = chrome_paths.GetBuildDir(['host_forwarder']) |
| 79 print 'Unzipping prebuilts %s to %s' % (zip_path, build_dir) | 79 print 'Unzipping prebuilts %s to %s' % (zip_path, build_dir) |
| 80 f = zipfile.ZipFile(zip_path, 'r') | 80 f = zipfile.ZipFile(zip_path, 'r') |
| 81 f.extractall(build_dir) | 81 f.extractall(build_dir) |
| 82 f.close() | 82 f.close() |
| 83 # Workaround for Python bug: http://bugs.python.org/issue15795 | 83 # Workaround for Python bug: http://bugs.python.org/issue15795 |
| 84 os.chmod(os.path.join(build_dir, 'chromedriver2_server'), 0700) | 84 os.chmod(os.path.join(build_dir, 'chromedriver'), 0700) |
| 85 | 85 |
| 86 | 86 |
| 87 def GetDownloads(): | 87 def GetDownloads(): |
| 88 """Gets the chromedriver google code downloads page.""" | 88 """Gets the chromedriver google code downloads page.""" |
| 89 result, output = slave_utils.GSUtilListBucket(GS_RELEASE_PATH + '/*', ['-l']) | 89 result, output = slave_utils.GSUtilListBucket(GS_RELEASE_PATH + '/*', ['-l']) |
| 90 if result: | 90 if result: |
| 91 return '' | 91 return '' |
| 92 return output | 92 return output |
| 93 | 93 |
| 94 | 94 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 print 'Android tests passed at revision %s' % revision | 268 print 'Android tests passed at revision %s' % revision |
| 269 Release(platform, revision) | 269 Release(platform, revision) |
| 270 else: | 270 else: |
| 271 print 'Android tests have not run at a revision as recent as %s' % revision | 271 print 'Android tests have not run at a revision as recent as %s' % revision |
| 272 | 272 |
| 273 | 273 |
| 274 def _ConstructReleaseCandidate(platform, revision): | 274 def _ConstructReleaseCandidate(platform, revision): |
| 275 """Constructs a release candidate zip from the current build.""" | 275 """Constructs a release candidate zip from the current build.""" |
| 276 zip_name = RC_ZIP_FORMAT % (platform, GetVersion(), revision) | 276 zip_name = RC_ZIP_FORMAT % (platform, GetVersion(), revision) |
| 277 if util.IsWindows(): | 277 if util.IsWindows(): |
| 278 server_orig_name = 'chromedriver2_server.exe' | |
| 279 server_name = 'chromedriver.exe' | 278 server_name = 'chromedriver.exe' |
| 280 else: | 279 else: |
| 281 server_orig_name = 'chromedriver2_server' | |
| 282 server_name = 'chromedriver' | 280 server_name = 'chromedriver' |
| 283 server = os.path.join(chrome_paths.GetBuildDir([server_orig_name]), | 281 server = os.path.join(chrome_paths.GetBuildDir([server_name]), server_name) |
| 284 server_orig_name) | |
| 285 | 282 |
| 286 print 'Zipping ChromeDriver server', server | 283 print 'Zipping ChromeDriver server', server |
| 287 temp_dir = util.MakeTempDir() | 284 temp_dir = util.MakeTempDir() |
| 288 zip_path = os.path.join(temp_dir, zip_name) | 285 zip_path = os.path.join(temp_dir, zip_name) |
| 289 f = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) | 286 f = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) |
| 290 f.write(server, server_name) | 287 f.write(server, server_name) |
| 291 f.close() | 288 f.close() |
| 292 return zip_path | 289 return zip_path |
| 293 | 290 |
| 294 | 291 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 425 |
| 429 if platform == 'android': | 426 if platform == 'android': |
| 430 UpdateTestResultsLog(platform, options.revision, passed) | 427 UpdateTestResultsLog(platform, options.revision, passed) |
| 431 elif passed: | 428 elif passed: |
| 432 _MaybeUpdateReleaseCandidate(platform, options.revision) | 429 _MaybeUpdateReleaseCandidate(platform, options.revision) |
| 433 _MaybeRelease(platform) | 430 _MaybeRelease(platform) |
| 434 | 431 |
| 435 | 432 |
| 436 if __name__ == '__main__': | 433 if __name__ == '__main__': |
| 437 main() | 434 main() |
| OLD | NEW |