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

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

Issue 1468973002: [release] Merge auto-roll and wrapped chromium-roll scripts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review Created 5 years 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/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
(Empty)
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
5
6 import argparse
7 import os
8 import sys
9
10 from common_includes import *
11
12 ROLL_SUMMARY = ("Summary of changes available at:\n"
13 "https://chromium.googlesource.com/v8/v8/+log/%s..%s")
14
15 ISSUE_MSG = (
16 """Please follow these instructions for assigning/CC'ing issues:
17 https://code.google.com/p/v8-wiki/wiki/TriagingIssues
18
19 Please close rolling in case of a roll revert:
20 https://v8-roll.appspot.com/
21 This only works with a Google account.""")
22
23 class Preparation(Step):
24 MESSAGE = "Preparation."
25
26 def RunStep(self):
27 # Update v8 remote tracking branches.
28 self.GitFetchOrigin()
29 self.Git("fetch origin +refs/tags/*:refs/tags/*")
30
31
32 class PrepareRollCandidate(Step):
33 MESSAGE = "Robustness checks of the roll candidate."
34
35 def RunStep(self):
36 self["roll_title"] = self.GitLog(n=1, format="%s",
37 git_hash=self._options.roll)
38
39 # Make sure the last roll and the roll candidate are releases.
40 version = self.GetVersionTag(self._options.roll)
41 assert version, "The revision to roll is not tagged."
42 version = self.GetVersionTag(self._options.last_roll)
43 assert version, "The revision used as last roll is not tagged."
44
45
46 class SwitchChromium(Step):
47 MESSAGE = "Switch to Chromium checkout."
48
49 def RunStep(self):
50 cwd = self._options.chromium
51 self.InitialEnvironmentChecks(cwd)
52 # Check for a clean workdir.
53 if not self.GitIsWorkdirClean(cwd=cwd): # pragma: no cover
54 self.Die("Workspace is not clean. Please commit or undo your changes.")
55 # Assert that the DEPS file is there.
56 if not os.path.exists(os.path.join(cwd, "DEPS")): # pragma: no cover
57 self.Die("DEPS file not present.")
58
59
60 class UpdateChromiumCheckout(Step):
61 MESSAGE = "Update the checkout and create a new branch."
62
63 def RunStep(self):
64 cwd = self._options.chromium
65 self.GitCheckout("master", cwd=cwd)
66 self.DeleteBranch("work-branch", cwd=cwd)
67 self.Command("gclient", "sync --nohooks", cwd=cwd)
68 self.GitPull(cwd=cwd)
69
70 # Update v8 remotes.
71 self.GitFetchOrigin()
72
73 self.GitCreateBranch("work-branch", cwd=cwd)
74
75
76 class UploadCL(Step):
77 MESSAGE = "Create and upload CL."
78
79 def RunStep(self):
80 cwd = self._options.chromium
81 # Patch DEPS file.
82 if self.Command("roll-dep-svn", "v8 %s" %
83 self._options.roll, cwd=cwd) is None:
84 self.Die("Failed to create deps for %s" % self._options.roll)
85
86 message = []
87 message.append("Update V8 to %s." % self["roll_title"].lower())
88
89 message.append(
90 ROLL_SUMMARY % (self._options.last_roll[:8], self._options.roll[:8]))
91
92 message.append(ISSUE_MSG)
93
94 message.append("TBR=%s" % self._options.reviewer)
95 self.GitCommit("\n\n".join(message), author=self._options.author, cwd=cwd)
96 if not self._options.dry_run:
97 self.GitUpload(author=self._options.author,
98 force=True,
99 cq=self._options.use_commit_queue,
100 cwd=cwd)
101 print "CL uploaded."
102 else:
103 print "Dry run - don't upload."
104
105 self.GitCheckout("master", cwd=cwd)
106 self.GitDeleteBranch("work-branch", cwd=cwd)
107
108 class CleanUp(Step):
109 MESSAGE = "Done!"
110
111 def RunStep(self):
112 print("Congratulations, you have successfully rolled %s into "
113 "Chromium."
114 % self._options.roll)
115
116 # Clean up all temporary files.
117 Command("rm", "-f %s*" % self._config["PERSISTFILE_BASENAME"])
118
119
120 class ChromiumRoll(ScriptsBase):
121 def _PrepareOptions(self, parser):
122 parser.add_argument("-c", "--chromium", required=True,
123 help=("The path to your Chromium src/ "
124 "directory to automate the V8 roll."))
125 parser.add_argument("--last-roll", required=True,
126 help="The git commit ID of the last rolled version.")
127 parser.add_argument("roll", nargs=1, help="Revision to roll."),
128 parser.add_argument("--use-commit-queue",
129 help="Check the CQ bit on upload.",
130 default=False, action="store_true")
131
132 def _ProcessOptions(self, options): # pragma: no cover
133 if not options.author or not options.reviewer:
134 print "A reviewer (-r) and an author (-a) are required."
135 return False
136
137 options.requires_editor = False
138 options.force = True
139 options.manual = False
140 options.roll = options.roll[0]
141 return True
142
143 def _Config(self):
144 return {
145 "PERSISTFILE_BASENAME": "/tmp/v8-chromium-roll-tempfile",
146 }
147
148 def _Steps(self):
149 return [
150 Preparation,
151 PrepareRollCandidate,
152 SwitchChromium,
153 UpdateChromiumCheckout,
154 UploadCL,
155 CleanUp,
156 ]
157
158
159 if __name__ == "__main__": # pragma: no cover
160 sys.exit(ChromiumRoll().Run())
OLDNEW
« no previous file with comments | « tools/release/auto_roll.py ('k') | tools/release/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698