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

Unified Diff: tools/release/auto_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, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/release/chromium_roll.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/release/auto_roll.py
diff --git a/tools/release/auto_roll.py b/tools/release/auto_roll.py
index 06bd92d6d109cdcf2474cc73c300f457a8f54fa9..16b80e840d501fcb85656be7f98f766cbe0fd0e3 100755
--- a/tools/release/auto_roll.py
+++ b/tools/release/auto_roll.py
@@ -4,36 +4,65 @@
# found in the LICENSE file.
import argparse
-import json
import os
import sys
-import urllib
from common_includes import *
-import chromium_roll
+
+ROLL_SUMMARY = ("Summary of changes available at:\n"
+ "https://chromium.googlesource.com/v8/v8/+log/%s..%s")
+
+ISSUE_MSG = (
+"""Please follow these instructions for assigning/CC'ing issues:
+https://code.google.com/p/v8-wiki/wiki/TriagingIssues
+
+Please close rolling in case of a roll revert:
+https://v8-roll.appspot.com/
+This only works with a Google account.""")
+
+class Preparation(Step):
+ MESSAGE = "Preparation."
+
+ def RunStep(self):
+ # Update v8 remote tracking branches.
+ self.GitFetchOrigin()
+ self.Git("fetch origin +refs/tags/*:refs/tags/*")
class DetectLastRoll(Step):
MESSAGE = "Detect commit ID of the last Chromium roll."
def RunStep(self):
+ self["last_roll"] = self._options.last_roll
+ if not self["last_roll"]:
+ # Interpret the DEPS file to retrieve the v8 revision.
+ # TODO(machenbach): This should be part or the roll-deps api of
+ # depot_tools.
+ Var = lambda var: '%s'
+ exec(FileToText(os.path.join(self._options.chromium, "DEPS")))
+
+ # The revision rolled last.
+ self["last_roll"] = vars['v8_revision']
+ self["last_version"] = self.GetVersionTag(self["last_roll"])
+ assert self["last_version"], "The last rolled v8 revision is not tagged."
+
+
+class DetectRevisionToRoll(Step):
+ MESSAGE = "Detect commit ID of the V8 revision to roll."
+
+ def RunStep(self):
+ self["roll"] = self._options.revision
+ if self["roll"]:
+ # If the revision was passed on the cmd line, continue script execution
+ # in the next step.
+ return False
+
# The revision that should be rolled. Check for the latest of the most
# recent releases based on commit timestamp.
revisions = self.GetRecentReleases(
max_age=self._options.max_age * DAY_IN_SECONDS)
assert revisions, "Didn't find any recent release."
- # Interpret the DEPS file to retrieve the v8 revision.
- # TODO(machenbach): This should be part or the roll-deps api of
- # depot_tools.
- Var = lambda var: '%s'
- exec(FileToText(os.path.join(self._options.chromium, "DEPS")))
-
- # The revision rolled last.
- self["last_roll"] = vars['v8_revision']
- last_version = self.GetVersionTag(self["last_roll"])
- assert last_version, "The last rolled v8 revision is not tagged."
-
# There must be some progress between the last roll and the new candidate
# revision (i.e. we don't go backwards). The revisions are ordered newest
# to oldest. It is possible that the newest timestamp has no progress
@@ -43,7 +72,7 @@ class DetectLastRoll(Step):
version = self.GetVersionTag(revision)
assert version, "Internal error. All recent releases should have a tag"
- if SortingKey(last_version) < SortingKey(version):
+ if SortingKey(self["last_version"]) < SortingKey(version):
self["roll"] = revision
break
else:
@@ -52,26 +81,92 @@ class DetectLastRoll(Step):
return True
-class RollChromium(Step):
- MESSAGE = "Roll V8 into Chromium."
+class PrepareRollCandidate(Step):
+ MESSAGE = "Robustness checks of the roll candidate."
+
+ def RunStep(self):
+ self["roll_title"] = self.GitLog(n=1, format="%s",
+ git_hash=self["roll"])
+
+ # Make sure the last roll and the roll candidate are releases.
+ version = self.GetVersionTag(self["roll"])
+ assert version, "The revision to roll is not tagged."
+ version = self.GetVersionTag(self["last_roll"])
+ assert version, "The revision used as last roll is not tagged."
+
+
+class SwitchChromium(Step):
+ MESSAGE = "Switch to Chromium checkout."
+
+ def RunStep(self):
+ cwd = self._options.chromium
+ self.InitialEnvironmentChecks(cwd)
+ # Check for a clean workdir.
+ if not self.GitIsWorkdirClean(cwd=cwd): # pragma: no cover
+ self.Die("Workspace is not clean. Please commit or undo your changes.")
+ # Assert that the DEPS file is there.
+ if not os.path.exists(os.path.join(cwd, "DEPS")): # pragma: no cover
+ self.Die("DEPS file not present.")
+
+
+class UpdateChromiumCheckout(Step):
+ MESSAGE = "Update the checkout and create a new branch."
def RunStep(self):
- if self._options.roll:
- args = [
- "--author", self._options.author,
- "--reviewer", self._options.reviewer,
- "--chromium", self._options.chromium,
- "--last-roll", self["last_roll"],
- "--use-commit-queue",
- self["roll"],
- ]
- if self._options.dry_run:
- args.append("--dry-run")
- if self._options.work_dir:
- args.extend(["--work-dir", self._options.work_dir])
- if self._options.chromium_roll_json_output:
- args.extend(["--json-output", self._options.chromium_roll_json_output])
- self._side_effect_handler.Call(chromium_roll.ChromiumRoll().Run, args)
+ 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)
+
+ # Update v8 remotes.
+ self.GitFetchOrigin()
+
+ self.GitCreateBranch("work-branch", cwd=cwd)
+
+
+class UploadCL(Step):
+ MESSAGE = "Create and upload CL."
+
+ def RunStep(self):
+ cwd = self._options.chromium
+ # Patch DEPS file.
+ if self.Command("roll-dep-svn", "v8 %s" %
+ self["roll"], cwd=cwd) is None:
+ self.Die("Failed to create deps for %s" % self["roll"])
+
+ message = []
+ message.append("Update V8 to %s." % self["roll_title"].lower())
+
+ message.append(
+ ROLL_SUMMARY % (self["last_roll"][:8], self["roll"][:8]))
+
+ message.append(ISSUE_MSG)
+
+ message.append("TBR=%s" % self._options.reviewer)
+ self.GitCommit("\n\n".join(message), author=self._options.author, cwd=cwd)
+ if not self._options.dry_run:
+ self.GitUpload(author=self._options.author,
+ force=True,
+ cq=self._options.use_commit_queue,
+ cwd=cwd)
+ print "CL uploaded."
+ else:
+ print "Dry run - don't upload."
+
+ self.GitCheckout("master", cwd=cwd)
+ self.GitDeleteBranch("work-branch", cwd=cwd)
+
+class CleanUp(Step):
+ MESSAGE = "Done!"
+
+ def RunStep(self):
+ print("Congratulations, you have successfully rolled %s into "
+ "Chromium."
+ % self["roll"])
+
+ # Clean up all temporary files.
+ Command("rm", "-f %s*" % self._config["PERSISTFILE_BASENAME"])
class AutoRoll(ScriptsBase):
@@ -79,31 +174,45 @@ class AutoRoll(ScriptsBase):
parser.add_argument("-c", "--chromium", required=True,
help=("The path to your Chromium src/ "
"directory to automate the V8 roll."))
- parser.add_argument("--chromium-roll-json-output",
- help="File to write wrapped results summary to.")
+ parser.add_argument("--last-roll",
+ help="The git commit ID of the last rolled version. "
+ "Auto-detected if not specified.")
parser.add_argument("--max-age", default=3, type=int,
help="Maximum age in days of the latest release.")
- parser.add_argument("--roll", help="Call Chromium roll script.",
- default=False, action="store_true")
+ parser.add_argument("--revision",
+ help="Revision to roll. Auto-detected if not "
+ "specified."),
+ parser.add_argument("--roll", help="Deprecated.",
+ default=True, action="store_true")
+ parser.add_argument("--use-commit-queue",
+ help="Check the CQ bit on upload.",
+ default=True, action="store_true")
def _ProcessOptions(self, options): # pragma: no cover
- if not options.reviewer:
- print "A reviewer (-r) is required."
- return False
- if not options.author:
- print "An author (-a) is required."
+ if not options.author or not options.reviewer:
+ print "A reviewer (-r) and an author (-a) are required."
return False
+
+ options.requires_editor = False
+ options.force = True
+ options.manual = False
return True
def _Config(self):
return {
- "PERSISTFILE_BASENAME": "/tmp/v8-auto-roll-tempfile",
+ "PERSISTFILE_BASENAME": "/tmp/v8-chromium-roll-tempfile",
}
def _Steps(self):
return [
+ Preparation,
DetectLastRoll,
- RollChromium,
+ DetectRevisionToRoll,
+ PrepareRollCandidate,
+ SwitchChromium,
+ UpdateChromiumCheckout,
+ UploadCL,
+ CleanUp,
]
« no previous file with comments | « no previous file | tools/release/chromium_roll.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698