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

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

Issue 977903002: Make auto-roller roll recent release based on timestamp. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review Created 5 years, 9 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
« no previous file with comments | « tools/release/auto_roll.py ('k') | tools/release/common_includes.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 ROLL_SUMMARY = ("Summary of changes available at:\n" 13 ROLL_SUMMARY = ("Summary of changes available at:\n"
14 "https://chromium.googlesource.com/v8/v8/+log/%s..%s") 14 "https://chromium.googlesource.com/v8/v8/+log/%s..%s")
15 15
16 16
17 ISSUE_MSG = ( 17 ISSUE_MSG = (
18 """Please follow these instructions for assigning/CC'ing issues: 18 """Please follow these instructions for assigning/CC'ing issues:
19 https://code.google.com/p/v8-wiki/wiki/TriagingIssues""") 19 https://code.google.com/p/v8-wiki/wiki/TriagingIssues""")
20 20
21 class Preparation(Step): 21 class Preparation(Step):
22 MESSAGE = "Preparation." 22 MESSAGE = "Preparation."
23 23
24 def RunStep(self): 24 def RunStep(self):
25 # Update v8 remote tracking branches. 25 # Update v8 remote tracking branches.
26 self.GitFetchOrigin() 26 self.GitFetchOrigin()
27 self.Git("fetch origin +refs/tags/*:refs/tags/*")
27 28
28 29
29 class DetectLastPush(Step): 30 class PrepareRollCandidate(Step):
30 MESSAGE = "Detect commit ID of last release." 31 MESSAGE = "Robustness checks of the roll candidate."
31 32
32 def RunStep(self): 33 def RunStep(self):
33 # The revision that should be rolled. 34 self["roll_title"] = self.GitLog(n=1, format="%s",
34 self["last_push"] = self._options.last_push or self.GetLatestRelease() 35 git_hash=self._options.roll)
35 self["push_title"] = self.GitLog(n=1, format="%s",
36 git_hash=self["last_push"])
37 36
38 # The master revision this release is based on. 37 # Make sure the last roll and the roll candidate are releases.
39 self["push_base"] = self.GetLatestReleaseBase() 38 version = self.GetVersionTag(self._options.roll)
40 39 assert version, "The revision to roll is not tagged."
41 # FIXME(machenbach): Manually specifying a revision doesn't work at the
42 # moment. Needs more complicated logic to find the correct push_base above.
43 # Maybe delete that parameter entirely?
44 assert not self._options.last_push
45
46 # Determine the master revision of the last roll.
47 version = self.GetVersionTag(self._options.last_roll) 40 version = self.GetVersionTag(self._options.last_roll)
48 assert version 41 assert version, "The revision used as last roll is not tagged."
49 self["last_rolled_base"] = self.GetLatestReleaseBase(version=version)
50 assert self["last_rolled_base"]
51 42
52 43
53 class SwitchChromium(Step): 44 class SwitchChromium(Step):
54 MESSAGE = "Switch to Chromium checkout." 45 MESSAGE = "Switch to Chromium checkout."
55 46
56 def RunStep(self): 47 def RunStep(self):
57 self["v8_path"] = os.getcwd() 48 self["v8_path"] = os.getcwd()
58 cwd = self._options.chromium 49 cwd = self._options.chromium
59 os.chdir(cwd) 50 os.chdir(cwd)
60 self.InitialEnvironmentChecks(cwd) 51 self.InitialEnvironmentChecks(cwd)
61 # Check for a clean workdir. 52 # Check for a clean workdir.
62 if not self.GitIsWorkdirClean(cwd=cwd): # pragma: no cover 53 if not self.GitIsWorkdirClean(cwd=cwd): # pragma: no cover
63 self.Die("Workspace is not clean. Please commit or undo your changes.") 54 self.Die("Workspace is not clean. Please commit or undo your changes.")
64 # Assert that the DEPS file is there. 55 # Assert that the DEPS file is there.
65 if not os.path.exists(os.path.join(cwd, "DEPS")): # pragma: no cover 56 if not os.path.exists(os.path.join(cwd, "DEPS")): # pragma: no cover
66 self.Die("DEPS file not present.") 57 self.Die("DEPS file not present.")
67 58
68 59
69 class UpdateChromiumCheckout(Step): 60 class UpdateChromiumCheckout(Step):
70 MESSAGE = "Update the checkout and create a new branch." 61 MESSAGE = "Update the checkout and create a new branch."
71 62
72 def RunStep(self): 63 def RunStep(self):
73 self.GitCheckout("master", cwd=self._options.chromium) 64 self.GitCheckout("master", cwd=self._options.chromium)
74 self.Command("gclient", "sync --nohooks", cwd=self._options.chromium) 65 self.Command("gclient", "sync --nohooks", cwd=self._options.chromium)
75 self.GitPull(cwd=self._options.chromium) 66 self.GitPull(cwd=self._options.chromium)
76 67
77 # Update v8 remotes. 68 # Update v8 remotes.
78 self.GitFetchOrigin() 69 self.GitFetchOrigin()
79 70
80 self.GitCreateBranch("v8-roll-%s" % self["last_push"], 71 self.GitCreateBranch("v8-roll-%s" % self._options.roll,
81 cwd=self._options.chromium) 72 cwd=self._options.chromium)
82 73
83 74
84 class UploadCL(Step): 75 class UploadCL(Step):
85 MESSAGE = "Create and upload CL." 76 MESSAGE = "Create and upload CL."
86 77
87 def RunStep(self): 78 def RunStep(self):
88 # Patch DEPS file. 79 # Patch DEPS file.
89 if self.Command( 80 if self.Command(
90 "roll-dep", "v8 %s" % self["last_push"], 81 "roll-dep", "v8 %s" % self._options.roll,
91 cwd=self._options.chromium) is None: 82 cwd=self._options.chromium) is None:
92 self.Die("Failed to create deps for %s" % self["last_push"]) 83 self.Die("Failed to create deps for %s" % self._options.roll)
93 84
94 message = [] 85 message = []
95 message.append("Update V8 to %s." % self["push_title"].lower()) 86 message.append("Update V8 to %s." % self["roll_title"].lower())
96 87
97 message.append( 88 message.append(
98 ROLL_SUMMARY % (self["last_rolled_base"][:8], self["push_base"][:8])) 89 ROLL_SUMMARY % (self._options.last_roll[:8], self._options.roll[:8]))
99 90
100 message.append(ISSUE_MSG) 91 message.append(ISSUE_MSG)
101 92
102 message.append("TBR=%s" % self._options.reviewer) 93 message.append("TBR=%s" % self._options.reviewer)
103 self.GitCommit("\n\n".join(message), 94 self.GitCommit("\n\n".join(message),
104 author=self._options.author, 95 author=self._options.author,
105 cwd=self._options.chromium) 96 cwd=self._options.chromium)
106 if not self._options.dry_run: 97 if not self._options.dry_run:
107 self.GitUpload(author=self._options.author, 98 self.GitUpload(author=self._options.author,
108 force=True, 99 force=True,
109 cq=self._options.use_commit_queue, 100 cq=self._options.use_commit_queue,
110 cwd=self._options.chromium) 101 cwd=self._options.chromium)
111 print "CL uploaded." 102 print "CL uploaded."
112 else: 103 else:
113 self.GitCheckout("master", cwd=self._options.chromium) 104 self.GitCheckout("master", cwd=self._options.chromium)
114 self.GitDeleteBranch("v8-roll-%s" % self["last_push"], 105 self.GitDeleteBranch("v8-roll-%s" % self._options.roll,
115 cwd=self._options.chromium) 106 cwd=self._options.chromium)
116 print "Dry run - don't upload." 107 print "Dry run - don't upload."
117 108
118 109
119 # TODO(machenbach): Make this obsolete. We are only in the chromium chechout 110 # TODO(machenbach): Make this obsolete. We are only in the chromium chechout
120 # for the initial .git check. 111 # for the initial .git check.
121 class SwitchV8(Step): 112 class SwitchV8(Step):
122 MESSAGE = "Returning to V8 checkout." 113 MESSAGE = "Returning to V8 checkout."
123 114
124 def RunStep(self): 115 def RunStep(self):
125 os.chdir(self["v8_path"]) 116 os.chdir(self["v8_path"])
126 117
127 118
128 class CleanUp(Step): 119 class CleanUp(Step):
129 MESSAGE = "Done!" 120 MESSAGE = "Done!"
130 121
131 def RunStep(self): 122 def RunStep(self):
132 print("Congratulations, you have successfully rolled %s into " 123 print("Congratulations, you have successfully rolled %s into "
133 "Chromium. Please don't forget to update the v8rel spreadsheet." 124 "Chromium."
134 % self["last_push"]) 125 % self._options.roll)
135 126
136 # Clean up all temporary files. 127 # Clean up all temporary files.
137 Command("rm", "-f %s*" % self._config["PERSISTFILE_BASENAME"]) 128 Command("rm", "-f %s*" % self._config["PERSISTFILE_BASENAME"])
138 129
139 130
140 class ChromiumRoll(ScriptsBase): 131 class ChromiumRoll(ScriptsBase):
141 def _PrepareOptions(self, parser): 132 def _PrepareOptions(self, parser):
142 parser.add_argument("-c", "--chromium", required=True, 133 parser.add_argument("-c", "--chromium", required=True,
143 help=("The path to your Chromium src/ " 134 help=("The path to your Chromium src/ "
144 "directory to automate the V8 roll.")) 135 "directory to automate the V8 roll."))
145 parser.add_argument("-l", "--last-push",
146 help="The git commit ID of the last candidates push.")
147 parser.add_argument("--last-roll", required=True, 136 parser.add_argument("--last-roll", required=True,
148 help="The git commit ID of the last rolled version.") 137 help="The git commit ID of the last rolled version.")
138 parser.add_argument("roll", nargs=1, help="Revision to roll."),
149 parser.add_argument("--use-commit-queue", 139 parser.add_argument("--use-commit-queue",
150 help="Check the CQ bit on upload.", 140 help="Check the CQ bit on upload.",
151 default=False, action="store_true") 141 default=False, action="store_true")
152 142
153 def _ProcessOptions(self, options): # pragma: no cover 143 def _ProcessOptions(self, options): # pragma: no cover
154 if not options.author or not options.reviewer: 144 if not options.author or not options.reviewer:
155 print "A reviewer (-r) and an author (-a) are required." 145 print "A reviewer (-r) and an author (-a) are required."
156 return False 146 return False
157 147
158 options.requires_editor = False 148 options.requires_editor = False
159 options.force = True 149 options.force = True
160 options.manual = False 150 options.manual = False
151 options.roll = options.roll[0]
161 return True 152 return True
162 153
163 def _Config(self): 154 def _Config(self):
164 return { 155 return {
165 "PERSISTFILE_BASENAME": "/tmp/v8-chromium-roll-tempfile", 156 "PERSISTFILE_BASENAME": "/tmp/v8-chromium-roll-tempfile",
166 } 157 }
167 158
168 def _Steps(self): 159 def _Steps(self):
169 return [ 160 return [
170 Preparation, 161 Preparation,
171 DetectLastPush, 162 PrepareRollCandidate,
172 DetermineV8Sheriff, 163 DetermineV8Sheriff,
173 SwitchChromium, 164 SwitchChromium,
174 UpdateChromiumCheckout, 165 UpdateChromiumCheckout,
175 UploadCL, 166 UploadCL,
176 SwitchV8, 167 SwitchV8,
177 CleanUp, 168 CleanUp,
178 ] 169 ]
179 170
180 171
181 if __name__ == "__main__": # pragma: no cover 172 if __name__ == "__main__": # pragma: no cover
182 sys.exit(ChromiumRoll().Run()) 173 sys.exit(ChromiumRoll().Run())
OLDNEW
« no previous file with comments | « tools/release/auto_roll.py ('k') | tools/release/common_includes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698