| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 # Search pattern to be matched in the json output from | 70 # Search pattern to be matched in the json output from |
| 71 # BLINK_GITHASH_TO_SVN_URL to get the blink revision (svn revision). | 71 # BLINK_GITHASH_TO_SVN_URL to get the blink revision (svn revision). |
| 72 BLINK_SEARCH_PATTERN = ( | 72 BLINK_SEARCH_PATTERN = ( |
| 73 r'.*git-svn-id: svn://svn.chromium.org/blink/trunk@(\d+) ') | 73 r'.*git-svn-id: svn://svn.chromium.org/blink/trunk@(\d+) ') |
| 74 | 74 |
| 75 SEARCH_PATTERN = { | 75 SEARCH_PATTERN = { |
| 76 'chromium': CHROMIUM_SEARCH_PATTERN, | 76 'chromium': CHROMIUM_SEARCH_PATTERN, |
| 77 'blink': BLINK_SEARCH_PATTERN, | 77 'blink': BLINK_SEARCH_PATTERN, |
| 78 } | 78 } |
| 79 | 79 |
| 80 CREDENTIAL_ERROR_MESSAGE = ('You are attempting to access protected data with ' |
| 81 'no configured credentials') |
| 82 |
| 80 ############################################################################### | 83 ############################################################################### |
| 81 | 84 |
| 82 import httplib | 85 import httplib |
| 83 import json | 86 import json |
| 84 import optparse | 87 import optparse |
| 85 import os | 88 import os |
| 86 import re | 89 import re |
| 87 import shlex | 90 import shlex |
| 88 import shutil | 91 import shutil |
| 89 import subprocess | 92 import subprocess |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 # It uses "git svn find-rev <SHA1>" command to convert git hash to svn | 130 # It uses "git svn find-rev <SHA1>" command to convert git hash to svn |
| 128 # revision number. | 131 # revision number. |
| 129 self.use_local_repo = use_local_repo | 132 self.use_local_repo = use_local_repo |
| 130 | 133 |
| 131 # Set some internal members: | 134 # Set some internal members: |
| 132 # _listing_platform_dir = Directory that holds revisions. Ends with a '/'. | 135 # _listing_platform_dir = Directory that holds revisions. Ends with a '/'. |
| 133 # _archive_extract_dir = Uncompressed directory in the archive_name file. | 136 # _archive_extract_dir = Uncompressed directory in the archive_name file. |
| 134 # _binary_name = The name of the executable to run. | 137 # _binary_name = The name of the executable to run. |
| 135 if self.platform in ('linux', 'linux64', 'linux-arm'): | 138 if self.platform in ('linux', 'linux64', 'linux-arm'): |
| 136 self._binary_name = 'chrome' | 139 self._binary_name = 'chrome' |
| 137 elif self.platform == 'mac': | 140 elif self.platform in ('mac', 'mac64'): |
| 138 self.archive_name = 'chrome-mac.zip' | 141 self.archive_name = 'chrome-mac.zip' |
| 139 self._archive_extract_dir = 'chrome-mac' | 142 self._archive_extract_dir = 'chrome-mac' |
| 140 elif self.platform == 'win': | 143 elif self.platform in ('win', 'win64'): |
| 141 self.archive_name = 'chrome-win32.zip' | 144 self.archive_name = 'chrome-win32.zip' |
| 142 self._archive_extract_dir = 'chrome-win32' | 145 self._archive_extract_dir = 'chrome-win32' |
| 143 self._binary_name = 'chrome.exe' | 146 self._binary_name = 'chrome.exe' |
| 144 else: | 147 else: |
| 145 raise Exception('Invalid platform: %s' % self.platform) | 148 raise Exception('Invalid platform: %s' % self.platform) |
| 146 | 149 |
| 147 if is_official: | 150 if is_official: |
| 148 if self.platform == 'linux': | 151 if self.platform == 'linux': |
| 149 self._listing_platform_dir = 'precise32/' | 152 self._listing_platform_dir = 'precise32/' |
| 150 self.archive_name = 'chrome-precise32.zip' | 153 self.archive_name = 'chrome-precise32.zip' |
| 151 self._archive_extract_dir = 'chrome-precise32' | 154 self._archive_extract_dir = 'chrome-precise32' |
| 152 elif self.platform == 'linux64': | 155 elif self.platform == 'linux64': |
| 153 self._listing_platform_dir = 'precise64/' | 156 self._listing_platform_dir = 'precise64/' |
| 154 self.archive_name = 'chrome-precise64.zip' | 157 self.archive_name = 'chrome-precise64.zip' |
| 155 self._archive_extract_dir = 'chrome-precise64' | 158 self._archive_extract_dir = 'chrome-precise64' |
| 156 elif self.platform == 'mac': | 159 elif self.platform == 'mac': |
| 157 self._listing_platform_dir = 'mac/' | 160 self._listing_platform_dir = 'mac/' |
| 158 self._binary_name = 'Google Chrome.app/Contents/MacOS/Google Chrome' | 161 self._binary_name = 'Google Chrome.app/Contents/MacOS/Google Chrome' |
| 162 elif self.platform == 'mac64': |
| 163 self._listing_platform_dir = 'mac64/' |
| 164 self._binary_name = 'Google Chrome.app/Contents/MacOS/Google Chrome' |
| 159 elif self.platform == 'win': | 165 elif self.platform == 'win': |
| 160 self._listing_platform_dir = 'win/' | 166 self._listing_platform_dir = 'win/' |
| 161 self.archive_name = 'chrome-win.zip' | 167 self.archive_name = 'chrome-win.zip' |
| 162 self._archive_extract_dir = 'chrome-win' | 168 self._archive_extract_dir = 'chrome-win' |
| 169 elif self.platform == 'win64': |
| 170 self._listing_platform_dir = 'win64/' |
| 171 self.archive_name = 'chrome-win64.zip' |
| 172 self._archive_extract_dir = 'chrome-win64' |
| 163 else: | 173 else: |
| 164 if self.platform in ('linux', 'linux64', 'linux-arm'): | 174 if self.platform in ('linux', 'linux64', 'linux-arm'): |
| 165 self.archive_name = 'chrome-linux.zip' | 175 self.archive_name = 'chrome-linux.zip' |
| 166 self._archive_extract_dir = 'chrome-linux' | 176 self._archive_extract_dir = 'chrome-linux' |
| 167 if self.platform == 'linux': | 177 if self.platform == 'linux': |
| 168 self._listing_platform_dir = 'Linux/' | 178 self._listing_platform_dir = 'Linux/' |
| 169 elif self.platform == 'linux64': | 179 elif self.platform == 'linux64': |
| 170 self._listing_platform_dir = 'Linux_x64/' | 180 self._listing_platform_dir = 'Linux_x64/' |
| 171 elif self.platform == 'linux-arm': | 181 elif self.platform == 'linux-arm': |
| 172 self._listing_platform_dir = 'Linux_ARM_Cross-Compile/' | 182 self._listing_platform_dir = 'Linux_ARM_Cross-Compile/' |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 print ('Follow the instructions in this document ' | 427 print ('Follow the instructions in this document ' |
| 418 'http://dev.chromium.org/developers/how-tos/install-depot-tools' | 428 'http://dev.chromium.org/developers/how-tos/install-depot-tools' |
| 419 ' to install depot_tools and then try again.') | 429 ' to install depot_tools and then try again.') |
| 420 sys.exit(1) | 430 sys.exit(1) |
| 421 gsutil_path = os.path.join(gsutil_path, 'third_party', 'gsutil', 'gsutil') | 431 gsutil_path = os.path.join(gsutil_path, 'third_party', 'gsutil', 'gsutil') |
| 422 gsutil = subprocess.Popen([sys.executable, gsutil_path] + args, | 432 gsutil = subprocess.Popen([sys.executable, gsutil_path] + args, |
| 423 stdout=subprocess.PIPE, stderr=subprocess.PIPE, | 433 stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
| 424 env=None) | 434 env=None) |
| 425 stdout, stderr = gsutil.communicate() | 435 stdout, stderr = gsutil.communicate() |
| 426 if gsutil.returncode: | 436 if gsutil.returncode: |
| 427 if re.findall(r'status[ |=]40[1|3]', stderr): | 437 if (re.findall(r'status[ |=]40[1|3]', stderr) or |
| 438 stderr.startswith(CREDENTIAL_ERROR_MESSAGE)): |
| 428 print ('Follow these steps to configure your credentials and try' | 439 print ('Follow these steps to configure your credentials and try' |
| 429 ' running the bisect-builds.py again.:\n' | 440 ' running the bisect-builds.py again.:\n' |
| 430 ' 1. Run "python %s config" and follow its instructions.\n' | 441 ' 1. Run "python %s config" and follow its instructions.\n' |
| 431 ' 2. If you have a @google.com account, use that account.\n' | 442 ' 2. If you have a @google.com account, use that account.\n' |
| 432 ' 3. For the project-id, just enter 0.' % gsutil_path) | 443 ' 3. For the project-id, just enter 0.' % gsutil_path) |
| 433 sys.exit(1) | 444 sys.exit(1) |
| 434 else: | 445 else: |
| 435 raise Exception('Error running the gsutil command') | 446 raise Exception('Error running the gsutil command: %s' % stderr) |
| 436 return stdout | 447 return stdout |
| 437 | 448 |
| 438 def GsutilList(bucket): | 449 def GsutilList(bucket): |
| 439 query = 'gs://%s/' % bucket | 450 query = 'gs://%s/' % bucket |
| 440 stdout = RunGsutilCommand(['ls', query]) | 451 stdout = RunGsutilCommand(['ls', query]) |
| 441 return [url[len(query):].strip('/') for url in stdout.splitlines()] | 452 return [url[len(query):].strip('/') for url in stdout.splitlines()] |
| 442 | 453 |
| 443 # Download the revlist and filter for just the range between good and bad. | 454 # Download the revlist and filter for just the range between good and bad. |
| 444 minrev = min(self.good_revision, self.bad_revision) | 455 minrev = min(self.good_revision, self.bad_revision) |
| 445 maxrev = max(self.good_revision, self.bad_revision) | 456 maxrev = max(self.good_revision, self.bad_revision) |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 ' Official versions (e.g. 1.0.1000.0) for official builds. (-o)\n' | 957 ' Official versions (e.g. 1.0.1000.0) for official builds. (-o)\n' |
| 947 ' SVN revisions (e.g. 123456) for chromium builds, from trunk.\n' | 958 ' SVN revisions (e.g. 123456) for chromium builds, from trunk.\n' |
| 948 ' Use base_trunk_revision from http://omahaproxy.appspot.com/\n' | 959 ' Use base_trunk_revision from http://omahaproxy.appspot.com/\n' |
| 949 ' for earlier revs.\n' | 960 ' for earlier revs.\n' |
| 950 ' Chrome\'s about: build number and omahaproxy branch_revision\n' | 961 ' Chrome\'s about: build number and omahaproxy branch_revision\n' |
| 951 ' are incorrect, they are from branches.\n' | 962 ' are incorrect, they are from branches.\n' |
| 952 '\n' | 963 '\n' |
| 953 'Tip: add "-- --no-first-run" to bypass the first run prompts.') | 964 'Tip: add "-- --no-first-run" to bypass the first run prompts.') |
| 954 parser = optparse.OptionParser(usage=usage) | 965 parser = optparse.OptionParser(usage=usage) |
| 955 # Strangely, the default help output doesn't include the choice list. | 966 # Strangely, the default help output doesn't include the choice list. |
| 956 choices = ['mac', 'win', 'linux', 'linux64', 'linux-arm'] | 967 choices = ['mac', 'mac64', 'win', 'win64', 'linux', 'linux64', 'linux-arm'] |
| 957 # linux-chromiumos lacks a continuous archive http://crbug.com/78158 | 968 # linux-chromiumos lacks a continuous archive http://crbug.com/78158 |
| 958 parser.add_option('-a', '--archive', | 969 parser.add_option('-a', '--archive', |
| 959 choices=choices, | 970 choices=choices, |
| 960 help='The buildbot archive to bisect [%s].' % | 971 help='The buildbot archive to bisect [%s].' % |
| 961 '|'.join(choices)) | 972 '|'.join(choices)) |
| 962 parser.add_option('-o', | 973 parser.add_option('-o', |
| 963 action='store_true', | 974 action='store_true', |
| 964 dest='official_builds', | 975 dest='official_builds', |
| 965 help='Bisect across official Chrome builds (internal ' | 976 help='Bisect across official Chrome builds (internal ' |
| 966 'only) instead of Chromium archives.') | 977 'only) instead of Chromium archives.') |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 | 1145 |
| 1135 print 'CHANGELOG URL:' | 1146 print 'CHANGELOG URL:' |
| 1136 if opts.official_builds: | 1147 if opts.official_builds: |
| 1137 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 1148 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) |
| 1138 else: | 1149 else: |
| 1139 print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 1150 print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) |
| 1140 | 1151 |
| 1141 | 1152 |
| 1142 if __name__ == '__main__': | 1153 if __name__ == '__main__': |
| 1143 sys.exit(main()) | 1154 sys.exit(main()) |
| OLD | NEW |