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/%s') | |
DaleCurtis
2014/08/29 23:33:34
Hmm, this works, but is it the right way? Also for
pshenoy
2014/08/29 23:53:38
I'm not sure if there is any easy way to convert s
| |
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): | |
952 """Prints the changelog URL.""" | |
953 def GetGitHashFromSVNRevision(svn_revision): | |
954 crrev_url = CRREV_URL % str(svn_revision) | |
955 url = urllib.urlopen(crrev_url) | |
956 if url.getcode() == 200: | |
957 search_pattern = re.compile(GITHASH_SEARCH_PATTERN) | |
DaleCurtis
2014/08/29 23:33:34
No point in compiling here. Compile globally if yo
pshenoy
2014/08/29 23:53:38
Done.
| |
958 result = search_pattern.search(url.read()) | |
959 return result.group(1) | |
960 return None | |
DaleCurtis
2014/08/29 23:33:34
Automatically done, no need to write.
pshenoy
2014/08/29 23:53:38
Done.
| |
961 | |
962 print (' ' + CHANGELOG_URL % (GetGitHashFromSVNRevision(min_chromium_rev), | |
963 GetGitHashFromSVNRevision(max_chromium_rev))) | |
964 | |
947 | 965 |
948 def main(): | 966 def main(): |
949 usage = ('%prog [options] [-- chromium-options]\n' | 967 usage = ('%prog [options] [-- chromium-options]\n' |
950 'Perform binary search on the snapshot builds to find a minimal\n' | 968 'Perform binary search on the snapshot builds to find a minimal\n' |
951 'range of revisions where a behavior change happened. The\n' | 969 'range of revisions where a behavior change happened. The\n' |
952 'behaviors are described as "good" and "bad".\n' | 970 'behaviors are described as "good" and "bad".\n' |
953 'It is NOT assumed that the behavior of the later revision is\n' | 971 'It is NOT assumed that the behavior of the later revision is\n' |
954 'the bad one.\n' | 972 'the bad one.\n' |
955 '\n' | 973 '\n' |
956 'Revision numbers should use\n' | 974 '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), | 1158 print DONE_MESSAGE_GOOD_MIN % (str(min_chromium_rev), |
1141 str(max_chromium_rev)) | 1159 str(max_chromium_rev)) |
1142 if min_blink_rev != max_blink_rev: | 1160 if min_blink_rev != max_blink_rev: |
1143 print ('NOTE: There is a Blink roll in the range, ' | 1161 print ('NOTE: There is a Blink roll in the range, ' |
1144 'you might also want to do a Blink bisect.') | 1162 'you might also want to do a Blink bisect.') |
1145 | 1163 |
1146 print 'CHANGELOG URL:' | 1164 print 'CHANGELOG URL:' |
1147 if opts.official_builds: | 1165 if opts.official_builds: |
1148 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 1166 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) |
1149 else: | 1167 else: |
1150 print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 1168 PrintChangeLog(min_chromium_rev, max_chromium_rev) |
1151 | 1169 |
1152 | 1170 |
1153 if __name__ == '__main__': | 1171 if __name__ == '__main__': |
1154 sys.exit(main()) | 1172 sys.exit(main()) |
OLD | NEW |