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 15 matching lines...) Expand all Loading... |
26 # Base URL for downloading official builds. | 26 # Base URL for downloading official builds. |
27 GOOGLE_APIS_URL = 'commondatastorage.googleapis.com' | 27 GOOGLE_APIS_URL = 'commondatastorage.googleapis.com' |
28 | 28 |
29 # The base URL for official builds. | 29 # The base URL for official builds. |
30 OFFICIAL_BASE_URL = 'http://%s/%s' % (GOOGLE_APIS_URL, GS_BUCKET_NAME) | 30 OFFICIAL_BASE_URL = 'http://%s/%s' % (GOOGLE_APIS_URL, GS_BUCKET_NAME) |
31 | 31 |
32 # URL template for viewing changelogs between revisions. | 32 # URL template for viewing changelogs between revisions. |
33 CHANGELOG_URL = ('https://chromium.googlesource.com/chromium/src/+log/%s..%s') | 33 CHANGELOG_URL = ('https://chromium.googlesource.com/chromium/src/+log/%s..%s') |
34 | 34 |
35 # URL to convert SVN revision to git hash. | 35 # URL to convert SVN revision to git hash. |
36 CRREV_URL = ('http://crrev.com/') | 36 CRREV_URL = ('https://cr-rev.appspot.com/_ah/api/crrev/v1/redirect/') |
37 | |
38 # Search pattern to match git hash. | |
39 GITHASH_SEARCH_PATTERN = (r'<title>(\w+)\s') | |
40 | 37 |
41 # URL template for viewing changelogs between official versions. | 38 # URL template for viewing changelogs between official versions. |
42 OFFICIAL_CHANGELOG_URL = ('https://chromium.googlesource.com/chromium/' | 39 OFFICIAL_CHANGELOG_URL = ('https://chromium.googlesource.com/chromium/' |
43 'src/+log/%s..%s?pretty=full') | 40 'src/+log/%s..%s?pretty=full') |
44 | 41 |
45 # DEPS file URL. | 42 # DEPS file URL. |
46 DEPS_FILE = 'http://src.chromium.org/viewvc/chrome/trunk/src/DEPS?revision=%d' | 43 DEPS_FILE = 'http://src.chromium.org/viewvc/chrome/trunk/src/DEPS?revision=%d' |
47 | 44 |
48 # Blink changelogs URL. | 45 # Blink changelogs URL. |
49 BLINK_CHANGELOG_URL = ('http://build.chromium.org' | 46 BLINK_CHANGELOG_URL = ('http://build.chromium.org' |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 print 'Could not determine latest revision. This could be bad...' | 945 print 'Could not determine latest revision. This could be bad...' |
949 return 999999999 | 946 return 999999999 |
950 | 947 |
951 def PrintChangeLog(min_chromium_rev, max_chromium_rev): | 948 def PrintChangeLog(min_chromium_rev, max_chromium_rev): |
952 """Prints the changelog URL.""" | 949 """Prints the changelog URL.""" |
953 | 950 |
954 def _GetGitHashFromSVNRevision(svn_revision): | 951 def _GetGitHashFromSVNRevision(svn_revision): |
955 crrev_url = CRREV_URL + str(svn_revision) | 952 crrev_url = CRREV_URL + str(svn_revision) |
956 url = urllib.urlopen(crrev_url) | 953 url = urllib.urlopen(crrev_url) |
957 if url.getcode() == 200: | 954 if url.getcode() == 200: |
958 result = re.search(GITHASH_SEARCH_PATTERN, url.read()) | 955 data = json.loads(url.read()) |
959 return result.group(1) | 956 if 'git_sha' in data: |
| 957 return data['git_sha'] |
960 | 958 |
961 print (' ' + CHANGELOG_URL % (_GetGitHashFromSVNRevision(min_chromium_rev), | 959 print (' ' + CHANGELOG_URL % (_GetGitHashFromSVNRevision(min_chromium_rev), |
962 _GetGitHashFromSVNRevision(max_chromium_rev))) | 960 _GetGitHashFromSVNRevision(max_chromium_rev))) |
963 | 961 |
964 | 962 |
965 def main(): | 963 def main(): |
966 usage = ('%prog [options] [-- chromium-options]\n' | 964 usage = ('%prog [options] [-- chromium-options]\n' |
967 'Perform binary search on the snapshot builds to find a minimal\n' | 965 'Perform binary search on the snapshot builds to find a minimal\n' |
968 'range of revisions where a behavior change happened. The\n' | 966 'range of revisions where a behavior change happened. The\n' |
969 'behaviors are described as "good" and "bad".\n' | 967 'behaviors are described as "good" and "bad".\n' |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 | 1160 |
1163 print 'CHANGELOG URL:' | 1161 print 'CHANGELOG URL:' |
1164 if opts.official_builds: | 1162 if opts.official_builds: |
1165 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 1163 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) |
1166 else: | 1164 else: |
1167 PrintChangeLog(min_chromium_rev, max_chromium_rev) | 1165 PrintChangeLog(min_chromium_rev, max_chromium_rev) |
1168 | 1166 |
1169 | 1167 |
1170 if __name__ == '__main__': | 1168 if __name__ == '__main__': |
1171 sys.exit(main()) | 1169 sys.exit(main()) |
OLD | NEW |