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

Side by Side Diff: tools/push-to-trunk/chromium_roll.py

Issue 868473004: External name changes of release scripts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
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
13 class Preparation(Step):
14 MESSAGE = "Preparation."
15
16 def RunStep(self):
17 # Update v8 remote tracking branches.
18 self.GitFetchOrigin()
19
20
21 class DetectLastPush(Step):
22 MESSAGE = "Detect commit ID of last push to candidates."
23
24 def RunStep(self):
25 self["last_push"] = self._options.last_push or self.FindLastCandidatesPush(
26 branch="origin/candidates", include_patches=True)
27 self["push_title"] = self.GitLog(n=1, format="%s",
28 git_hash=self["last_push"])
29
30
31 class SwitchChromium(Step):
32 MESSAGE = "Switch to Chromium checkout."
33
34 def RunStep(self):
35 self["v8_path"] = os.getcwd()
36 cwd = self._options.chromium
37 os.chdir(cwd)
38 self.InitialEnvironmentChecks(cwd)
39 # Check for a clean workdir.
40 if not self.GitIsWorkdirClean(cwd=cwd): # pragma: no cover
41 self.Die("Workspace is not clean. Please commit or undo your changes.")
42 # Assert that the DEPS file is there.
43 if not os.path.exists(os.path.join(cwd, "DEPS")): # pragma: no cover
44 self.Die("DEPS file not present.")
45
46
47 class UpdateChromiumCheckout(Step):
48 MESSAGE = "Update the checkout and create a new branch."
49
50 def RunStep(self):
51 self.GitCheckout("master", cwd=self._options.chromium)
52 self.Command("gclient", "sync --nohooks", cwd=self._options.chromium)
53 self.GitPull(cwd=self._options.chromium)
54
55 # Update v8 remotes.
56 self.GitFetchOrigin()
57
58 self.GitCreateBranch("v8-roll-%s" % self["last_push"],
59 cwd=self._options.chromium)
60
61
62 class UploadCL(Step):
63 MESSAGE = "Create and upload CL."
64
65 def RunStep(self):
66 # Patch DEPS file.
67 if self.Command(
68 "roll-dep", "v8 %s" % self["last_push"],
69 cwd=self._options.chromium) is None:
70 self.Die("Failed to create deps for %s" % self["last_push"])
71
72 commit_title = "Update V8 to %s." % self["push_title"].lower()
73 sheriff = ""
74 if self["sheriff"]:
75 sheriff = ("\n\nPlease reply to the V8 sheriff %s in case of problems."
76 % self["sheriff"])
77 self.GitCommit("%s%s\n\nTBR=%s" %
78 (commit_title, sheriff, self._options.reviewer),
79 author=self._options.author,
80 cwd=self._options.chromium)
81 if not self._options.dry_run:
82 self.GitUpload(author=self._options.author,
83 force=True,
84 cq=self._options.use_commit_queue,
85 cwd=self._options.chromium)
86 print "CL uploaded."
87 else:
88 self.GitCheckout("master", cwd=self._options.chromium)
89 self.GitDeleteBranch("v8-roll-%s" % self["last_push"],
90 cwd=self._options.chromium)
91 print "Dry run - don't upload."
92
93
94 # TODO(machenbach): Make this obsolete. We are only in the chromium chechout
95 # for the initial .git check.
96 class SwitchV8(Step):
97 MESSAGE = "Returning to V8 checkout."
98
99 def RunStep(self):
100 os.chdir(self["v8_path"])
101
102
103 class CleanUp(Step):
104 MESSAGE = "Done!"
105
106 def RunStep(self):
107 print("Congratulations, you have successfully rolled %s into "
108 "Chromium. Please don't forget to update the v8rel spreadsheet."
109 % self["last_push"])
110
111 # Clean up all temporary files.
112 Command("rm", "-f %s*" % self._config["PERSISTFILE_BASENAME"])
113
114
115 class ChromiumRoll(ScriptsBase):
116 def _PrepareOptions(self, parser):
117 parser.add_argument("-c", "--chromium", required=True,
118 help=("The path to your Chromium src/ "
119 "directory to automate the V8 roll."))
120 parser.add_argument("-l", "--last-push",
121 help="The git commit ID of the last candidates push.")
122 parser.add_argument("--use-commit-queue",
123 help="Check the CQ bit on upload.",
124 default=False, action="store_true")
125
126 def _ProcessOptions(self, options): # pragma: no cover
127 if not options.author or not options.reviewer:
128 print "A reviewer (-r) and an author (-a) are required."
129 return False
130
131 options.requires_editor = False
132 options.force = True
133 options.manual = False
134 return True
135
136 def _Config(self):
137 return {
138 "PERSISTFILE_BASENAME": "/tmp/v8-chromium-roll-tempfile",
139 }
140
141 def _Steps(self):
142 return [
143 Preparation,
144 DetectLastPush,
145 DetermineV8Sheriff,
146 SwitchChromium,
147 UpdateChromiumCheckout,
148 UploadCL,
149 SwitchV8,
150 CleanUp,
151 ]
152
153
154 if __name__ == "__main__": # pragma: no cover
155 sys.exit(ChromiumRoll().Run())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698