OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 the V8 project authors. All rights reserved. | 2 # Copyright 2014 the V8 project 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 # This script retrieves the history of all V8 branches and | 6 # This script retrieves the history of all V8 branches and |
7 # their corresponding Chromium revisions. | 7 # their corresponding Chromium revisions. |
8 | 8 |
9 # Requires a chromium checkout with branch heads: | 9 # Requires a chromium checkout with branch heads: |
10 # gclient sync --with_branch_heads | 10 # gclient sync --with_branch_heads |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 MESSAGE = "Clean up." | 437 MESSAGE = "Clean up." |
438 | 438 |
439 def RunStep(self): | 439 def RunStep(self): |
440 self.CommonCleanup() | 440 self.CommonCleanup() |
441 | 441 |
442 | 442 |
443 class WriteOutput(Step): | 443 class WriteOutput(Step): |
444 MESSAGE = "Print output." | 444 MESSAGE = "Print output." |
445 | 445 |
446 def Run(self): | 446 def Run(self): |
| 447 |
| 448 output = {'releases':self['releases'], |
| 449 'chrome_releases':self['chrome_releases']} |
| 450 |
447 if self._options.csv: | 451 if self._options.csv: |
448 with open(self._options.csv, "w") as f: | 452 with open(self._options.csv, "w") as f: |
449 writer = csv.DictWriter(f, | 453 writer = csv.DictWriter(f, |
450 ["version", "branch", "revision", | 454 ["version", "branch", "revision", |
451 "chromium_revision", "patches_merged"], | 455 "chromium_revision", "patches_merged"], |
452 restval="", | 456 restval="", |
453 extrasaction="ignore") | 457 extrasaction="ignore") |
454 for release in self["releases"]: | 458 for release in self["releases"]: |
455 writer.writerow(release) | 459 writer.writerow(release) |
456 if self._options.json: | 460 if self._options.json: |
457 with open(self._options.json, "w") as f: | 461 with open(self._options.json, "w") as f: |
458 f.write(json.dumps(self["releases"])) | 462 f.write(json.dumps(output)) |
459 if not self._options.csv and not self._options.json: | 463 if not self._options.csv and not self._options.json: |
460 print self["releases"] # pragma: no cover | 464 print output # pragma: no cover |
461 | 465 |
462 | 466 |
463 class Releases(ScriptsBase): | 467 class Releases(ScriptsBase): |
464 def _PrepareOptions(self, parser): | 468 def _PrepareOptions(self, parser): |
465 parser.add_argument("-b", "--branch", default="recent", | 469 parser.add_argument("-b", "--branch", default="recent", |
466 help=("The branch to analyze. If 'all' is specified, " | 470 help=("The branch to analyze. If 'all' is specified, " |
467 "analyze all branches. If 'recent' (default) " | 471 "analyze all branches. If 'recent' (default) " |
468 "is specified, track beta, stable and " | 472 "is specified, track beta, stable and " |
469 "candidates.")) | 473 "candidates.")) |
470 parser.add_argument("-c", "--chromium", | 474 parser.add_argument("-c", "--chromium", |
471 help=("The path to your Chromium src/ " | 475 help=("The path to your Chromium src/ " |
472 "directory to automate the V8 roll.")) | 476 "directory to automate the V8 roll.")) |
473 parser.add_argument("--csv", help="Path to a CSV file for export.") | 477 parser.add_argument("--csv", help="Path to a CSV file for export.") |
474 parser.add_argument("-m", "--max-releases", type=int, default=0, | 478 parser.add_argument("-m", "--max-releases", type=int, default=0, |
475 help="The maximum number of releases to track.") | 479 help="The maximum number of releases to track.") |
476 parser.add_argument("--json", help="Path to a JSON file for export.") | 480 parser.add_argument("--json", help="Path to a JSON file for export.") |
477 | 481 |
478 def _ProcessOptions(self, options): # pragma: no cover | 482 def _ProcessOptions(self, options): # pragma: no cover |
479 options.force_readline_defaults = True | 483 options.force_readline_defaults = True |
480 return True | 484 return True |
481 | 485 |
482 def _Config(self): | 486 def _Config(self): |
483 return { | 487 return { |
484 "BRANCHNAME": "retrieve-v8-releases", | 488 "BRANCHNAME": "retrieve-v8-releases", |
485 "PERSISTFILE_BASENAME": "/tmp/v8-releases-tempfile", | 489 "PERSISTFILE_BASENAME": "/tmp/v8-releases-tempfile", |
486 } | 490 } |
487 | 491 |
488 def _Steps(self): | 492 def _Steps(self): |
| 493 |
489 return [ | 494 return [ |
490 Preparation, | 495 Preparation, |
491 RetrieveV8Releases, | 496 RetrieveV8Releases, |
492 UpdateChromiumCheckout, | 497 UpdateChromiumCheckout, |
493 RetrieveChromiumV8Releases, | 498 RetrieveChromiumV8Releases, |
494 RietrieveChromiumBranches, | 499 RietrieveChromiumBranches, |
| 500 RetrieveInformationOnCanary, |
495 CleanUp, | 501 CleanUp, |
496 WriteOutput, | 502 WriteOutput |
497 ] | 503 ] |
498 | 504 |
499 | 505 |
| 506 class RetrieveInformationOnCanary(Step): |
| 507 MESSAGE = 'Retrieves relevant information on the latest Chrome Canary' |
| 508 |
| 509 def Run(self): |
| 510 |
| 511 params = None |
| 512 resultRaw = self.ReadURL('http://omahaproxy.appspot.com/all.json', params, w
ait_plan=[5, 20]) |
| 513 recentReleases = json.loads(resultRaw) |
| 514 print recentReleases |
| 515 |
| 516 allCanaries = [] |
| 517 |
| 518 for currentOS in recentReleases: |
| 519 for currentVersion in currentOS['versions']: |
| 520 currentCandidate = {'version':currentVersion['version'], |
| 521 'os':currentVersion['os'], |
| 522 'release_date': currentVersion['current_reldate'], |
| 523 'v8_version':currentVersion['v8_version']} |
| 524 |
| 525 if currentVersion['channel'] == 'canary': |
| 526 allCanaries.append(currentCandidate) |
| 527 |
| 528 chromeReleases = {'canaries':allCanaries} |
| 529 self['chrome_releases'] = chromeReleases |
| 530 |
| 531 |
500 if __name__ == "__main__": # pragma: no cover | 532 if __name__ == "__main__": # pragma: no cover |
501 sys.exit(Releases().Run()) | 533 sys.exit(Releases().Run()) |
OLD | NEW |