OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """This module contains functions for fetching and extracting archived builds. | 5 """This module contains functions for fetching and extracting archived builds. |
6 | 6 |
7 The builds may be stored in different places by different types of builders; | 7 The builds may be stored in different places by different types of builders; |
8 for example, builders on tryserver.chromium.perf stores builds in one place, | 8 for example, builders on tryserver.chromium.perf stores builds in one place, |
9 while builders on chromium.linux store builds in another. | 9 while builders on chromium.linux store builds in another. |
10 | 10 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 """Returns the directory name to download builds from.""" | 289 """Returns the directory name to download builds from.""" |
290 return self._extra_src.GetArchiveDirectory() | 290 return self._extra_src.GetArchiveDirectory() |
291 | 291 |
292 def GetBuilderName(self): | 292 def GetBuilderName(self): |
293 """Returns the builder name extra source.""" | 293 """Returns the builder name extra source.""" |
294 return self._extra_src.GetBuilderName() | 294 return self._extra_src.GetBuilderName() |
295 | 295 |
296 | 296 |
297 def BuildIsAvailable(bucket_name, remote_path): | 297 def BuildIsAvailable(bucket_name, remote_path): |
298 """Checks whether a build is currently archived at some place.""" | 298 """Checks whether a build is currently archived at some place.""" |
299 logging.info('Checking existance: gs://%s/%s' % (bucket_name, remote_path)) | 299 logging.info('Checking existence: gs://%s/%s' % (bucket_name, remote_path)) |
300 try: | 300 try: |
301 exists = cloud_storage.Exists(bucket_name, remote_path) | 301 exists = cloud_storage.Exists(bucket_name, remote_path) |
302 logging.info('Exists? %s' % exists) | 302 logging.info('Exists? %s' % exists) |
303 return exists | 303 return exists |
304 except cloud_storage.CloudStorageError: | 304 except cloud_storage.CloudStorageError: |
305 return False | 305 return False |
306 | 306 |
307 | 307 |
308 def FetchFromCloudStorage(bucket_name, source_path, destination_dir): | 308 def FetchFromCloudStorage(bucket_name, source_path, destination_dir): |
309 """Fetches file(s) from the Google Cloud Storage. | 309 """Fetches file(s) from the Google Cloud Storage. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 print 'Build is not available.' | 461 print 'Build is not available.' |
462 return 1 | 462 return 1 |
463 | 463 |
464 FetchFromCloudStorage(bucket_name, remote_path, args.output_dir) | 464 FetchFromCloudStorage(bucket_name, remote_path, args.output_dir) |
465 print 'Build has been downloaded to and extracted in %s.' % args.output_dir | 465 print 'Build has been downloaded to and extracted in %s.' % args.output_dir |
466 return 0 | 466 return 0 |
467 | 467 |
468 | 468 |
469 if __name__ == '__main__': | 469 if __name__ == '__main__': |
470 sys.exit(Main(sys.argv)) | 470 sys.exit(Main(sys.argv)) |
OLD | NEW |