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 30 matching lines...) Expand all Loading... |
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 PUSH_MSG_NEW_RE = re.compile(r"^Version \d+\.\d+\.\d+$") |
51 VERSION_FILE = os.path.join("src", "version.cc") | 51 VERSION_FILE = os.path.join("include", "v8-version.h") |
52 VERSION_RE = re.compile(r"^\d+\.\d+\.\d+(?:\.\d+)?$") | 52 VERSION_RE = re.compile(r"^\d+\.\d+\.\d+(?:\.\d+)?$") |
53 | 53 |
54 # V8 base directory. | 54 # V8 base directory. |
55 V8_BASE = os.path.dirname( | 55 V8_BASE = os.path.dirname( |
56 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | 56 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
57 | 57 |
58 | 58 |
59 def TextToFile(text, file_name): | 59 def TextToFile(text, file_name): |
60 with open(file_name, "w") as f: | 60 with open(file_name, "w") as f: |
61 f.write(text) | 61 f.write(text) |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 if os.path.isdir(f): | 562 if os.path.isdir(f): |
563 shutil.rmtree(f) | 563 shutil.rmtree(f) |
564 | 564 |
565 def ReadAndPersistVersion(self, prefix=""): | 565 def ReadAndPersistVersion(self, prefix=""): |
566 def ReadAndPersist(var_name, def_name): | 566 def ReadAndPersist(var_name, def_name): |
567 match = re.match(r"^#define %s\s+(\d*)" % def_name, line) | 567 match = re.match(r"^#define %s\s+(\d*)" % def_name, line) |
568 if match: | 568 if match: |
569 value = match.group(1) | 569 value = match.group(1) |
570 self["%s%s" % (prefix, var_name)] = value | 570 self["%s%s" % (prefix, var_name)] = value |
571 for line in LinesInFile(os.path.join(self.default_cwd, VERSION_FILE)): | 571 for line in LinesInFile(os.path.join(self.default_cwd, VERSION_FILE)): |
572 for (var_name, def_name) in [("major", "MAJOR_VERSION"), | 572 for (var_name, def_name) in [("major", "V8_MAJOR_VERSION"), |
573 ("minor", "MINOR_VERSION"), | 573 ("minor", "V8_MINOR_VERSION"), |
574 ("build", "BUILD_NUMBER"), | 574 ("build", "V8_BUILD_NUMBER"), |
575 ("patch", "PATCH_LEVEL")]: | 575 ("patch", "V8_PATCH_LEVEL")]: |
576 ReadAndPersist(var_name, def_name) | 576 ReadAndPersist(var_name, def_name) |
577 | 577 |
578 def WaitForLGTM(self): | 578 def WaitForLGTM(self): |
579 print ("Please wait for an LGTM, then type \"LGTM<Return>\" to commit " | 579 print ("Please wait for an LGTM, then type \"LGTM<Return>\" to commit " |
580 "your change. (If you need to iterate on the patch or double check " | 580 "your change. (If you need to iterate on the patch or double check " |
581 "that it's sane, do so in another shell, but remember to not " | 581 "that it's sane, do so in another shell, but remember to not " |
582 "change the headline of the uploaded CL.") | 582 "change the headline of the uploaded CL.") |
583 answer = "" | 583 answer = "" |
584 while answer != "LGTM": | 584 while answer != "LGTM": |
585 print "> ", | 585 print "> ", |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 version_parts.append("0") | 694 version_parts.append("0") |
695 major, minor, build, patch = version_parts | 695 major, minor, build, patch = version_parts |
696 self[prefix + "major"] = major | 696 self[prefix + "major"] = major |
697 self[prefix + "minor"] = minor | 697 self[prefix + "minor"] = minor |
698 self[prefix + "build"] = build | 698 self[prefix + "build"] = build |
699 self[prefix + "patch"] = patch | 699 self[prefix + "patch"] = patch |
700 | 700 |
701 def SetVersion(self, version_file, prefix): | 701 def SetVersion(self, version_file, prefix): |
702 output = "" | 702 output = "" |
703 for line in FileToText(version_file).splitlines(): | 703 for line in FileToText(version_file).splitlines(): |
704 if line.startswith("#define MAJOR_VERSION"): | 704 if line.startswith("#define V8_MAJOR_VERSION"): |
705 line = re.sub("\d+$", self[prefix + "major"], line) | 705 line = re.sub("\d+$", self[prefix + "major"], line) |
706 elif line.startswith("#define MINOR_VERSION"): | 706 elif line.startswith("#define V8_MINOR_VERSION"): |
707 line = re.sub("\d+$", self[prefix + "minor"], line) | 707 line = re.sub("\d+$", self[prefix + "minor"], line) |
708 elif line.startswith("#define BUILD_NUMBER"): | 708 elif line.startswith("#define V8_BUILD_NUMBER"): |
709 line = re.sub("\d+$", self[prefix + "build"], line) | 709 line = re.sub("\d+$", self[prefix + "build"], line) |
710 elif line.startswith("#define PATCH_LEVEL"): | 710 elif line.startswith("#define V8_PATCH_LEVEL"): |
711 line = re.sub("\d+$", self[prefix + "patch"], line) | 711 line = re.sub("\d+$", self[prefix + "patch"], line) |
712 elif (self[prefix + "candidate"] and | 712 elif (self[prefix + "candidate"] and |
713 line.startswith("#define IS_CANDIDATE_VERSION")): | 713 line.startswith("#define V8_IS_CANDIDATE_VERSION")): |
714 line = re.sub("\d+$", self[prefix + "candidate"], line) | 714 line = re.sub("\d+$", self[prefix + "candidate"], line) |
715 output += "%s\n" % line | 715 output += "%s\n" % line |
716 TextToFile(output, version_file) | 716 TextToFile(output, version_file) |
717 | 717 |
718 | 718 |
719 class BootstrapStep(Step): | 719 class BootstrapStep(Step): |
720 MESSAGE = "Bootstapping v8 checkout." | 720 MESSAGE = "Bootstapping v8 checkout." |
721 | 721 |
722 def RunStep(self): | 722 def RunStep(self): |
723 if os.path.realpath(self.default_cwd) == os.path.realpath(V8_BASE): | 723 if os.path.realpath(self.default_cwd) == os.path.realpath(V8_BASE): |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 for (number, step_class) in enumerate([BootstrapStep] + step_classes): | 875 for (number, step_class) in enumerate([BootstrapStep] + step_classes): |
876 steps.append(MakeStep(step_class, number, self._state, self._config, | 876 steps.append(MakeStep(step_class, number, self._state, self._config, |
877 options, self._side_effect_handler)) | 877 options, self._side_effect_handler)) |
878 for step in steps[options.step:]: | 878 for step in steps[options.step:]: |
879 if step.Run(): | 879 if step.Run(): |
880 return 0 | 880 return 0 |
881 return 0 | 881 return 0 |
882 | 882 |
883 def Run(self, args=None): | 883 def Run(self, args=None): |
884 return self.RunSteps(self._Steps(), args) | 884 return self.RunSteps(self._Steps(), args) |
OLD | NEW |