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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 def ParseDirectoryIndex(self): | 193 def ParseDirectoryIndex(self): |
194 """Parses the Google Storage directory listing into a list of revision | 194 """Parses the Google Storage directory listing into a list of revision |
195 numbers.""" | 195 numbers.""" |
196 | 196 |
197 def _FetchAndParse(url): | 197 def _FetchAndParse(url): |
198 """Fetches a URL and returns a 2-Tuple of ([revisions], next-marker). If | 198 """Fetches a URL and returns a 2-Tuple of ([revisions], next-marker). If |
199 next-marker is not None, then the listing is a partial listing and another | 199 next-marker is not None, then the listing is a partial listing and another |
200 fetch should be performed with next-marker being the marker= GET | 200 fetch should be performed with next-marker being the marker= GET |
201 parameter.""" | 201 parameter.""" |
202 def _GetDepotName(): | |
203 if self.base_url == CHROMIUM_BASE_URL: | |
204 return 'chromium' | |
205 elif self.base_url == WEBKIT_BASE_URL: | |
206 return 'blink' | |
207 else: | |
208 return 'chromium' | |
209 | |
210 handle = urllib.urlopen(url) | 202 handle = urllib.urlopen(url) |
211 document = ElementTree.parse(handle) | 203 document = ElementTree.parse(handle) |
212 | 204 |
213 # All nodes in the tree are namespaced. Get the root's tag name to extract | 205 # All nodes in the tree are namespaced. Get the root's tag name to extract |
214 # the namespace. Etree does namespaces as |{namespace}tag|. | 206 # the namespace. Etree does namespaces as |{namespace}tag|. |
215 root_tag = document.getroot().tag | 207 root_tag = document.getroot().tag |
216 end_ns_pos = root_tag.find('}') | 208 end_ns_pos = root_tag.find('}') |
217 if end_ns_pos == -1: | 209 if end_ns_pos == -1: |
218 raise Exception("Could not locate end namespace for directory index") | 210 raise Exception("Could not locate end namespace for directory index") |
219 namespace = root_tag[:end_ns_pos + 1] | 211 namespace = root_tag[:end_ns_pos + 1] |
(...skipping 11 matching lines...) Expand all Loading... |
231 # The <Prefix> nodes have content of the form of | 223 # The <Prefix> nodes have content of the form of |
232 # |_listing_platform_dir/revision/|. Strip off the platform dir and the | 224 # |_listing_platform_dir/revision/|. Strip off the platform dir and the |
233 # trailing slash to just have a number. | 225 # trailing slash to just have a number. |
234 revisions = [] | 226 revisions = [] |
235 githash_svn_dict = {} | 227 githash_svn_dict = {} |
236 for prefix in all_prefixes: | 228 for prefix in all_prefixes: |
237 revnum = prefix.text[prefix_len:-1] | 229 revnum = prefix.text[prefix_len:-1] |
238 try: | 230 try: |
239 if not revnum.isdigit(): | 231 if not revnum.isdigit(): |
240 git_hash = revnum | 232 git_hash = revnum |
241 revnum = self.GetSVNRevisionFromGitHash(git_hash, _GetDepotName()) | 233 revnum = self.GetSVNRevisionFromGitHash(git_hash) |
242 githash_svn_dict[revnum] = git_hash | 234 githash_svn_dict[revnum] = git_hash |
243 if revnum is not None: | 235 if revnum is not None: |
244 revnum = int(revnum) | 236 revnum = int(revnum) |
245 revisions.append(revnum) | 237 revisions.append(revnum) |
246 except ValueError: | 238 except ValueError: |
247 pass | 239 pass |
248 return (revisions, next_marker, githash_svn_dict) | 240 return (revisions, next_marker, githash_svn_dict) |
249 | 241 |
250 # Fetch the first list of revisions. | 242 # Fetch the first list of revisions. |
251 (revisions, next_marker, self.githash_svn_dict) =\ | 243 (revisions, next_marker, self.githash_svn_dict) =\ |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 "you might also want to do a Blink bisect.") | 981 "you might also want to do a Blink bisect.") |
990 | 982 |
991 print 'CHANGELOG URL:' | 983 print 'CHANGELOG URL:' |
992 if opts.official_builds: | 984 if opts.official_builds: |
993 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 985 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) |
994 else: | 986 else: |
995 print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 987 print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) |
996 | 988 |
997 if __name__ == '__main__': | 989 if __name__ == '__main__': |
998 sys.exit(main()) | 990 sys.exit(main()) |
OLD | NEW |