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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 | 199 |
200 def UploadFile(local_path, remote_path, create_md5sum=False): | 200 def UploadFile(local_path, remote_path, create_md5sum=False): |
201 # Copy it to the new unified gs://dart-archive bucket | 201 # Copy it to the new unified gs://dart-archive bucket |
202 gsutil = bot_utils.GSUtil() | 202 gsutil = bot_utils.GSUtil() |
203 gsutil.upload(local_path, remote_path, public=True) | 203 gsutil.upload(local_path, remote_path, public=True) |
204 if create_md5sum: | 204 if create_md5sum: |
205 # 'local_path' may have a different filename than 'remote_path'. So we need | 205 # 'local_path' may have a different filename than 'remote_path'. So we need |
206 # to make sure the *.md5sum file contains the correct name. | 206 # to make sure the *.md5sum file contains the correct name. |
207 assert '/' in remote_path and not remote_path.endswith('/') | 207 assert '/' in remote_path and not remote_path.endswith('/') |
208 mangled_filename = remote_path[remote_path.rfind('/') + 1:] | 208 mangled_filename = remote_path[remote_path.rfind('/') + 1:] |
209 local_md5sum = bot_utils.CreateChecksumFile(local_path, mangled_filename) | 209 local_md5sum = bot_utils.CreateMD5ChecksumFile(local_path, mangled_filename) |
210 gsutil.upload(local_md5sum, remote_path + '.md5sum', public=True) | 210 gsutil.upload(local_md5sum, remote_path + '.md5sum', public=True) |
211 | 211 local_sha256 = bot_utils.CreateSha256ChecksumFile(local_path, mangled_filena me) |
kevmoo
2014/08/06 01:03:57
long line -> we try to keep all lines <= 80 chars
| |
212 gsutil.upload(local_sha256, remote_path + '.sha256', public=True) | |
212 | 213 |
213 def ExecuteCommand(cmd): | 214 def ExecuteCommand(cmd): |
214 """Execute a command in a subprocess. | 215 """Execute a command in a subprocess. |
215 """ | 216 """ |
216 print 'Executing: ' + ' '.join(cmd) | 217 print 'Executing: ' + ' '.join(cmd) |
217 try: | 218 try: |
218 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | 219 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
219 (output, error) = pipe.communicate() | 220 (output, error) = pipe.communicate() |
220 if pipe.returncode != 0: | 221 if pipe.returncode != 0: |
221 print 'Execution failed: ' + str(error) | 222 print 'Execution failed: ' + str(error) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 def RemoveArchives(archives): | 265 def RemoveArchives(archives): |
265 """Remove the list of archives in Google storage. | 266 """Remove the list of archives in Google storage. |
266 """ | 267 """ |
267 for archive in archives: | 268 for archive in archives: |
268 if archive.find(GS_SITE) == 0: | 269 if archive.find(GS_SITE) == 0: |
269 cmd = [GSUTIL, 'rm', archive.rstrip()] | 270 cmd = [GSUTIL, 'rm', archive.rstrip()] |
270 (status, _) = ExecuteCommand(cmd) | 271 (status, _) = ExecuteCommand(cmd) |
271 if status != 0: | 272 if status != 0: |
272 return status | 273 return status |
273 return 0 | 274 return 0 |
OLD | NEW |