2014-03-21 12:15:25 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# Copyright 2014 the V8 project authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from common_includes import *
|
|
|
|
|
|
|
|
|
2015-02-16 12:21:34 +00:00
|
|
|
ROLL_SUMMARY = ("Summary of changes available at:\n"
|
|
|
|
"https://chromium.googlesource.com/v8/v8/+log/%s..%s")
|
|
|
|
|
|
|
|
|
2015-02-20 08:50:39 +00:00
|
|
|
ISSUE_MSG = (
|
|
|
|
"""Please follow these instructions for assigning/CC'ing issues:
|
|
|
|
https://code.google.com/p/v8-wiki/wiki/TriagingIssues""")
|
|
|
|
|
2014-03-21 12:15:25 +00:00
|
|
|
class Preparation(Step):
|
|
|
|
MESSAGE = "Preparation."
|
|
|
|
|
|
|
|
def RunStep(self):
|
2014-09-04 08:42:21 +00:00
|
|
|
# Update v8 remote tracking branches.
|
|
|
|
self.GitFetchOrigin()
|
2015-03-05 10:50:00 +00:00
|
|
|
self.Git("fetch origin +refs/tags/*:refs/tags/*")
|
2014-03-21 12:15:25 +00:00
|
|
|
|
|
|
|
|
2015-03-05 10:50:00 +00:00
|
|
|
class PrepareRollCandidate(Step):
|
|
|
|
MESSAGE = "Robustness checks of the roll candidate."
|
2014-03-21 12:15:25 +00:00
|
|
|
|
|
|
|
def RunStep(self):
|
2015-03-05 10:50:00 +00:00
|
|
|
self["roll_title"] = self.GitLog(n=1, format="%s",
|
|
|
|
git_hash=self._options.roll)
|
2014-03-21 12:15:25 +00:00
|
|
|
|
2015-03-05 10:50:00 +00:00
|
|
|
# Make sure the last roll and the roll candidate are releases.
|
|
|
|
version = self.GetVersionTag(self._options.roll)
|
|
|
|
assert version, "The revision to roll is not tagged."
|
2015-02-16 12:21:34 +00:00
|
|
|
version = self.GetVersionTag(self._options.last_roll)
|
2015-03-05 10:50:00 +00:00
|
|
|
assert version, "The revision used as last roll is not tagged."
|
2015-02-16 12:21:34 +00:00
|
|
|
|
2014-03-21 12:15:25 +00:00
|
|
|
|
|
|
|
class SwitchChromium(Step):
|
|
|
|
MESSAGE = "Switch to Chromium checkout."
|
|
|
|
|
|
|
|
def RunStep(self):
|
2014-09-05 09:19:48 +00:00
|
|
|
cwd = self._options.chromium
|
2014-09-19 13:37:34 +00:00
|
|
|
self.InitialEnvironmentChecks(cwd)
|
2014-03-21 12:15:25 +00:00
|
|
|
# Check for a clean workdir.
|
2014-09-05 09:19:48 +00:00
|
|
|
if not self.GitIsWorkdirClean(cwd=cwd): # pragma: no cover
|
2014-03-21 12:15:25 +00:00
|
|
|
self.Die("Workspace is not clean. Please commit or undo your changes.")
|
|
|
|
# Assert that the DEPS file is there.
|
2014-09-05 09:19:48 +00:00
|
|
|
if not os.path.exists(os.path.join(cwd, "DEPS")): # pragma: no cover
|
2014-03-21 12:15:25 +00:00
|
|
|
self.Die("DEPS file not present.")
|
|
|
|
|
|
|
|
|
|
|
|
class UpdateChromiumCheckout(Step):
|
|
|
|
MESSAGE = "Update the checkout and create a new branch."
|
|
|
|
|
|
|
|
def RunStep(self):
|
2015-04-09 21:37:33 +00:00
|
|
|
cwd = self._options.chromium
|
|
|
|
self.GitCheckout("master", cwd=cwd)
|
|
|
|
self.DeleteBranch("work-branch", cwd=cwd)
|
|
|
|
self.Command("gclient", "sync --nohooks", cwd=cwd)
|
|
|
|
self.GitPull(cwd=cwd)
|
2014-09-05 09:19:48 +00:00
|
|
|
|
|
|
|
# Update v8 remotes.
|
|
|
|
self.GitFetchOrigin()
|
|
|
|
|
2015-04-09 21:37:33 +00:00
|
|
|
self.GitCreateBranch("work-branch", cwd=cwd)
|
2014-03-21 12:15:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
class UploadCL(Step):
|
|
|
|
MESSAGE = "Create and upload CL."
|
|
|
|
|
|
|
|
def RunStep(self):
|
2015-04-09 21:37:33 +00:00
|
|
|
cwd = self._options.chromium
|
2014-03-21 12:15:25 +00:00
|
|
|
# Patch DEPS file.
|
2015-04-09 21:37:33 +00:00
|
|
|
if self.Command("roll-dep", "v8 %s" % self._options.roll, cwd=cwd) is None:
|
2015-03-05 10:50:00 +00:00
|
|
|
self.Die("Failed to create deps for %s" % self._options.roll)
|
2014-03-21 12:15:25 +00:00
|
|
|
|
2015-02-16 12:21:34 +00:00
|
|
|
message = []
|
2015-03-05 10:50:00 +00:00
|
|
|
message.append("Update V8 to %s." % self["roll_title"].lower())
|
2015-02-16 12:21:34 +00:00
|
|
|
|
|
|
|
message.append(
|
2015-03-05 10:50:00 +00:00
|
|
|
ROLL_SUMMARY % (self._options.last_roll[:8], self._options.roll[:8]))
|
2015-02-16 12:21:34 +00:00
|
|
|
|
2015-02-20 08:50:39 +00:00
|
|
|
message.append(ISSUE_MSG)
|
|
|
|
|
2015-02-16 12:21:34 +00:00
|
|
|
message.append("TBR=%s" % self._options.reviewer)
|
2015-04-09 21:37:33 +00:00
|
|
|
self.GitCommit("\n\n".join(message), author=self._options.author, cwd=cwd)
|
2014-09-03 08:29:53 +00:00
|
|
|
if not self._options.dry_run:
|
|
|
|
self.GitUpload(author=self._options.author,
|
|
|
|
force=True,
|
2014-09-05 09:19:48 +00:00
|
|
|
cq=self._options.use_commit_queue,
|
2015-04-09 21:37:33 +00:00
|
|
|
cwd=cwd)
|
2014-09-03 08:29:53 +00:00
|
|
|
print "CL uploaded."
|
|
|
|
else:
|
|
|
|
print "Dry run - don't upload."
|
2014-03-21 12:15:25 +00:00
|
|
|
|
2015-04-09 21:37:33 +00:00
|
|
|
self.GitCheckout("master", cwd=cwd)
|
|
|
|
self.GitDeleteBranch("work-branch", cwd=cwd)
|
2014-03-21 12:15:25 +00:00
|
|
|
|
|
|
|
class CleanUp(Step):
|
|
|
|
MESSAGE = "Done!"
|
|
|
|
|
|
|
|
def RunStep(self):
|
2014-10-14 09:00:16 +00:00
|
|
|
print("Congratulations, you have successfully rolled %s into "
|
2015-03-05 10:50:00 +00:00
|
|
|
"Chromium."
|
|
|
|
% self._options.roll)
|
2014-03-21 12:15:25 +00:00
|
|
|
|
|
|
|
# Clean up all temporary files.
|
2014-09-23 14:41:36 +00:00
|
|
|
Command("rm", "-f %s*" % self._config["PERSISTFILE_BASENAME"])
|
2014-03-21 12:15:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ChromiumRoll(ScriptsBase):
|
|
|
|
def _PrepareOptions(self, parser):
|
2014-09-03 06:50:18 +00:00
|
|
|
parser.add_argument("-c", "--chromium", required=True,
|
2014-03-21 12:15:25 +00:00
|
|
|
help=("The path to your Chromium src/ "
|
|
|
|
"directory to automate the V8 roll."))
|
2015-02-16 12:21:34 +00:00
|
|
|
parser.add_argument("--last-roll", required=True,
|
|
|
|
help="The git commit ID of the last rolled version.")
|
2015-03-05 10:50:00 +00:00
|
|
|
parser.add_argument("roll", nargs=1, help="Revision to roll."),
|
2014-06-25 08:17:45 +00:00
|
|
|
parser.add_argument("--use-commit-queue",
|
|
|
|
help="Check the CQ bit on upload.",
|
|
|
|
default=False, action="store_true")
|
2014-03-21 12:15:25 +00:00
|
|
|
|
|
|
|
def _ProcessOptions(self, options): # pragma: no cover
|
2014-09-03 06:50:18 +00:00
|
|
|
if not options.author or not options.reviewer:
|
|
|
|
print "A reviewer (-r) and an author (-a) are required."
|
2014-03-21 12:15:25 +00:00
|
|
|
return False
|
|
|
|
|
2014-09-03 06:50:18 +00:00
|
|
|
options.requires_editor = False
|
|
|
|
options.force = True
|
|
|
|
options.manual = False
|
2015-03-05 10:50:00 +00:00
|
|
|
options.roll = options.roll[0]
|
2014-03-21 12:15:25 +00:00
|
|
|
return True
|
|
|
|
|
2014-09-23 14:41:36 +00:00
|
|
|
def _Config(self):
|
|
|
|
return {
|
|
|
|
"PERSISTFILE_BASENAME": "/tmp/v8-chromium-roll-tempfile",
|
|
|
|
}
|
|
|
|
|
2014-03-21 12:15:25 +00:00
|
|
|
def _Steps(self):
|
|
|
|
return [
|
|
|
|
Preparation,
|
2015-03-05 10:50:00 +00:00
|
|
|
PrepareRollCandidate,
|
2014-04-08 12:07:49 +00:00
|
|
|
DetermineV8Sheriff,
|
2014-03-21 12:15:25 +00:00
|
|
|
SwitchChromium,
|
|
|
|
UpdateChromiumCheckout,
|
|
|
|
UploadCL,
|
|
|
|
CleanUp,
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": # pragma: no cover
|
2014-09-23 14:41:36 +00:00
|
|
|
sys.exit(ChromiumRoll().Run())
|