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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 self.good_revision = FixChromiumRevForBlink(revlist, | 445 self.good_revision = FixChromiumRevForBlink(revlist, |
446 revlist_all, | 446 revlist_all, |
447 self, | 447 self, |
448 self.good_revision) | 448 self.good_revision) |
449 self.bad_revision = FixChromiumRevForBlink(revlist, | 449 self.bad_revision = FixChromiumRevForBlink(revlist, |
450 revlist_all, | 450 revlist_all, |
451 self, | 451 self, |
452 self.bad_revision) | 452 self.bad_revision) |
453 return revlist | 453 return revlist |
454 | 454 |
| 455 |
| 456 def IsMac(): |
| 457 return sys.platform.startswith('darwin') |
| 458 |
| 459 |
455 def UnzipFilenameToDir(filename, directory): | 460 def UnzipFilenameToDir(filename, directory): |
456 """Unzip |filename| to |directory|.""" | 461 """Unzip |filename| to |directory|.""" |
457 cwd = os.getcwd() | 462 cwd = os.getcwd() |
458 if not os.path.isabs(filename): | 463 if not os.path.isabs(filename): |
459 filename = os.path.join(cwd, filename) | 464 filename = os.path.join(cwd, filename) |
460 zf = zipfile.ZipFile(filename) | |
461 # Make base. | 465 # Make base. |
462 if not os.path.isdir(directory): | 466 if not os.path.isdir(directory): |
463 os.mkdir(directory) | 467 os.mkdir(directory) |
464 os.chdir(directory) | 468 os.chdir(directory) |
| 469 |
| 470 # The Python ZipFile does not support symbolic links, which makes it |
| 471 # unsuitable for Mac builds. so use ditto instead. |
| 472 if IsMac(): |
| 473 unzip_cmd = ['ditto', '-x', '-k', filename, '.'] |
| 474 proc = subprocess.Popen(unzip_cmd, bufsize=0, stdout=subprocess.PIPE, |
| 475 stderr=subprocess.PIPE) |
| 476 proc.communicate() |
| 477 os.chdir(cwd) |
| 478 return |
| 479 |
| 480 zf = zipfile.ZipFile(filename) |
465 # Extract files. | 481 # Extract files. |
466 for info in zf.infolist(): | 482 for info in zf.infolist(): |
467 name = info.filename | 483 name = info.filename |
468 if name.endswith('/'): # dir | 484 if name.endswith('/'): # dir |
469 if not os.path.isdir(name): | 485 if not os.path.isdir(name): |
470 os.makedirs(name) | 486 os.makedirs(name) |
471 else: # file | 487 else: # file |
472 directory = os.path.dirname(name) | 488 directory = os.path.dirname(name) |
473 if not os.path.isdir(directory): | 489 if not os.path.isdir(directory): |
474 os.makedirs(directory) | 490 os.makedirs(directory) |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 if min_blink_rev != max_blink_rev: | 1181 if min_blink_rev != max_blink_rev: |
1166 print ('NOTE: There is a Blink roll in the range, ' | 1182 print ('NOTE: There is a Blink roll in the range, ' |
1167 'you might also want to do a Blink bisect.') | 1183 'you might also want to do a Blink bisect.') |
1168 | 1184 |
1169 print 'CHANGELOG URL:' | 1185 print 'CHANGELOG URL:' |
1170 PrintChangeLog(min_chromium_rev, max_chromium_rev) | 1186 PrintChangeLog(min_chromium_rev, max_chromium_rev) |
1171 | 1187 |
1172 | 1188 |
1173 if __name__ == '__main__': | 1189 if __name__ == '__main__': |
1174 sys.exit(main()) | 1190 sys.exit(main()) |
OLD | NEW |