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 ROLL_SUMMARY = ("Summary of changes available at:\n" | 12 ROLL_SUMMARY = ("Summary of changes available at:\n" |
13 "https://chromium.googlesource.com/v8/v8/+log/%s..%s") | 13 "https://chromium.googlesource.com/v8/v8/+log/%s..%s") |
14 | 14 |
15 ISSUE_MSG = ( | 15 ISSUE_MSG = ( |
16 """Please follow these instructions for assigning/CC'ing issues: | 16 """Please follow these instructions for assigning/CC'ing issues: |
17 https://code.google.com/p/v8-wiki/wiki/TriagingIssues | 17 https://code.google.com/p/v8-wiki/wiki/TriagingIssues |
18 | 18 |
19 Please close rolling in case of a roll revert: | 19 Please close rolling in case of a roll revert: |
20 https://v8-roll.appspot.com/ | 20 https://v8-roll.appspot.com/ |
21 This only works with a Google account.""") | 21 This only works with a Google account.""") |
22 | 22 |
23 class Preparation(Step): | 23 class Preparation(Step): |
24 MESSAGE = "Preparation." | 24 MESSAGE = "Preparation." |
25 | 25 |
26 def RunStep(self): | 26 def RunStep(self): |
| 27 self['json_output']['monitoring_state'] = 'preparation' |
27 # Update v8 remote tracking branches. | 28 # Update v8 remote tracking branches. |
28 self.GitFetchOrigin() | 29 self.GitFetchOrigin() |
29 self.Git("fetch origin +refs/tags/*:refs/tags/*") | 30 self.Git("fetch origin +refs/tags/*:refs/tags/*") |
30 | 31 |
31 | 32 |
32 class DetectLastRoll(Step): | 33 class DetectLastRoll(Step): |
33 MESSAGE = "Detect commit ID of the last Chromium roll." | 34 MESSAGE = "Detect commit ID of the last Chromium roll." |
34 | 35 |
35 def RunStep(self): | 36 def RunStep(self): |
| 37 self['json_output']['monitoring_state'] = 'detect_last_roll' |
36 self["last_roll"] = self._options.last_roll | 38 self["last_roll"] = self._options.last_roll |
37 if not self["last_roll"]: | 39 if not self["last_roll"]: |
38 # Interpret the DEPS file to retrieve the v8 revision. | 40 # Interpret the DEPS file to retrieve the v8 revision. |
39 # TODO(machenbach): This should be part or the roll-deps api of | 41 # TODO(machenbach): This should be part or the roll-deps api of |
40 # depot_tools. | 42 # depot_tools. |
41 Var = lambda var: '%s' | 43 Var = lambda var: '%s' |
42 exec(FileToText(os.path.join(self._options.chromium, "DEPS"))) | 44 exec(FileToText(os.path.join(self._options.chromium, "DEPS"))) |
43 | 45 |
44 # The revision rolled last. | 46 # The revision rolled last. |
45 self["last_roll"] = vars['v8_revision'] | 47 self["last_roll"] = vars['v8_revision'] |
46 self["last_version"] = self.GetVersionTag(self["last_roll"]) | 48 self["last_version"] = self.GetVersionTag(self["last_roll"]) |
47 assert self["last_version"], "The last rolled v8 revision is not tagged." | 49 assert self["last_version"], "The last rolled v8 revision is not tagged." |
48 | 50 |
49 | 51 |
50 class DetectRevisionToRoll(Step): | 52 class DetectRevisionToRoll(Step): |
51 MESSAGE = "Detect commit ID of the V8 revision to roll." | 53 MESSAGE = "Detect commit ID of the V8 revision to roll." |
52 | 54 |
53 def RunStep(self): | 55 def RunStep(self): |
| 56 self['json_output']['monitoring_state'] = 'detect_revision' |
54 self["roll"] = self._options.revision | 57 self["roll"] = self._options.revision |
55 if self["roll"]: | 58 if self["roll"]: |
56 # If the revision was passed on the cmd line, continue script execution | 59 # If the revision was passed on the cmd line, continue script execution |
57 # in the next step. | 60 # in the next step. |
58 return False | 61 return False |
59 | 62 |
60 # The revision that should be rolled. Check for the latest of the most | 63 # The revision that should be rolled. Check for the latest of the most |
61 # recent releases based on commit timestamp. | 64 # recent releases based on commit timestamp. |
62 revisions = self.GetRecentReleases( | 65 revisions = self.GetRecentReleases( |
63 max_age=self._options.max_age * DAY_IN_SECONDS) | 66 max_age=self._options.max_age * DAY_IN_SECONDS) |
64 assert revisions, "Didn't find any recent release." | 67 assert revisions, "Didn't find any recent release." |
65 | 68 |
66 # There must be some progress between the last roll and the new candidate | 69 # There must be some progress between the last roll and the new candidate |
67 # revision (i.e. we don't go backwards). The revisions are ordered newest | 70 # revision (i.e. we don't go backwards). The revisions are ordered newest |
68 # to oldest. It is possible that the newest timestamp has no progress | 71 # to oldest. It is possible that the newest timestamp has no progress |
69 # compared to the last roll, i.e. if the newest release is a cherry-pick | 72 # compared to the last roll, i.e. if the newest release is a cherry-pick |
70 # on a release branch. Then we look further. | 73 # on a release branch. Then we look further. |
71 for revision in revisions: | 74 for revision in revisions: |
72 version = self.GetVersionTag(revision) | 75 version = self.GetVersionTag(revision) |
73 assert version, "Internal error. All recent releases should have a tag" | 76 assert version, "Internal error. All recent releases should have a tag" |
74 | 77 |
75 if SortingKey(self["last_version"]) < SortingKey(version): | 78 if SortingKey(self["last_version"]) < SortingKey(version): |
76 self["roll"] = revision | 79 self["roll"] = revision |
77 break | 80 break |
78 else: | 81 else: |
79 print("There is no newer v8 revision than the one in Chromium (%s)." | 82 print("There is no newer v8 revision than the one in Chromium (%s)." |
80 % self["last_roll"]) | 83 % self["last_roll"]) |
| 84 self['json_output']['monitoring_state'] = 'up_to_date' |
81 return True | 85 return True |
82 | 86 |
83 | 87 |
84 class PrepareRollCandidate(Step): | 88 class PrepareRollCandidate(Step): |
85 MESSAGE = "Robustness checks of the roll candidate." | 89 MESSAGE = "Robustness checks of the roll candidate." |
86 | 90 |
87 def RunStep(self): | 91 def RunStep(self): |
| 92 self['json_output']['monitoring_state'] = 'prepare_candidate' |
88 self["roll_title"] = self.GitLog(n=1, format="%s", | 93 self["roll_title"] = self.GitLog(n=1, format="%s", |
89 git_hash=self["roll"]) | 94 git_hash=self["roll"]) |
90 | 95 |
91 # Make sure the last roll and the roll candidate are releases. | 96 # Make sure the last roll and the roll candidate are releases. |
92 version = self.GetVersionTag(self["roll"]) | 97 version = self.GetVersionTag(self["roll"]) |
93 assert version, "The revision to roll is not tagged." | 98 assert version, "The revision to roll is not tagged." |
94 version = self.GetVersionTag(self["last_roll"]) | 99 version = self.GetVersionTag(self["last_roll"]) |
95 assert version, "The revision used as last roll is not tagged." | 100 assert version, "The revision used as last roll is not tagged." |
96 | 101 |
97 | 102 |
98 class SwitchChromium(Step): | 103 class SwitchChromium(Step): |
99 MESSAGE = "Switch to Chromium checkout." | 104 MESSAGE = "Switch to Chromium checkout." |
100 | 105 |
101 def RunStep(self): | 106 def RunStep(self): |
| 107 self['json_output']['monitoring_state'] = 'switch_chromium' |
102 cwd = self._options.chromium | 108 cwd = self._options.chromium |
103 self.InitialEnvironmentChecks(cwd) | 109 self.InitialEnvironmentChecks(cwd) |
104 # Check for a clean workdir. | 110 # Check for a clean workdir. |
105 if not self.GitIsWorkdirClean(cwd=cwd): # pragma: no cover | 111 if not self.GitIsWorkdirClean(cwd=cwd): # pragma: no cover |
106 self.Die("Workspace is not clean. Please commit or undo your changes.") | 112 self.Die("Workspace is not clean. Please commit or undo your changes.") |
107 # Assert that the DEPS file is there. | 113 # Assert that the DEPS file is there. |
108 if not os.path.exists(os.path.join(cwd, "DEPS")): # pragma: no cover | 114 if not os.path.exists(os.path.join(cwd, "DEPS")): # pragma: no cover |
109 self.Die("DEPS file not present.") | 115 self.Die("DEPS file not present.") |
110 | 116 |
111 | 117 |
112 class UpdateChromiumCheckout(Step): | 118 class UpdateChromiumCheckout(Step): |
113 MESSAGE = "Update the checkout and create a new branch." | 119 MESSAGE = "Update the checkout and create a new branch." |
114 | 120 |
115 def RunStep(self): | 121 def RunStep(self): |
| 122 self['json_output']['monitoring_state'] = 'update_chromium' |
116 cwd = self._options.chromium | 123 cwd = self._options.chromium |
117 self.GitCheckout("master", cwd=cwd) | 124 self.GitCheckout("master", cwd=cwd) |
118 self.DeleteBranch("work-branch", cwd=cwd) | 125 self.DeleteBranch("work-branch", cwd=cwd) |
119 self.Command("gclient", "sync --nohooks", cwd=cwd) | 126 self.Command("gclient", "sync --nohooks", cwd=cwd) |
120 self.GitPull(cwd=cwd) | 127 self.GitPull(cwd=cwd) |
121 | 128 |
122 # Update v8 remotes. | 129 # Update v8 remotes. |
123 self.GitFetchOrigin() | 130 self.GitFetchOrigin() |
124 | 131 |
125 self.GitCreateBranch("work-branch", cwd=cwd) | 132 self.GitCreateBranch("work-branch", cwd=cwd) |
126 | 133 |
127 | 134 |
128 class UploadCL(Step): | 135 class UploadCL(Step): |
129 MESSAGE = "Create and upload CL." | 136 MESSAGE = "Create and upload CL." |
130 | 137 |
131 def RunStep(self): | 138 def RunStep(self): |
| 139 self['json_output']['monitoring_state'] = 'upload' |
132 cwd = self._options.chromium | 140 cwd = self._options.chromium |
133 # Patch DEPS file. | 141 # Patch DEPS file. |
134 if self.Command("roll-dep-svn", "v8 %s" % | 142 if self.Command("roll-dep-svn", "v8 %s" % |
135 self["roll"], cwd=cwd) is None: | 143 self["roll"], cwd=cwd) is None: |
136 self.Die("Failed to create deps for %s" % self["roll"]) | 144 self.Die("Failed to create deps for %s" % self["roll"]) |
137 | 145 |
138 message = [] | 146 message = [] |
139 message.append("Update V8 to %s." % self["roll_title"].lower()) | 147 message.append("Update V8 to %s." % self["roll_title"].lower()) |
140 | 148 |
141 message.append( | 149 message.append( |
(...skipping 12 matching lines...) Expand all Loading... |
154 else: | 162 else: |
155 print "Dry run - don't upload." | 163 print "Dry run - don't upload." |
156 | 164 |
157 self.GitCheckout("master", cwd=cwd) | 165 self.GitCheckout("master", cwd=cwd) |
158 self.GitDeleteBranch("work-branch", cwd=cwd) | 166 self.GitDeleteBranch("work-branch", cwd=cwd) |
159 | 167 |
160 class CleanUp(Step): | 168 class CleanUp(Step): |
161 MESSAGE = "Done!" | 169 MESSAGE = "Done!" |
162 | 170 |
163 def RunStep(self): | 171 def RunStep(self): |
| 172 self['json_output']['monitoring_state'] = 'success' |
164 print("Congratulations, you have successfully rolled %s into " | 173 print("Congratulations, you have successfully rolled %s into " |
165 "Chromium." | 174 "Chromium." |
166 % self["roll"]) | 175 % self["roll"]) |
167 | 176 |
168 # Clean up all temporary files. | 177 # Clean up all temporary files. |
169 Command("rm", "-f %s*" % self._config["PERSISTFILE_BASENAME"]) | 178 Command("rm", "-f %s*" % self._config["PERSISTFILE_BASENAME"]) |
170 | 179 |
171 | 180 |
172 class AutoRoll(ScriptsBase): | 181 class AutoRoll(ScriptsBase): |
173 def _PrepareOptions(self, parser): | 182 def _PrepareOptions(self, parser): |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 PrepareRollCandidate, | 220 PrepareRollCandidate, |
212 SwitchChromium, | 221 SwitchChromium, |
213 UpdateChromiumCheckout, | 222 UpdateChromiumCheckout, |
214 UploadCL, | 223 UploadCL, |
215 CleanUp, | 224 CleanUp, |
216 ] | 225 ] |
217 | 226 |
218 | 227 |
219 if __name__ == "__main__": # pragma: no cover | 228 if __name__ == "__main__": # pragma: no cover |
220 sys.exit(AutoRoll().Run()) | 229 sys.exit(AutoRoll().Run()) |
OLD | NEW |