| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Snapshot Build Bisect Tool | 6 """Snapshot Build Bisect Tool |
| 7 | 7 |
| 8 This script bisects a snapshot archive using binary search. It starts at | 8 This script bisects a snapshot archive using binary search. It starts at |
| 9 a bad revision (it will try to guess HEAD) and asks for a last known-good | 9 a bad revision (it will try to guess HEAD) and asks for a last known-good |
| 10 revision. It will then binary search across this revision range by downloading, | 10 revision. It will then binary search across this revision range by downloading, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 self._archive_extract_dir = 'chrome-precise32' | 151 self._archive_extract_dir = 'chrome-precise32' |
| 152 elif self.platform == 'linux64': | 152 elif self.platform == 'linux64': |
| 153 self._listing_platform_dir = 'precise64/' | 153 self._listing_platform_dir = 'precise64/' |
| 154 self.archive_name = 'chrome-precise64.zip' | 154 self.archive_name = 'chrome-precise64.zip' |
| 155 self._archive_extract_dir = 'chrome-precise64' | 155 self._archive_extract_dir = 'chrome-precise64' |
| 156 elif self.platform == 'mac': | 156 elif self.platform == 'mac': |
| 157 self._listing_platform_dir = 'mac/' | 157 self._listing_platform_dir = 'mac/' |
| 158 self._binary_name = 'Google Chrome.app/Contents/MacOS/Google Chrome' | 158 self._binary_name = 'Google Chrome.app/Contents/MacOS/Google Chrome' |
| 159 elif self.platform == 'win': | 159 elif self.platform == 'win': |
| 160 self._listing_platform_dir = 'win/' | 160 self._listing_platform_dir = 'win/' |
| 161 self.archive_name = 'chrome-win.zip' |
| 162 self._archive_extract_dir = 'chrome-win' |
| 161 else: | 163 else: |
| 162 if self.platform in ('linux', 'linux64', 'linux-arm'): | 164 if self.platform in ('linux', 'linux64', 'linux-arm'): |
| 163 self.archive_name = 'chrome-linux.zip' | 165 self.archive_name = 'chrome-linux.zip' |
| 164 self._archive_extract_dir = 'chrome-linux' | 166 self._archive_extract_dir = 'chrome-linux' |
| 165 if self.platform == 'linux': | 167 if self.platform == 'linux': |
| 166 self._listing_platform_dir = 'Linux/' | 168 self._listing_platform_dir = 'Linux/' |
| 167 elif self.platform == 'linux64': | 169 elif self.platform == 'linux64': |
| 168 self._listing_platform_dir = 'Linux_x64/' | 170 self._listing_platform_dir = 'Linux_x64/' |
| 169 elif self.platform == 'linux-arm': | 171 elif self.platform == 'linux-arm': |
| 170 self._listing_platform_dir = 'Linux_ARM_Cross-Compile/' | 172 self._listing_platform_dir = 'Linux_ARM_Cross-Compile/' |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 stdout = RunGsutilCommand(['ls', query]) | 440 stdout = RunGsutilCommand(['ls', query]) |
| 439 return [url[len(query):].strip('/') for url in stdout.splitlines()] | 441 return [url[len(query):].strip('/') for url in stdout.splitlines()] |
| 440 | 442 |
| 441 # Download the revlist and filter for just the range between good and bad. | 443 # Download the revlist and filter for just the range between good and bad. |
| 442 minrev = min(self.good_revision, self.bad_revision) | 444 minrev = min(self.good_revision, self.bad_revision) |
| 443 maxrev = max(self.good_revision, self.bad_revision) | 445 maxrev = max(self.good_revision, self.bad_revision) |
| 444 build_numbers = GsutilList(GS_BUCKET_NAME) | 446 build_numbers = GsutilList(GS_BUCKET_NAME) |
| 445 revision_re = re.compile(r'(\d\d\.\d\.\d{4}\.\d+)') | 447 revision_re = re.compile(r'(\d\d\.\d\.\d{4}\.\d+)') |
| 446 build_numbers = filter(lambda b: revision_re.search(b), build_numbers) | 448 build_numbers = filter(lambda b: revision_re.search(b), build_numbers) |
| 447 final_list = [] | 449 final_list = [] |
| 448 i = 0 | |
| 449 parsed_build_numbers = [LooseVersion(x) for x in build_numbers] | 450 parsed_build_numbers = [LooseVersion(x) for x in build_numbers] |
| 450 connection = httplib.HTTPConnection(GOOGLE_APIS_URL) | 451 connection = httplib.HTTPConnection(GOOGLE_APIS_URL) |
| 451 for build_number in sorted(parsed_build_numbers): | 452 for build_number in sorted(parsed_build_numbers): |
| 452 if build_number > maxrev: | 453 if build_number > maxrev: |
| 453 break | 454 break |
| 454 if build_number < minrev: | 455 if build_number < minrev: |
| 455 continue | 456 continue |
| 456 path = ('/' + GS_BUCKET_NAME + '/' + str(build_number) + '/' + | 457 path = ('/' + GS_BUCKET_NAME + '/' + str(build_number) + '/' + |
| 457 self._listing_platform_dir + self.archive_name) | 458 self._listing_platform_dir + self.archive_name) |
| 458 i = i + 1 | |
| 459 connection.request('HEAD', path) | 459 connection.request('HEAD', path) |
| 460 response = connection.getresponse() | 460 response = connection.getresponse() |
| 461 if response.status == 200: | 461 if response.status == 200: |
| 462 final_list.append(str(build_number)) | 462 final_list.append(str(build_number)) |
| 463 response.read() | 463 response.read() |
| 464 connection.close() | 464 connection.close() |
| 465 return final_list | 465 return final_list |
| 466 | 466 |
| 467 def UnzipFilenameToDir(filename, directory): | 467 def UnzipFilenameToDir(filename, directory): |
| 468 """Unzip |filename| to |directory|.""" | 468 """Unzip |filename| to |directory|.""" |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 | 1134 |
| 1135 print 'CHANGELOG URL:' | 1135 print 'CHANGELOG URL:' |
| 1136 if opts.official_builds: | 1136 if opts.official_builds: |
| 1137 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 1137 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) |
| 1138 else: | 1138 else: |
| 1139 print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 1139 print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) |
| 1140 | 1140 |
| 1141 | 1141 |
| 1142 if __name__ == '__main__': | 1142 if __name__ == '__main__': |
| 1143 sys.exit(main()) | 1143 sys.exit(main()) |
| OLD | NEW |