Chromium Code Reviews| 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, |
| 11 unzipping, and opening Chromium for you. After testing the specific revision, | 11 unzipping, and opening Chromium for you. After testing the specific revision, |
| 12 it will ask you whether it is good or bad before continuing the search. | 12 it will ask you whether it is good or bad before continuing the search. |
| 13 """ | 13 """ |
| 14 | 14 |
| 15 # The root URL for storage. | 15 # The root URL for storage. |
| 16 BASE_URL = 'http://commondatastorage.googleapis.com/chromium-browser-snapshots' | 16 BASE_URL = 'http://commondatastorage.googleapis.com/chromium-browser-snapshots' |
| 17 | 17 |
| 18 # The root URL for official builds. | 18 # The root URL for official builds. |
| 19 OFFICIAL_BASE_URL = 'http://master.chrome.corp.google.com/official_builds' | 19 OFFICIAL_BASE_URL = 'http://master.chrome.corp.google.com/official_builds' |
| 20 | 20 |
| 21 # Changelogs URL. | 21 # Changelogs URL. |
| 22 CHANGELOG_URL = 'http://build.chromium.org/f/chromium/' \ | 22 CHANGELOG_URL = 'http://build.chromium.org/f/chromium/' \ |
| 23 'perf/dashboard/ui/changelog.html?url=/trunk/src&range=%d%%3A%d' | 23 'perf/dashboard/ui/changelog.html?'\ |
|
Robert Sesek
2013/04/15 16:34:01
nit: space before \
| |
| 24 'url=/trunk/src&range=%d%%3A%d' | |
| 24 | 25 |
| 25 # Official Changelogs URL. | 26 # Official Changelogs URL. |
| 26 OFFICIAL_CHANGELOG_URL = 'http://omahaproxy.appspot.com/'\ | 27 OFFICIAL_CHANGELOG_URL = 'http://omahaproxy.appspot.com/'\ |
| 27 'changelog?old_version=%s&new_version=%s' | 28 'changelog?old_version=%s&new_version=%s' |
| 28 | 29 |
| 29 # DEPS file URL. | 30 # DEPS file URL. |
| 30 DEPS_FILE= 'http://src.chromium.org/viewvc/chrome/trunk/src/DEPS?revision=%d' | 31 DEPS_FILE= 'http://src.chromium.org/viewvc/chrome/trunk/src/DEPS?revision=%d' |
| 31 # WebKit Changelogs URL. | 32 # Blink Changelogs URL. |
| 32 WEBKIT_CHANGELOG_URL = 'http://trac.webkit.org/log/' \ | 33 BLINK_CHANGELOG_URL = 'http://build.chromium.org/f/chromium/' \ |
| 33 'trunk/?rev=%d&stop_rev=%d&verbose=on&limit=10000' | 34 'perf/dashboard/ui/changelog_blink.html?' \ |
| 35 'url=/trunk&range=%d%%3A%d' | |
| 34 | 36 |
| 35 DONE_MESSAGE_GOOD_MIN = 'You are probably looking for a change made after %s ' \ | 37 DONE_MESSAGE_GOOD_MIN = 'You are probably looking for a change made after %s ' \ |
| 36 '(known good), but no later than %s (first known bad).' | 38 '(known good), but no later than %s (first known bad).' |
| 37 DONE_MESSAGE_GOOD_MAX = 'You are probably looking for a change made after %s ' \ | 39 DONE_MESSAGE_GOOD_MAX = 'You are probably looking for a change made after %s ' \ |
| 38 '(known bad), but no later than %s (first known good).' | 40 '(known bad), but no later than %s (first known good).' |
| 39 | 41 |
| 40 ############################################################################### | 42 ############################################################################### |
| 41 | 43 |
| 42 import math | 44 import math |
| 43 import optparse | 45 import optparse |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 os.unlink(f) | 556 os.unlink(f) |
| 555 except OSError: | 557 except OSError: |
| 556 pass | 558 pass |
| 557 sys.exit(0) | 559 sys.exit(0) |
| 558 | 560 |
| 559 rev = revlist[pivot] | 561 rev = revlist[pivot] |
| 560 | 562 |
| 561 return (revlist[minrev], revlist[maxrev]) | 563 return (revlist[minrev], revlist[maxrev]) |
| 562 | 564 |
| 563 | 565 |
| 564 def GetWebKitRevisionForChromiumRevision(rev): | 566 def GetBlinkRevisionForChromiumRevision(rev): |
| 565 """Returns the webkit revision that was in chromium's DEPS file at | 567 """Returns the blink revision that was in chromium's DEPS file at |
| 566 chromium revision |rev|.""" | 568 chromium revision |rev|.""" |
| 567 # . doesn't match newlines without re.DOTALL, so this is safe. | 569 # . doesn't match newlines without re.DOTALL, so this is safe. |
| 568 webkit_re = re.compile(r'webkit_revision.:\D*(\d+)') | 570 blink_re = re.compile(r'webkit_revision.:\D*(\d+)') |
| 569 url = urllib.urlopen(DEPS_FILE % rev) | 571 url = urllib.urlopen(DEPS_FILE % rev) |
| 570 m = webkit_re.search(url.read()) | 572 m = blink_re.search(url.read()) |
| 571 url.close() | 573 url.close() |
| 572 if m: | 574 if m: |
| 573 return int(m.group(1)) | 575 return int(m.group(1)) |
| 574 else: | 576 else: |
| 575 raise Exception('Could not get webkit revision for cr rev %d' % rev) | 577 raise Exception('Could not get blink revision for cr rev %d' % rev) |
| 576 | 578 |
| 577 | 579 |
| 578 def GetChromiumRevision(url): | 580 def GetChromiumRevision(url): |
| 579 """Returns the chromium revision read from given URL.""" | 581 """Returns the chromium revision read from given URL.""" |
| 580 try: | 582 try: |
| 581 # Location of the latest build revision number | 583 # Location of the latest build revision number |
| 582 return int(urllib.urlopen(url).read()) | 584 return int(urllib.urlopen(url).read()) |
| 583 except Exception, e: | 585 except Exception, e: |
| 584 print('Could not determine latest revision. This could be bad...') | 586 print('Could not determine latest revision. This could be bad...') |
| 585 return 999999999 | 587 return 999999999 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 663 if opts.times < 1: | 665 if opts.times < 1: |
| 664 print('Number of times to run (%d) must be greater than or equal to 1.' % | 666 print('Number of times to run (%d) must be greater than or equal to 1.' % |
| 665 opts.times) | 667 opts.times) |
| 666 parser.print_help() | 668 parser.print_help() |
| 667 return 1 | 669 return 1 |
| 668 | 670 |
| 669 (min_chromium_rev, max_chromium_rev) = Bisect( | 671 (min_chromium_rev, max_chromium_rev) = Bisect( |
| 670 opts.archive, opts.official_builds, good_rev, bad_rev, opts.times, args, | 672 opts.archive, opts.official_builds, good_rev, bad_rev, opts.times, args, |
| 671 opts.profile) | 673 opts.profile) |
| 672 | 674 |
| 673 # Get corresponding webkit revisions. | 675 # Get corresponding blink revisions. |
| 674 try: | 676 try: |
| 675 min_webkit_rev = GetWebKitRevisionForChromiumRevision(min_chromium_rev) | 677 min_blink_rev = GetBlinkRevisionForChromiumRevision(min_chromium_rev) |
| 676 max_webkit_rev = GetWebKitRevisionForChromiumRevision(max_chromium_rev) | 678 max_blink_rev = GetBlinkRevisionForChromiumRevision(max_chromium_rev) |
| 677 except Exception, e: | 679 except Exception, e: |
| 678 # Silently ignore the failure. | 680 # Silently ignore the failure. |
| 679 min_webkit_rev, max_webkit_rev = 0, 0 | 681 min_blink_rev, max_blink_rev = 0, 0 |
| 680 | 682 |
| 681 # We're done. Let the user know the results in an official manner. | 683 # We're done. Let the user know the results in an official manner. |
| 682 if good_rev > bad_rev: | 684 if good_rev > bad_rev: |
| 683 print DONE_MESSAGE_GOOD_MAX % (str(min_chromium_rev), str(max_chromium_rev)) | 685 print DONE_MESSAGE_GOOD_MAX % (str(min_chromium_rev), str(max_chromium_rev)) |
| 684 else: | 686 else: |
| 685 print DONE_MESSAGE_GOOD_MIN % (str(min_chromium_rev), str(max_chromium_rev)) | 687 print DONE_MESSAGE_GOOD_MIN % (str(min_chromium_rev), str(max_chromium_rev)) |
| 686 | 688 |
| 687 if min_webkit_rev != max_webkit_rev: | 689 if min_blink_rev != max_blink_rev: |
| 688 print 'WEBKIT CHANGELOG URL:' | 690 print 'BLINK CHANGELOG URL:' |
| 689 print ' ' + WEBKIT_CHANGELOG_URL % (max_webkit_rev, min_webkit_rev) | 691 print ' ' + BLINK_CHANGELOG_URL % (max_blink_rev, min_blink_rev) |
| 690 print 'CHANGELOG URL:' | 692 print 'CHANGELOG URL:' |
| 691 if opts.official_builds: | 693 if opts.official_builds: |
| 692 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 694 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) |
| 693 else: | 695 else: |
| 694 print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 696 print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) |
| 695 | 697 |
| 696 if __name__ == '__main__': | 698 if __name__ == '__main__': |
| 697 sys.exit(main()) | 699 sys.exit(main()) |
| OLD | NEW |