Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 the V8 project authors. All rights reserved. | 2 # Copyright 2013 the V8 project authors. All rights reserved. |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 import textwrap | 40 import textwrap |
| 41 import time | 41 import time |
| 42 import urllib | 42 import urllib |
| 43 import urllib2 | 43 import urllib2 |
| 44 | 44 |
| 45 from git_recipes import GitRecipesMixin | 45 from git_recipes import GitRecipesMixin |
| 46 from git_recipes import GitFailedException | 46 from git_recipes import GitFailedException |
| 47 | 47 |
| 48 CHANGELOG_FILE = "ChangeLog" | 48 CHANGELOG_FILE = "ChangeLog" |
| 49 PUSH_MSG_GIT_RE = re.compile(r".* \(based on (?P<git_rev>[a-fA-F0-9]+)\)$") | 49 PUSH_MSG_GIT_RE = re.compile(r".* \(based on (?P<git_rev>[a-fA-F0-9]+)\)$") |
| 50 PUSH_MSG_NEW_RE = re.compile(r"^Version \d+\.\d+\.\d+$") | |
| 50 VERSION_FILE = os.path.join("src", "version.cc") | 51 VERSION_FILE = os.path.join("src", "version.cc") |
| 51 VERSION_RE = re.compile(r"^\d+\.\d+\.\d+(?:\.\d+)?$") | 52 VERSION_RE = re.compile(r"^\d+\.\d+\.\d+(?:\.\d+)?$") |
| 52 | 53 |
| 53 # V8 base directory. | 54 # V8 base directory. |
| 54 V8_BASE = os.path.dirname( | 55 V8_BASE = os.path.dirname( |
| 55 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | 56 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| 56 | 57 |
| 57 | 58 |
| 58 def TextToFile(text, file_name): | 59 def TextToFile(text, file_name): |
| 59 with open(file_name, "w") as f: | 60 with open(file_name, "w") as f: |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 print "> ", | 585 print "> ", |
| 585 answer = self.ReadLine() | 586 answer = self.ReadLine() |
| 586 | 587 |
| 587 # Takes a file containing the patch to apply as first argument. | 588 # Takes a file containing the patch to apply as first argument. |
| 588 def ApplyPatch(self, patch_file, revert=False): | 589 def ApplyPatch(self, patch_file, revert=False): |
| 589 try: | 590 try: |
| 590 self.GitApplyPatch(patch_file, revert) | 591 self.GitApplyPatch(patch_file, revert) |
| 591 except GitFailedException: | 592 except GitFailedException: |
| 592 self.WaitForResolvingConflicts(patch_file) | 593 self.WaitForResolvingConflicts(patch_file) |
| 593 | 594 |
| 595 def GetVersionTag(self, revision): | |
| 596 tag = self.Git("describe --tags %s" % revision).strip() | |
| 597 if VERSION_RE.match(tag): | |
| 598 return tag | |
| 599 else: | |
| 600 return None | |
| 601 | |
| 594 def GetRecentReleases(self, max_age): | 602 def GetRecentReleases(self, max_age): |
| 595 # Make sure tags are fetched. | 603 # Make sure tags are fetched. |
| 596 self.Git("fetch origin +refs/tags/*:refs/tags/*") | 604 self.Git("fetch origin +refs/tags/*:refs/tags/*") |
| 597 | 605 |
| 598 # Current timestamp. | 606 # Current timestamp. |
| 599 time_now = int(self._side_effect_handler.GetUTCStamp()) | 607 time_now = int(self._side_effect_handler.GetUTCStamp()) |
| 600 | 608 |
| 601 # List every tag from a given period. | 609 # List every tag from a given period. |
| 602 revisions = self.Git("rev-list --max-age=%d --tags" % | 610 revisions = self.Git("rev-list --max-age=%d --tags" % |
| 603 int(time_now - max_age)).strip() | 611 int(time_now - max_age)).strip() |
| 604 | 612 |
| 605 def IsTagged(revision): | |
| 606 return VERSION_RE.match( | |
| 607 self.Git("describe --tags %s" % revision).strip()) | |
| 608 | |
| 609 # Filter out revisions who's tag is off by one or more commits. | 613 # Filter out revisions who's tag is off by one or more commits. |
| 610 return filter(IsTagged, revisions.splitlines()) | 614 return filter(lambda r: self.GetVersionTag(r), revisions.splitlines()) |
| 611 | 615 |
| 612 def GetLatestVersion(self): | 616 def GetLatestVersion(self): |
| 613 # Use cached version if available. | 617 # Use cached version if available. |
| 614 if self["latest_version"]: | 618 if self["latest_version"]: |
| 615 return self["latest_version"] | 619 return self["latest_version"] |
| 616 | 620 |
| 617 # Make sure tags are fetched. | 621 # Make sure tags are fetched. |
| 618 self.Git("fetch origin +refs/tags/*:refs/tags/*") | 622 self.Git("fetch origin +refs/tags/*:refs/tags/*") |
| 619 version = sorted(filter(VERSION_RE.match, self.vc.GetTags()), | 623 version = sorted(filter(VERSION_RE.match, self.vc.GetTags()), |
| 620 key=SortingKey, reverse=True)[0] | 624 key=SortingKey, reverse=True)[0] |
| 621 self["latest_version"] = version | 625 self["latest_version"] = version |
| 622 return version | 626 return version |
| 623 | 627 |
| 624 def GetLatestRelease(self): | 628 def GetLatestRelease(self): |
| 625 """The latest release is the git hash of the latest tagged version. | 629 """The latest release is the git hash of the latest tagged version. |
| 626 | 630 |
| 627 This revision should be rolled into chromium. | 631 This revision should be rolled into chromium. |
| 628 """ | 632 """ |
| 629 latest_version = self.GetLatestVersion() | 633 latest_version = self.GetLatestVersion() |
| 630 | 634 |
| 631 # The latest release. | 635 # The latest release. |
| 632 latest_hash = self.GitLog(n=1, format="%H", branch=latest_version) | 636 latest_hash = self.GitLog(n=1, format="%H", branch=latest_version) |
| 633 assert latest_hash | 637 assert latest_hash |
| 634 return latest_hash | 638 return latest_hash |
| 635 | 639 |
| 636 def GetLatestReleaseBase(self): | 640 def GetLatestReleaseBase(self, version=None): |
| 637 """The latest release base is the latest revision that is covered in the | 641 """The latest release base is the latest revision that is covered in the |
| 638 last change log file. It doesn't include cherry-picked patches. | 642 last change log file. It doesn't include cherry-picked patches. |
| 639 """ | 643 """ |
| 640 latest_version = self.GetLatestVersion() | 644 latest_version = version or self.GetLatestVersion() |
| 641 | 645 |
| 642 # Strip patch level if it exists. | 646 # Strip patch level if it exists. |
| 643 latest_version = ".".join(latest_version.split(".")[:3]) | 647 latest_version = ".".join(latest_version.split(".")[:3]) |
| 644 | 648 |
| 645 # The latest release base. | 649 # The latest release base. |
| 646 latest_hash = self.GitLog(n=1, format="%H", branch=latest_version) | 650 latest_hash = self.GitLog(n=1, format="%H", branch=latest_version) |
| 647 assert latest_hash | 651 assert latest_hash |
| 648 | 652 |
| 649 match = PUSH_MSG_GIT_RE.match( | 653 title = self.GitLog(n=1, format="%s", git_hash=latest_hash) |
| 650 self.GitLog(n=1, format="%s", git_hash=latest_hash)) | 654 match = PUSH_MSG_GIT_RE.match(title) |
| 651 if match: | 655 if match: |
| 652 # Legacy: In the old process there's one level of indirection. The | 656 # Legacy: In the old process there's one level of indirection. The |
| 653 # version is on the candidates branch and points to the real release | 657 # version is on the candidates branch and points to the real release |
| 654 # base on master through the commit message. | 658 # base on master through the commit message. |
| 655 latest_hash = match.group("git_rev") | 659 return match.group("git_rev") |
| 656 return latest_hash | 660 match = PUSH_MSG_NEW_RE.match(title) |
|
Michael Achenbach
2015/02/12 10:38:55
Just returning here wouldn't be correct with the n
tandrii(chromium)
2015/02/13 22:29:08
Agree.
| |
| 661 if match: | |
| 662 # This is a new-style v8 version branched from master. The commit | |
| 663 # "latest_hash" is the version-file change. Its parent is the release | |
| 664 # base on master. | |
| 665 return self.GitLog(n=1, format="%H", git_hash="%s^" % latest_hash) | |
| 666 | |
| 667 self.Die("Unknown latest release: %s" % latest_hash) | |
| 657 | 668 |
| 658 def ArrayToVersion(self, prefix): | 669 def ArrayToVersion(self, prefix): |
| 659 return ".".join([self[prefix + "major"], | 670 return ".".join([self[prefix + "major"], |
| 660 self[prefix + "minor"], | 671 self[prefix + "minor"], |
| 661 self[prefix + "build"], | 672 self[prefix + "build"], |
| 662 self[prefix + "patch"]]) | 673 self[prefix + "patch"]]) |
| 663 | 674 |
| 664 def StoreVersion(self, version, prefix): | 675 def StoreVersion(self, version, prefix): |
| 665 version_parts = version.split(".") | 676 version_parts = version.split(".") |
| 666 if len(version_parts) == 3: | 677 if len(version_parts) == 3: |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 862 for (number, step_class) in enumerate([BootstrapStep] + step_classes): | 873 for (number, step_class) in enumerate([BootstrapStep] + step_classes): |
| 863 steps.append(MakeStep(step_class, number, self._state, self._config, | 874 steps.append(MakeStep(step_class, number, self._state, self._config, |
| 864 options, self._side_effect_handler)) | 875 options, self._side_effect_handler)) |
| 865 for step in steps[options.step:]: | 876 for step in steps[options.step:]: |
| 866 if step.Run(): | 877 if step.Run(): |
| 867 return 0 | 878 return 0 |
| 868 return 0 | 879 return 0 |
| 869 | 880 |
| 870 def Run(self, args=None): | 881 def Run(self, args=None): |
| 871 return self.RunSteps(self._Steps(), args) | 882 return self.RunSteps(self._Steps(), args) |
| OLD | NEW |