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

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

Issue 1077633002: [release-tools] Make chromium roll more robust after failing rolls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | tools/release/test_scripts.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 *
(...skipping 27 matching lines...) Expand all
38 version = self.GetVersionTag(self._options.roll) 38 version = self.GetVersionTag(self._options.roll)
39 assert version, "The revision to roll is not tagged." 39 assert version, "The revision to roll is not tagged."
40 version = self.GetVersionTag(self._options.last_roll) 40 version = self.GetVersionTag(self._options.last_roll)
41 assert version, "The revision used as last roll is not tagged." 41 assert version, "The revision used as last roll is not tagged."
42 42
43 43
44 class SwitchChromium(Step): 44 class SwitchChromium(Step):
45 MESSAGE = "Switch to Chromium checkout." 45 MESSAGE = "Switch to Chromium checkout."
46 46
47 def RunStep(self): 47 def RunStep(self):
48 self["v8_path"] = os.getcwd()
Michael Achenbach 2015/04/09 12:38:58 Really all commands have a cwd passed - so no poin
49 cwd = self._options.chromium 48 cwd = self._options.chromium
50 os.chdir(cwd)
51 self.InitialEnvironmentChecks(cwd) 49 self.InitialEnvironmentChecks(cwd)
52 # Check for a clean workdir. 50 # Check for a clean workdir.
53 if not self.GitIsWorkdirClean(cwd=cwd): # pragma: no cover 51 if not self.GitIsWorkdirClean(cwd=cwd): # pragma: no cover
54 self.Die("Workspace is not clean. Please commit or undo your changes.") 52 self.Die("Workspace is not clean. Please commit or undo your changes.")
55 # Assert that the DEPS file is there. 53 # Assert that the DEPS file is there.
56 if not os.path.exists(os.path.join(cwd, "DEPS")): # pragma: no cover 54 if not os.path.exists(os.path.join(cwd, "DEPS")): # pragma: no cover
57 self.Die("DEPS file not present.") 55 self.Die("DEPS file not present.")
58 56
59 57
60 class UpdateChromiumCheckout(Step): 58 class UpdateChromiumCheckout(Step):
61 MESSAGE = "Update the checkout and create a new branch." 59 MESSAGE = "Update the checkout and create a new branch."
62 60
63 def RunStep(self): 61 def RunStep(self):
64 self.GitCheckout("master", cwd=self._options.chromium) 62 cwd = self._options.chromium
65 self.Command("gclient", "sync --nohooks", cwd=self._options.chromium) 63 self.GitCheckout("master", cwd=cwd)
66 self.GitPull(cwd=self._options.chromium) 64 self.DeleteBranch("work-branch", cwd=cwd)
65 self.Command("gclient", "sync --nohooks", cwd=cwd)
66 self.GitPull(cwd=cwd)
67 67
68 # Update v8 remotes. 68 # Update v8 remotes.
69 self.GitFetchOrigin() 69 self.GitFetchOrigin()
70 70
71 self.GitCreateBranch("v8-roll-%s" % self._options.roll, 71 self.GitCreateBranch("work-branch", cwd=cwd)
72 cwd=self._options.chromium)
73 72
74 73
75 class UploadCL(Step): 74 class UploadCL(Step):
76 MESSAGE = "Create and upload CL." 75 MESSAGE = "Create and upload CL."
77 76
78 def RunStep(self): 77 def RunStep(self):
78 cwd = self._options.chromium
79 # Patch DEPS file. 79 # Patch DEPS file.
80 if self.Command( 80 if self.Command("roll-dep", "v8 %s" % self._options.roll, cwd=cwd) is None:
81 "roll-dep", "v8 %s" % self._options.roll,
82 cwd=self._options.chromium) is None:
83 self.Die("Failed to create deps for %s" % self._options.roll) 81 self.Die("Failed to create deps for %s" % self._options.roll)
84 82
85 message = [] 83 message = []
86 message.append("Update V8 to %s." % self["roll_title"].lower()) 84 message.append("Update V8 to %s." % self["roll_title"].lower())
87 85
88 message.append( 86 message.append(
89 ROLL_SUMMARY % (self._options.last_roll[:8], self._options.roll[:8])) 87 ROLL_SUMMARY % (self._options.last_roll[:8], self._options.roll[:8]))
90 88
91 message.append(ISSUE_MSG) 89 message.append(ISSUE_MSG)
92 90
93 message.append("TBR=%s" % self._options.reviewer) 91 message.append("TBR=%s" % self._options.reviewer)
94 self.GitCommit("\n\n".join(message), 92 self.GitCommit("\n\n".join(message), author=self._options.author, cwd=cwd)
95 author=self._options.author,
96 cwd=self._options.chromium)
97 if not self._options.dry_run: 93 if not self._options.dry_run:
98 self.GitUpload(author=self._options.author, 94 self.GitUpload(author=self._options.author,
99 force=True, 95 force=True,
100 cq=self._options.use_commit_queue, 96 cq=self._options.use_commit_queue,
101 cwd=self._options.chromium) 97 cwd=cwd)
102 print "CL uploaded." 98 print "CL uploaded."
103 else: 99 else:
104 self.GitCheckout("master", cwd=self._options.chromium)
105 self.GitDeleteBranch("v8-roll-%s" % self._options.roll,
106 cwd=self._options.chromium)
107 print "Dry run - don't upload." 100 print "Dry run - don't upload."
108 101
109 102 self.GitCheckout("master", cwd=cwd)
110 # TODO(machenbach): Make this obsolete. We are only in the chromium chechout 103 self.GitDeleteBranch("work-branch", cwd=cwd)
111 # for the initial .git check.
112 class SwitchV8(Step):
113 MESSAGE = "Returning to V8 checkout."
114
115 def RunStep(self):
116 os.chdir(self["v8_path"])
117
118 104
119 class CleanUp(Step): 105 class CleanUp(Step):
120 MESSAGE = "Done!" 106 MESSAGE = "Done!"
121 107
122 def RunStep(self): 108 def RunStep(self):
123 print("Congratulations, you have successfully rolled %s into " 109 print("Congratulations, you have successfully rolled %s into "
124 "Chromium." 110 "Chromium."
125 % self._options.roll) 111 % self._options.roll)
126 112
127 # Clean up all temporary files. 113 # Clean up all temporary files.
(...skipping 29 matching lines...) Expand all
157 } 143 }
158 144
159 def _Steps(self): 145 def _Steps(self):
160 return [ 146 return [
161 Preparation, 147 Preparation,
162 PrepareRollCandidate, 148 PrepareRollCandidate,
163 DetermineV8Sheriff, 149 DetermineV8Sheriff,
164 SwitchChromium, 150 SwitchChromium,
165 UpdateChromiumCheckout, 151 UpdateChromiumCheckout,
166 UploadCL, 152 UploadCL,
167 SwitchV8,
168 CleanUp, 153 CleanUp,
169 ] 154 ]
170 155
171 156
172 if __name__ == "__main__": # pragma: no cover 157 if __name__ == "__main__": # pragma: no cover
173 sys.exit(ChromiumRoll().Run()) 158 sys.exit(ChromiumRoll().Run())
OLDNEW
« no previous file with comments | « no previous file | tools/release/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698