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 """ | 6 """ |
7 Script for auto-increasing the version on bleeding_edge. | 7 Script for auto-increasing the version on bleeding_edge. |
8 | 8 |
9 The script can be run regularly by a cron job. It will increase the build | 9 The script can be run regularly by a cron job. It will increase the build |
10 level of the version on bleeding_edge if: | 10 level of the version on bleeding_edge if: |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 import argparse | 22 import argparse |
23 import os | 23 import os |
24 import sys | 24 import sys |
25 | 25 |
26 from common_includes import * | 26 from common_includes import * |
27 | 27 |
28 CONFIG = { | 28 CONFIG = { |
29 PERSISTFILE_BASENAME: "/tmp/v8-bump-up-version-tempfile", | 29 PERSISTFILE_BASENAME: "/tmp/v8-bump-up-version-tempfile", |
30 PATCH_FILE: "/tmp/v8-bump-up-version-tempfile-patch-file", | 30 PATCH_FILE: "/tmp/v8-bump-up-version-tempfile-patch-file", |
31 VERSION_FILE: "src/version.cc", | |
32 } | 31 } |
33 | 32 |
34 VERSION_BRANCH = "auto-bump-up-version" | 33 VERSION_BRANCH = "auto-bump-up-version" |
35 | 34 |
36 | 35 |
37 class Preparation(Step): | 36 class Preparation(Step): |
38 MESSAGE = "Preparation." | 37 MESSAGE = "Preparation." |
39 | 38 |
40 def RunStep(self): | 39 def RunStep(self): |
41 # Check for a clean workdir. | 40 # Check for a clean workdir. |
(...skipping 24 matching lines...) Expand all Loading... |
66 print "Bleeding edge version: %s" % self["latest_version"] | 65 print "Bleeding edge version: %s" % self["latest_version"] |
67 | 66 |
68 | 67 |
69 # This step is pure paranoia. It forbids the script to continue if the last | 68 # This step is pure paranoia. It forbids the script to continue if the last |
70 # commit changed version.cc. Just in case the other bailout has a bug, this | 69 # commit changed version.cc. Just in case the other bailout has a bug, this |
71 # prevents the script from continuously commiting version changes. | 70 # prevents the script from continuously commiting version changes. |
72 class LastChangeBailout(Step): | 71 class LastChangeBailout(Step): |
73 MESSAGE = "Stop script if the last change modified the version." | 72 MESSAGE = "Stop script if the last change modified the version." |
74 | 73 |
75 def RunStep(self): | 74 def RunStep(self): |
76 if self._config[VERSION_FILE] in self.GitChangedFiles(self["latest"]): | 75 if VERSION_FILE in self.GitChangedFiles(self["latest"]): |
77 print "Stop due to recent version change." | 76 print "Stop due to recent version change." |
78 return True | 77 return True |
79 | 78 |
80 | 79 |
81 # TODO(machenbach): Implement this for git. | 80 # TODO(machenbach): Implement this for git. |
82 class FetchLKGR(Step): | 81 class FetchLKGR(Step): |
83 MESSAGE = "Fetching V8 LKGR." | 82 MESSAGE = "Fetching V8 LKGR." |
84 | 83 |
85 def RunStep(self): | 84 def RunStep(self): |
86 lkgr_url = "https://v8-status.appspot.com/lkgr" | 85 lkgr_url = "https://v8-status.appspot.com/lkgr" |
(...skipping 28 matching lines...) Expand all Loading... |
115 self.GitCheckout("bleeding_edge") | 114 self.GitCheckout("bleeding_edge") |
116 self.DeleteBranch(VERSION_BRANCH) | 115 self.DeleteBranch(VERSION_BRANCH) |
117 | 116 |
118 | 117 |
119 class LKGRVersionUpToDateBailout(Step): | 118 class LKGRVersionUpToDateBailout(Step): |
120 MESSAGE = "Stop script if the lkgr has a renewed version." | 119 MESSAGE = "Stop script if the lkgr has a renewed version." |
121 | 120 |
122 def RunStep(self): | 121 def RunStep(self): |
123 # If a version-change commit becomes the lkgr, don't bump up the version | 122 # If a version-change commit becomes the lkgr, don't bump up the version |
124 # again. | 123 # again. |
125 if self._config[VERSION_FILE] in self.GitChangedFiles(self["lkgr"]): | 124 if VERSION_FILE in self.GitChangedFiles(self["lkgr"]): |
126 print "Stop because the lkgr is a version change itself." | 125 print "Stop because the lkgr is a version change itself." |
127 return True | 126 return True |
128 | 127 |
129 # Don't bump up the version if it got updated already after the lkgr. | 128 # Don't bump up the version if it got updated already after the lkgr. |
130 if SortingKey(self["lkgr_version"]) < SortingKey(self["latest_version"]): | 129 if SortingKey(self["lkgr_version"]) < SortingKey(self["latest_version"]): |
131 print("Stop because the latest version already changed since the lkgr " | 130 print("Stop because the latest version already changed since the lkgr " |
132 "version.") | 131 "version.") |
133 return True | 132 return True |
134 | 133 |
135 | 134 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 print "Skip version change by tree status: \"%s\"" % message | 186 print "Skip version change by tree status: \"%s\"" % message |
188 return True | 187 return True |
189 | 188 |
190 | 189 |
191 class ChangeVersion(Step): | 190 class ChangeVersion(Step): |
192 MESSAGE = "Bump up the version." | 191 MESSAGE = "Bump up the version." |
193 | 192 |
194 def RunStep(self): | 193 def RunStep(self): |
195 self.GitCreateBranch(VERSION_BRANCH, "bleeding_edge") | 194 self.GitCreateBranch(VERSION_BRANCH, "bleeding_edge") |
196 | 195 |
197 self.SetVersion(self.Config(VERSION_FILE), "new_") | 196 self.SetVersion(os.path.join(self.default_cwd, VERSION_FILE), "new_") |
198 | 197 |
199 try: | 198 try: |
200 msg = "[Auto-roll] Bump up version to %s" % self["new_version"] | 199 msg = "[Auto-roll] Bump up version to %s" % self["new_version"] |
201 self.GitCommit("%s\n\nTBR=%s" % (msg, self._options.author), | 200 self.GitCommit("%s\n\nTBR=%s" % (msg, self._options.author), |
202 author=self._options.author) | 201 author=self._options.author) |
203 if self._options.svn: | 202 if self._options.svn: |
204 self.SVNCommit("branches/bleeding_edge", msg) | 203 self.SVNCommit("branches/bleeding_edge", msg) |
205 else: | 204 else: |
206 self.GitUpload(author=self._options.author, | 205 self.GitUpload(author=self._options.author, |
207 force=self._options.force_upload, | 206 force=self._options.force_upload, |
(...skipping 29 matching lines...) Expand all Loading... |
237 GetLKGRVersion, | 236 GetLKGRVersion, |
238 LKGRVersionUpToDateBailout, | 237 LKGRVersionUpToDateBailout, |
239 GetTrunkVersion, | 238 GetTrunkVersion, |
240 CalculateVersion, | 239 CalculateVersion, |
241 CheckTreeStatus, | 240 CheckTreeStatus, |
242 ChangeVersion, | 241 ChangeVersion, |
243 ] | 242 ] |
244 | 243 |
245 if __name__ == "__main__": # pragma: no cover | 244 if __name__ == "__main__": # pragma: no cover |
246 sys.exit(BumpUpVersion(CONFIG).Run()) | 245 sys.exit(BumpUpVersion(CONFIG).Run()) |
OLD | NEW |