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 import argparse | 6 import argparse |
7 import os | 7 import os |
8 import sys | 8 import sys |
9 | 9 |
10 from common_includes import * | 10 from common_includes import * |
11 | 11 |
12 | 12 |
13 class Preparation(Step): | 13 class Preparation(Step): |
14 MESSAGE = "Preparation." | 14 MESSAGE = "Preparation." |
15 | 15 |
16 def RunStep(self): | 16 def RunStep(self): |
17 # Update v8 remote tracking branches. | 17 # Update v8 remote tracking branches. |
18 self.GitFetchOrigin() | 18 self.GitFetchOrigin() |
19 | 19 |
20 | 20 |
21 class DetectLastPush(Step): | 21 class DetectLastPush(Step): |
22 MESSAGE = "Detect commit ID of last push to trunk." | 22 MESSAGE = "Detect commit ID of last push to trunk." |
23 | 23 |
24 def RunStep(self): | 24 def RunStep(self): |
25 self["last_push"] = self._options.last_push or self.FindLastTrunkPush( | 25 self["last_push"] = self._options.last_push or self.FindLastTrunkPush( |
26 branch="origin/candidates", include_patches=True) | 26 branch="origin/candidates", include_patches=True) |
27 self["trunk_revision"] = self.GetCommitPositionNumber(self["last_push"]) | |
28 self["push_title"] = self.GitLog(n=1, format="%s", | 27 self["push_title"] = self.GitLog(n=1, format="%s", |
29 git_hash=self["last_push"]) | 28 git_hash=self["last_push"]) |
30 | 29 |
31 | 30 |
32 class SwitchChromium(Step): | 31 class SwitchChromium(Step): |
33 MESSAGE = "Switch to Chromium checkout." | 32 MESSAGE = "Switch to Chromium checkout." |
34 | 33 |
35 def RunStep(self): | 34 def RunStep(self): |
36 self["v8_path"] = os.getcwd() | 35 self["v8_path"] = os.getcwd() |
37 cwd = self._options.chromium | 36 cwd = self._options.chromium |
(...skipping 11 matching lines...) Expand all Loading... |
49 MESSAGE = "Update the checkout and create a new branch." | 48 MESSAGE = "Update the checkout and create a new branch." |
50 | 49 |
51 def RunStep(self): | 50 def RunStep(self): |
52 self.GitCheckout("master", cwd=self._options.chromium) | 51 self.GitCheckout("master", cwd=self._options.chromium) |
53 self.Command("gclient", "sync --nohooks", cwd=self._options.chromium) | 52 self.Command("gclient", "sync --nohooks", cwd=self._options.chromium) |
54 self.GitPull(cwd=self._options.chromium) | 53 self.GitPull(cwd=self._options.chromium) |
55 | 54 |
56 # Update v8 remotes. | 55 # Update v8 remotes. |
57 self.GitFetchOrigin() | 56 self.GitFetchOrigin() |
58 | 57 |
59 self.GitCreateBranch("v8-roll-%s" % self["trunk_revision"], | 58 self.GitCreateBranch("v8-roll-%s" % self["last_push"], |
60 cwd=self._options.chromium) | 59 cwd=self._options.chromium) |
61 | 60 |
62 | 61 |
63 class UploadCL(Step): | 62 class UploadCL(Step): |
64 MESSAGE = "Create and upload CL." | 63 MESSAGE = "Create and upload CL." |
65 | 64 |
66 def RunStep(self): | 65 def RunStep(self): |
67 # Patch DEPS file. | 66 # Patch DEPS file. |
68 if self.Command( | 67 if self.Command( |
69 "roll-dep", "v8 %s" % self["trunk_revision"], | 68 "roll-dep", "v8 %s" % self["last_push"], |
70 cwd=self._options.chromium) is None: | 69 cwd=self._options.chromium) is None: |
71 self.Die("Failed to create deps for %s" % self["trunk_revision"]) | 70 self.Die("Failed to create deps for %s" % self["last_push"]) |
72 | 71 |
73 commit_title = "Update V8 to %s." % self["push_title"].lower() | 72 commit_title = "Update V8 to %s." % self["push_title"].lower() |
74 sheriff = "" | 73 sheriff = "" |
75 if self["sheriff"]: | 74 if self["sheriff"]: |
76 sheriff = ("\n\nPlease reply to the V8 sheriff %s in case of problems." | 75 sheriff = ("\n\nPlease reply to the V8 sheriff %s in case of problems." |
77 % self["sheriff"]) | 76 % self["sheriff"]) |
78 self.GitCommit("%s%s\n\nTBR=%s" % | 77 self.GitCommit("%s%s\n\nTBR=%s" % |
79 (commit_title, sheriff, self._options.reviewer), | 78 (commit_title, sheriff, self._options.reviewer), |
80 author=self._options.author, | 79 author=self._options.author, |
81 cwd=self._options.chromium) | 80 cwd=self._options.chromium) |
82 if not self._options.dry_run: | 81 if not self._options.dry_run: |
83 self.GitUpload(author=self._options.author, | 82 self.GitUpload(author=self._options.author, |
84 force=True, | 83 force=True, |
85 cq=self._options.use_commit_queue, | 84 cq=self._options.use_commit_queue, |
86 cwd=self._options.chromium) | 85 cwd=self._options.chromium) |
87 print "CL uploaded." | 86 print "CL uploaded." |
88 else: | 87 else: |
89 self.GitCheckout("master", cwd=self._options.chromium) | 88 self.GitCheckout("master", cwd=self._options.chromium) |
90 self.GitDeleteBranch("v8-roll-%s" % self["trunk_revision"], | 89 self.GitDeleteBranch("v8-roll-%s" % self["last_push"], |
91 cwd=self._options.chromium) | 90 cwd=self._options.chromium) |
92 print "Dry run - don't upload." | 91 print "Dry run - don't upload." |
93 | 92 |
94 | 93 |
95 # TODO(machenbach): Make this obsolete. We are only in the chromium chechout | 94 # TODO(machenbach): Make this obsolete. We are only in the chromium chechout |
96 # for the initial .git check. | 95 # for the initial .git check. |
97 class SwitchV8(Step): | 96 class SwitchV8(Step): |
98 MESSAGE = "Returning to V8 checkout." | 97 MESSAGE = "Returning to V8 checkout." |
99 | 98 |
100 def RunStep(self): | 99 def RunStep(self): |
101 os.chdir(self["v8_path"]) | 100 os.chdir(self["v8_path"]) |
102 | 101 |
103 | 102 |
104 class CleanUp(Step): | 103 class CleanUp(Step): |
105 MESSAGE = "Done!" | 104 MESSAGE = "Done!" |
106 | 105 |
107 def RunStep(self): | 106 def RunStep(self): |
108 print("Congratulations, you have successfully rolled the push r%s it into " | 107 print("Congratulations, you have successfully rolled %s into " |
109 "Chromium. Please don't forget to update the v8rel spreadsheet." | 108 "Chromium. Please don't forget to update the v8rel spreadsheet." |
110 % self["trunk_revision"]) | 109 % self["last_push"]) |
111 | 110 |
112 # Clean up all temporary files. | 111 # Clean up all temporary files. |
113 Command("rm", "-f %s*" % self._config["PERSISTFILE_BASENAME"]) | 112 Command("rm", "-f %s*" % self._config["PERSISTFILE_BASENAME"]) |
114 | 113 |
115 | 114 |
116 class ChromiumRoll(ScriptsBase): | 115 class ChromiumRoll(ScriptsBase): |
117 def _PrepareOptions(self, parser): | 116 def _PrepareOptions(self, parser): |
118 parser.add_argument("-c", "--chromium", required=True, | 117 parser.add_argument("-c", "--chromium", required=True, |
119 help=("The path to your Chromium src/ " | 118 help=("The path to your Chromium src/ " |
120 "directory to automate the V8 roll.")) | 119 "directory to automate the V8 roll.")) |
(...skipping 26 matching lines...) Expand all Loading... |
147 SwitchChromium, | 146 SwitchChromium, |
148 UpdateChromiumCheckout, | 147 UpdateChromiumCheckout, |
149 UploadCL, | 148 UploadCL, |
150 SwitchV8, | 149 SwitchV8, |
151 CleanUp, | 150 CleanUp, |
152 ] | 151 ] |
153 | 152 |
154 | 153 |
155 if __name__ == "__main__": # pragma: no cover | 154 if __name__ == "__main__": # pragma: no cover |
156 sys.exit(ChromiumRoll().Run()) | 155 sys.exit(ChromiumRoll().Run()) |
OLD | NEW |