Index: tools/auto_bisect/fetch_build.py |
diff --git a/tools/auto_bisect/fetch_build.py b/tools/auto_bisect/fetch_build.py |
index 4aaee54fbbfc13d36e51a4955205a8497abff5c3..90639216830f0e3e1cbb8fc79faecaf29c4c2522 100644 |
--- a/tools/auto_bisect/fetch_build.py |
+++ b/tools/auto_bisect/fetch_build.py |
@@ -30,11 +30,12 @@ import bisect_utils |
# Possible builder types. |
PERF_BUILDER = 'perf' |
FULL_BUILDER = 'full' |
+ANDROID_CHROME_PERF_BUILDER = 'android-chrome-perf' |
def GetBucketAndRemotePath(revision, builder_type=PERF_BUILDER, |
target_arch='ia32', target_platform='chromium', |
- deps_patch_sha=None): |
+ deps_patch_sha=None, extra_src=None): |
"""Returns the location where a build archive is expected to be. |
Args: |
@@ -44,12 +45,15 @@ def GetBucketAndRemotePath(revision, builder_type=PERF_BUILDER, |
target_platform: Platform name, e.g. "chromium" or "android". |
deps_patch_sha: SHA1 hash which identifies a particular combination of |
custom revisions for dependency repositories. |
+ extra_src: Path to a script which can be used to modify the bisect script's |
+ behavior. |
Returns: |
A pair of strings (bucket, path), where the archive is expected to be. |
""" |
build_archive = BuildArchive.Create( |
- builder_type, target_arch=target_arch, target_platform=target_platform) |
+ builder_type, target_arch=target_arch, target_platform=target_platform, |
+ extra_src=extra_src) |
bucket = build_archive.BucketName() |
remote_path = build_archive.FilePath(revision, deps_patch_sha=deps_patch_sha) |
return bucket, remote_path |
@@ -65,14 +69,24 @@ class BuildArchive(object): |
""" |
@staticmethod |
- def Create(builder_type, target_arch='ia32', target_platform='chromium'): |
+ def Create(builder_type, target_arch='ia32', target_platform='chromium', |
+ extra_src=None): |
if builder_type == PERF_BUILDER: |
return PerfBuildArchive(target_arch, target_platform) |
if builder_type == FULL_BUILDER: |
return FullBuildArchive(target_arch, target_platform) |
+ if builder_type == ANDROID_CHROME_PERF_BUILDER: |
+ try: |
+ extra_src = bisect_utils.LoadExtraSrc(extra_src) |
RobertoCN
2015/01/21 23:15:19
I think it would be more readable if we used an ad
prasadv
2015/01/23 18:05:57
Done.
|
+ return AndroidChromeBuildArchive( |
+ target_arch, target_platform, extra_src) |
+ except (IOError, TypeError, ImportError): |
+ raise RuntimeError('Invalid or missing --extra_src.') |
qyearsley
2015/01/26 17:50:32
[Optional] In the case of a failure, it may be use
prasadv
2015/01/26 18:58:26
Done.
|
raise NotImplementedError('Builder type "%s" not supported.' % builder_type) |
- def __init__(self, target_arch='ia32', target_platform='chromium'): |
+ def __init__(self, target_arch='ia32', target_platform='chromium', |
+ extra_src=None): |
+ self._extra_src = extra_src |
if bisect_utils.IsLinuxHost() and target_platform == 'android': |
self._platform = 'android' |
elif bisect_utils.IsLinuxHost(): |
@@ -187,6 +201,37 @@ class FullBuildArchive(BuildArchive): |
return platform_to_directory.get(self._platform) |
+class AndroidChromeBuildArchive(BuildArchive): |
qyearsley
2015/01/26 17:50:32
[Optional] It can be seen from the code below, but
prasadv
2015/01/26 18:58:26
Done.
|
+ |
+ def BucketName(self): |
+ return self._extra_src.GetBucketName() |
+ |
+ def _ZipFileName(self, revision, deps_patch_sha=None): |
+ """Gets the file name of a zip archive on android-chrome. |
+ |
+ This returns a file name of the form build_product_<revision>.zip, |
+ which is a format used by android-chrome. |
+ |
+ Args: |
+ revision: A git commit hash or other revision string. |
+ deps_patch_sha: SHA1 hash of a DEPS file patch. |
+ |
+ Returns: |
+ The archive file name. |
+ """ |
+ if deps_patch_sha: |
+ revision = '%s_%s' % (revision, deps_patch_sha) |
+ return 'build_product_%s.zip' % revision |
+ |
+ def FilePath(self, revision, deps_patch_sha=None): |
+ return '%s/%s' % (self._ArchiveDirectory(), |
+ self._ZipFileName(revision, deps_patch_sha)) |
+ |
+ def _ArchiveDirectory(self): |
+ """Returns the directory name to download builds from.""" |
+ return self._extra_src.GetArchiveDirectory() |
+ |
+ |
def BuildIsAvailable(bucket_name, remote_path): |
"""Checks whether a build is currently archived at some place.""" |
logging.info('Checking existance: gs://%s/%s' % (bucket_name, remote_path)) |