Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 target_arch: Architecture, e.g. "ia32". | 44 target_arch: Architecture, e.g. "ia32". |
| 45 target_platform: Platform name, e.g. "chromium" or "android". | 45 target_platform: Platform name, e.g. "chromium" or "android". |
| 46 deps_patch_sha: SHA1 hash which identifies a particular combination of | 46 deps_patch_sha: SHA1 hash which identifies a particular combination of |
| 47 custom revisions for dependency repositories. | 47 custom revisions for dependency repositories. |
| 48 extra_src: Path to a script which can be used to modify the bisect script's | 48 extra_src: Path to a script which can be used to modify the bisect script's |
| 49 behavior. | 49 behavior. |
| 50 | 50 |
| 51 Returns: | 51 Returns: |
| 52 A pair of strings (bucket, path), where the archive is expected to be. | 52 A pair of strings (bucket, path), where the archive is expected to be. |
| 53 """ | 53 """ |
| 54 logging.info('Creating BuildArchive, type "%s", arch "%s", platform "%s".', | |
| 55 builder_type, target_arch, target_platform) | |
| 54 build_archive = BuildArchive.Create( | 56 build_archive = BuildArchive.Create( |
| 55 builder_type, target_arch=target_arch, target_platform=target_platform, | 57 builder_type, target_arch=target_arch, target_platform=target_platform, |
| 56 extra_src=extra_src) | 58 extra_src=extra_src) |
| 57 bucket = build_archive.BucketName() | 59 bucket = build_archive.BucketName() |
| 58 remote_path = build_archive.FilePath(revision, deps_patch_sha=deps_patch_sha) | 60 remote_path = build_archive.FilePath(revision, deps_patch_sha=deps_patch_sha) |
| 59 return bucket, remote_path | 61 return bucket, remote_path |
| 60 | 62 |
| 61 | 63 |
| 62 class BuildArchive(object): | 64 class BuildArchive(object): |
| 63 """Represents a place where builds of some type are stored. | 65 """Represents a place where builds of some type are stored. |
| 64 | 66 |
| 65 There are two pieces of information required to locate a file in Google | 67 There are two pieces of information required to locate a file in Google |
| 66 Cloud Storage, bucket name and file path. Subclasses of this class contain | 68 Cloud Storage, bucket name and file path. Subclasses of this class contain |
| 67 specific logic about which bucket names and paths should be used to fetch | 69 specific logic about which bucket names and paths should be used to fetch |
| 68 a build. | 70 a build. |
| 69 """ | 71 """ |
| 70 | 72 |
| 71 @staticmethod | 73 @staticmethod |
| 72 def Create(builder_type, target_arch='ia32', target_platform='chromium', | 74 def Create(builder_type, target_arch='ia32', target_platform='chromium', |
| 73 extra_src=None): | 75 extra_src=None): |
| 76 logging.info('Creating BuildArchive, type "%s", arch "%s", platform "%s".', | |
| 77 builder_type, target_arch, target_platform) | |
|
prasadv
2015/01/27 22:54:31
Nit: indentation
| |
| 74 if builder_type == PERF_BUILDER: | 78 if builder_type == PERF_BUILDER: |
| 75 return PerfBuildArchive(target_arch, target_platform) | 79 return PerfBuildArchive(target_arch, target_platform) |
| 76 if builder_type == FULL_BUILDER: | 80 if builder_type == FULL_BUILDER: |
| 77 return FullBuildArchive(target_arch, target_platform) | 81 return FullBuildArchive(target_arch, target_platform) |
| 78 if builder_type == ANDROID_CHROME_PERF_BUILDER: | 82 if builder_type == ANDROID_CHROME_PERF_BUILDER: |
| 79 try: | 83 try: |
| 80 # Load and initialize a module in extra source file and | 84 # Load and initialize a module in extra source file and |
| 81 # return its module object to access android-chrome specific data. | 85 # return its module object to access android-chrome specific data. |
| 82 loaded_extra_src = bisect_utils.LoadExtraSrc(extra_src) | 86 loaded_extra_src = bisect_utils.LoadExtraSrc(extra_src) |
| 83 return AndroidChromeBuildArchive( | 87 return AndroidChromeBuildArchive( |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 407 print 'Build is not available.' | 411 print 'Build is not available.' |
| 408 return 1 | 412 return 1 |
| 409 | 413 |
| 410 FetchFromCloudStorage(bucket_name, remote_path, args.output_dir) | 414 FetchFromCloudStorage(bucket_name, remote_path, args.output_dir) |
| 411 print 'Build has been downloaded to and extracted in %s.' % args.output_dir | 415 print 'Build has been downloaded to and extracted in %s.' % args.output_dir |
| 412 return 0 | 416 return 0 |
| 413 | 417 |
| 414 | 418 |
| 415 if __name__ == '__main__': | 419 if __name__ == '__main__': |
| 416 sys.exit(Main(sys.argv)) | 420 sys.exit(Main(sys.argv)) |
| 417 | |
| OLD | NEW |