Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: tools/release/common_includes.py

Issue 878913002: Let release scripts determine version based on tags. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 27 matching lines...) Expand all
38 import subprocess 38 import subprocess
39 import sys 39 import sys
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"
Michael Achenbach 2015/01/27 11:39:03 This was moved from push_to_candidates.
49 PUSH_MSG_GIT_RE = re.compile(r".* \(based on (?P<git_rev>[a-fA-F0-9]+)\)$")
49 VERSION_FILE = os.path.join("src", "version.cc") 50 VERSION_FILE = os.path.join("src", "version.cc")
50 VERSION_RE = re.compile(r"^\d+\.\d+\.\d+(?:\.\d+)?$") 51 VERSION_RE = re.compile(r"^\d+\.\d+\.\d+(?:\.\d+)?$")
51 52
52 # V8 base directory. 53 # V8 base directory.
53 V8_BASE = os.path.dirname( 54 V8_BASE = os.path.dirname(
54 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) 55 os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
55 56
56 57
57 def TextToFile(text, file_name): 58 def TextToFile(text, file_name):
58 with open(file_name, "w") as f: 59 with open(file_name, "w") as f:
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 except GitFailedException: 591 except GitFailedException:
591 self.WaitForResolvingConflicts(patch_file) 592 self.WaitForResolvingConflicts(patch_file)
592 593
593 def GetLatestVersion(self): 594 def GetLatestVersion(self):
594 # Use cached version if available. 595 # Use cached version if available.
595 if self["latest_version"]: 596 if self["latest_version"]:
596 return self["latest_version"] 597 return self["latest_version"]
597 598
598 # Make sure tags are fetched. 599 # Make sure tags are fetched.
599 self.Git("fetch origin +refs/tags/*:refs/tags/*") 600 self.Git("fetch origin +refs/tags/*:refs/tags/*")
600 version_parts = sorted(filter(VERSION_RE.match, self.vc.GetTags()), 601 version = sorted(filter(VERSION_RE.match, self.vc.GetTags()),
601 key=SortingKey, reverse=True)[0].split(".") 602 key=SortingKey, reverse=True)[0]
602 if len(version_parts) == 3: 603 self["latest_version"] = version
Michael Achenbach 2015/01/27 11:39:03 This was a mistake. The version is used to later c
603 version_parts.append("0") 604 return version
604 self["latest_version"] = ".".join(version_parts) 605
605 return self["latest_version"] 606 def GetLatestRelease(self):
607 """The latest release is the git hash of the latest tagged version.
608
609 This revision should be rolled into chromium.
610 """
611 latest_version = self.GetLatestVersion()
612
613 # The latest release.
614 latest_hash = self.GitLog(n=1, format="%H", branch=latest_version)
615 assert latest_hash
616 return latest_hash
617
618 def GetLatestReleaseBase(self):
619 """The latest release base is the latest revision that is covered in the
620 last change log file. It doesn't include cherry-picked patches.
621 """
622 latest_version = self.GetLatestVersion()
623
624 # Strip patch level if it exists.
625 latest_version = ".".join(latest_version.split(".")[:3])
626
627 # The latest release base.
628 latest_hash = self.GitLog(n=1, format="%H", branch=latest_version)
629 assert latest_hash
630
631 match = PUSH_MSG_GIT_RE.match(
632 self.GitLog(n=1, format="%s", git_hash=latest_hash))
633 if match:
634 # Legacy: In the old process there's one level of indirection. The
635 # version is on the candidates branch and points to the real release
636 # base on master through the commit message.
637 latest_hash = match.group("git_rev")
638 return latest_hash
606 639
607 def FindLastCandidatesPush( 640 def FindLastCandidatesPush(
608 self, parent_hash="", branch="", include_patches=False): 641 self, parent_hash="", branch="", include_patches=False):
609 push_pattern = "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*" 642 push_pattern = "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*"
610 if not include_patches: 643 if not include_patches:
611 # Non-patched versions only have three numbers followed by the "(based 644 # Non-patched versions only have three numbers followed by the "(based
612 # on...) comment." 645 # on...) comment."
613 push_pattern += " (based" 646 push_pattern += " (based"
614 branch = "" if parent_hash else branch or self.vc.RemoteCandidateBranch() 647 branch = "" if parent_hash else branch or self.vc.RemoteCandidateBranch()
615 return self.GitLog(n=1, format="%H", grep=push_pattern, 648 return self.GitLog(n=1, format="%H", grep=push_pattern,
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 for (number, step_class) in enumerate([BootstrapStep] + step_classes): 852 for (number, step_class) in enumerate([BootstrapStep] + step_classes):
820 steps.append(MakeStep(step_class, number, self._state, self._config, 853 steps.append(MakeStep(step_class, number, self._state, self._config,
821 options, self._side_effect_handler)) 854 options, self._side_effect_handler))
822 for step in steps[options.step:]: 855 for step in steps[options.step:]:
823 if step.Run(): 856 if step.Run():
824 return 0 857 return 0
825 return 0 858 return 0
826 859
827 def Run(self, args=None): 860 def Run(self, args=None):
828 return self.RunSteps(self._Steps(), args) 861 return self.RunSteps(self._Steps(), args)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698