| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Steps to archive dartium, content_shell, and chromedriver from buildbots. | 7 """Steps to archive dartium, content_shell, and chromedriver from buildbots. |
| 8 | 8 |
| 9 Imported by buildbot_annotated_steps.py and multivm_archive.py | 9 Imported by buildbot_annotated_steps.py and multivm_archive.py |
| 10 """ | 10 """ |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 231 |
| 232 def UploadDartTestsResults(layout_test_results_dir, name, version, | 232 def UploadDartTestsResults(layout_test_results_dir, name, version, |
| 233 component, checked): | 233 component, checked): |
| 234 """Uploads test results to google storage. | 234 """Uploads test results to google storage. |
| 235 """ | 235 """ |
| 236 print ('@@@BUILD_STEP archive %s_layout_%s_tests results@@@' % | 236 print ('@@@BUILD_STEP archive %s_layout_%s_tests results@@@' % |
| 237 (component, checked)) | 237 (component, checked)) |
| 238 dir_name = os.path.dirname(layout_test_results_dir) | 238 dir_name = os.path.dirname(layout_test_results_dir) |
| 239 base_name = os.path.basename(layout_test_results_dir) | 239 base_name = os.path.basename(layout_test_results_dir) |
| 240 cwd = os.getcwd() | 240 cwd = os.getcwd() |
| 241 os.chdir(dir_name) | 241 try: |
| 242 os.chdir(dir_name) |
| 242 | 243 |
| 243 archive_name = 'layout_test_results.zip' | 244 archive_name = 'layout_test_results.zip' |
| 244 archive.ZipDir(archive_name, base_name) | 245 archive.ZipDir(archive_name, base_name) |
| 245 | 246 |
| 246 target = '/'.join([GS_DIR, 'layout-test-results', name, component + '-' + | 247 target = '/'.join([GS_DIR, 'layout-test-results', name, component + '-' + |
| 247 checked + '-' + version + '.zip']) | 248 checked + '-' + version + '.zip']) |
| 248 status = OldUploadFile(os.path.abspath(archive_name), GS_SITE + target) | 249 status = OldUploadFile(os.path.abspath(archive_name), GS_SITE + target) |
| 249 os.remove(archive_name) | 250 os.remove(archive_name) |
| 250 if status == 0: | 251 if status == 0: |
| 251 print ('@@@STEP_LINK@download@' + GS_URL + target + '@@@') | 252 print ('@@@STEP_LINK@download@' + GS_URL + target + '@@@') |
| 252 else: | 253 else: |
| 254 print '@@@STEP_FAILURE@@@' |
| 255 except: |
| 253 print '@@@STEP_FAILURE@@@' | 256 print '@@@STEP_FAILURE@@@' |
| 254 os.chdir(cwd) | 257 os.chdir(cwd) |
| 255 | 258 |
| 256 | 259 |
| 257 def ListArchives(pattern): | 260 def ListArchives(pattern): |
| 258 """List the contents in Google storage matching the file pattern. | 261 """List the contents in Google storage matching the file pattern. |
| 259 """ | 262 """ |
| 260 cmd = [GSUTIL, 'ls', pattern] | 263 cmd = [GSUTIL, 'ls', pattern] |
| 261 (status, output) = ExecuteCommand(cmd) | 264 (status, output) = ExecuteCommand(cmd) |
| 262 if status != 0: | 265 if status != 0: |
| 263 return [] | 266 return [] |
| 264 return output.split(os.linesep) | 267 return output.split(os.linesep) |
| 265 | 268 |
| 266 | 269 |
| 267 def RemoveArchives(archives): | 270 def RemoveArchives(archives): |
| 268 """Remove the list of archives in Google storage. | 271 """Remove the list of archives in Google storage. |
| 269 """ | 272 """ |
| 270 for archive in archives: | 273 for archive in archives: |
| 271 if archive.find(GS_SITE) == 0: | 274 if archive.find(GS_SITE) == 0: |
| 272 cmd = [GSUTIL, 'rm', archive.rstrip()] | 275 cmd = [GSUTIL, 'rm', archive.rstrip()] |
| 273 (status, _) = ExecuteCommand(cmd) | 276 (status, _) = ExecuteCommand(cmd) |
| 274 if status != 0: | 277 if status != 0: |
| 275 return status | 278 return status |
| 276 return 0 | 279 return 0 |
| OLD | NEW |