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 12 matching lines...) Expand all Loading... | |
23 # GS bucket name. | 23 # GS bucket name. |
24 GS_BUCKET_NAME = 'chrome-unsigned/desktop-W15K3Y' | 24 GS_BUCKET_NAME = 'chrome-unsigned/desktop-W15K3Y' |
25 | 25 |
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 = ('http://build.chromium.org' | 33 CHANGELOG_URL = ('https://chromium.googlesource.com/chromium/src/+log/%s..%s') |
34 '/f/chromium/perf/dashboard/ui/changelog.html' | 34 |
35 '?url=/trunk/src&range=%d%%3A%d') | 35 # URL to convert SVN revision to git hash. |
36 CRREV_URL = ('http://crrev.com/') | |
37 | |
38 # Search pattern to match git hash. | |
39 GITHASH_SEARCH_PATTERN = (r'<title>(\w+)\s') | |
36 | 40 |
37 # URL template for viewing changelogs between official versions. | 41 # URL template for viewing changelogs between official versions. |
38 OFFICIAL_CHANGELOG_URL = ('https://chromium.googlesource.com/chromium/' | 42 OFFICIAL_CHANGELOG_URL = ('https://chromium.googlesource.com/chromium/' |
39 'src/+log/%s..%s?pretty=full') | 43 'src/+log/%s..%s?pretty=full') |
40 | 44 |
41 # DEPS file URL. | 45 # DEPS file URL. |
42 DEPS_FILE = 'http://src.chromium.org/viewvc/chrome/trunk/src/DEPS?revision=%d' | 46 DEPS_FILE = 'http://src.chromium.org/viewvc/chrome/trunk/src/DEPS?revision=%d' |
43 | 47 |
44 # Blink changelogs URL. | 48 # Blink changelogs URL. |
45 BLINK_CHANGELOG_URL = ('http://build.chromium.org' | 49 BLINK_CHANGELOG_URL = ('http://build.chromium.org' |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
937 try: | 941 try: |
938 # Location of the latest build revision number | 942 # Location of the latest build revision number |
939 latest_revision = urllib.urlopen(url).read() | 943 latest_revision = urllib.urlopen(url).read() |
940 if latest_revision.isdigit(): | 944 if latest_revision.isdigit(): |
941 return int(latest_revision) | 945 return int(latest_revision) |
942 return context.GetSVNRevisionFromGitHash(latest_revision) | 946 return context.GetSVNRevisionFromGitHash(latest_revision) |
943 except Exception: | 947 except Exception: |
944 print 'Could not determine latest revision. This could be bad...' | 948 print 'Could not determine latest revision. This could be bad...' |
945 return 999999999 | 949 return 999999999 |
946 | 950 |
951 def PrintChangeLog(min_chromium_rev, max_chromium_rev): | |
Robert Sesek
2014/09/02 20:14:01
nit: another blank line before
pshenoy
2014/09/02 20:34:02
Done.
| |
952 """Prints the changelog URL.""" | |
953 def GetGitHashFromSVNRevision(svn_revision): | |
Robert Sesek
2014/09/02 20:14:01
naming: prefix with underscore
pshenoy
2014/09/02 20:34:02
Done.
| |
954 crrev_url = CRREV_URL + str(svn_revision) | |
955 url = urllib.urlopen(crrev_url) | |
956 if url.getcode() == 200: | |
957 result = re.search(GITHASH_SEARCH_PATTERN, url.read()) | |
958 return result.group(1) | |
959 | |
960 print (' ' + CHANGELOG_URL % (GetGitHashFromSVNRevision(min_chromium_rev), | |
961 GetGitHashFromSVNRevision(max_chromium_rev))) | |
962 | |
947 | 963 |
948 def main(): | 964 def main(): |
949 usage = ('%prog [options] [-- chromium-options]\n' | 965 usage = ('%prog [options] [-- chromium-options]\n' |
950 'Perform binary search on the snapshot builds to find a minimal\n' | 966 'Perform binary search on the snapshot builds to find a minimal\n' |
951 'range of revisions where a behavior change happened. The\n' | 967 'range of revisions where a behavior change happened. The\n' |
952 'behaviors are described as "good" and "bad".\n' | 968 'behaviors are described as "good" and "bad".\n' |
953 'It is NOT assumed that the behavior of the later revision is\n' | 969 'It is NOT assumed that the behavior of the later revision is\n' |
954 'the bad one.\n' | 970 'the bad one.\n' |
955 '\n' | 971 '\n' |
956 'Revision numbers should use\n' | 972 'Revision numbers should use\n' |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1140 print DONE_MESSAGE_GOOD_MIN % (str(min_chromium_rev), | 1156 print DONE_MESSAGE_GOOD_MIN % (str(min_chromium_rev), |
1141 str(max_chromium_rev)) | 1157 str(max_chromium_rev)) |
1142 if min_blink_rev != max_blink_rev: | 1158 if min_blink_rev != max_blink_rev: |
1143 print ('NOTE: There is a Blink roll in the range, ' | 1159 print ('NOTE: There is a Blink roll in the range, ' |
1144 'you might also want to do a Blink bisect.') | 1160 'you might also want to do a Blink bisect.') |
1145 | 1161 |
1146 print 'CHANGELOG URL:' | 1162 print 'CHANGELOG URL:' |
1147 if opts.official_builds: | 1163 if opts.official_builds: |
1148 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 1164 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) |
1149 else: | 1165 else: |
1150 print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 1166 PrintChangeLog(min_chromium_rev, max_chromium_rev) |
1151 | 1167 |
1152 | 1168 |
1153 if __name__ == '__main__': | 1169 if __name__ == '__main__': |
1154 sys.exit(main()) | 1170 sys.exit(main()) |
OLD | NEW |