Diff
Modified: trunk/Tools/ChangeLog (90506 => 90507)
--- trunk/Tools/ChangeLog 2011-07-06 22:34:58 UTC (rev 90506)
+++ trunk/Tools/ChangeLog 2011-07-06 22:49:48 UTC (rev 90507)
@@ -1,3 +1,20 @@
+2011-07-06 Adam Barth <[email protected]>
+
+ Add roll-chromium-deps command to sheriff-bot
+ https://bugs.webkit.org/show_bug.cgi?id=64037
+
+ Reviewed by Eric Seidel.
+
+ Lo, and the DEPS were rolled on command.
+
+ * Scripts/webkitpy/tool/bot/irc_command.py:
+ * Scripts/webkitpy/tool/bot/irc_command_unittest.py:
+ * Scripts/webkitpy/tool/bot/sheriff.py:
+ * Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py:
+ * Scripts/webkitpy/tool/commands/roll.py:
+ * Scripts/webkitpy/tool/commands/roll_unittest.py:
+ * Scripts/webkitpy/tool/steps/updatechromiumdeps.py:
+
2011-07-06 Eric Seidel <[email protected]>
Split Driver, DriverOutput and DriverInput out into a new driver.py file
Modified: trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py (90506 => 90507)
--- trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py 2011-07-06 22:34:58 UTC (rev 90506)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py 2011-07-06 22:49:48 UTC (rev 90507)
@@ -37,6 +37,15 @@
from webkitpy.tool.bot.queueengine import TerminateQueue
from webkitpy.tool.grammar import join_with_separators
+
+def _post_error_and_check_for_bug_url(tool, nicks_string, exception):
+ tool.irc().post("%s" % exception)
+ bug_id = parse_bug_id(exception.output)
+ if bug_id:
+ bug_url = tool.bugs.bug_url_for_bug_id(bug_id)
+ tool.irc().post("%s: Ugg... Might have created %s" % (nicks_string, bug_url))
+
+
# FIXME: Merge with Command?
class IRCCommand(object):
def execute(self, nick, args, tool, sheriff):
@@ -112,12 +121,37 @@
tool.irc().post("%s: Created rollout: %s" % (nicks_string, bug_url))
except ScriptError, e:
tool.irc().post("%s: Failed to create rollout patch:" % nicks_string)
- tool.irc().post("%s" % e)
- bug_id = parse_bug_id(e.output)
- if bug_id:
- tool.irc().post("%s: Ugg... Might have created %s" % (nicks_string, tool.bugs.bug_url_for_bug_id(bug_id)))
+ _post_error_and_check_for_bug_url(tool, nicks_string, e)
+class RollChromiumDEPS(IRCCommand):
+ def _parse_args(self, args):
+ if not args:
+ return
+ revision = args[0].lstrip("r")
+ if not revision.isdigit():
+ return
+ return revision
+
+ def execute(self, nick, args, tool, sheriff):
+ revision = self._parse_args(args)
+
+ roll_target = "r%s" % revision if revision else "last-known good revision"
+ tool.irc().post("%s: Rolling Chromium DEPS to %s" % (nick, roll_target))
+
+ try:
+ bug_id = sheriff.post_chromium_deps_roll(revision)
+ bug_url = tool.bugs.bug_url_for_bug_id(bug_id)
+ tool.irc().post("%s: Created DEPS roll: %s" % (nick, bug_url))
+ except ScriptError, e:
+ match = re.search(r"Current Chromium DEPS revision \d+ is newer than \d+\.", e.output)
+ if match:
+ tool.irc().post("%s: %s" % (nick, match.group(0)))
+ return
+ tool.irc().post("%s: Failed to create DEPS roll:" % nick)
+ _post_error_and_check_for_bug_url(tool, nick, e)
+
+
class Help(IRCCommand):
def execute(self, nick, args, tool, sheriff):
return "%s: Available commands: %s" % (nick, ", ".join(commands.keys()))
@@ -186,4 +220,5 @@
"rollout": Rollout,
"whois": Whois,
"create-bug": CreateBug,
+ "roll-chromium-deps": RollChromiumDEPS,
}
Modified: trunk/Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py (90506 => 90507)
--- trunk/Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py 2011-07-06 22:34:58 UTC (rev 90506)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py 2011-07-06 22:49:48 UTC (rev 90507)
@@ -28,6 +28,7 @@
import unittest
+from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.tool.bot.irc_command import *
from webkitpy.tool.mocktool import MockTool
@@ -70,6 +71,11 @@
self.assertEquals("tom: Failed to create bug:\nException from bugzilla!",
create_bug.execute("tom", example_args, tool, None))
+ def test_roll_chromium_deps(self):
+ roll = RollChromiumDEPS()
+ self.assertEquals(None, roll._parse_args([]))
+ self.assertEquals("1234", roll._parse_args(["1234"]))
+
def test_rollout(self):
rollout = Rollout()
self.assertEquals(([1234], "testing foo"),
Modified: trunk/Tools/Scripts/webkitpy/tool/bot/sheriff.py (90506 => 90507)
--- trunk/Tools/Scripts/webkitpy/tool/bot/sheriff.py 2011-07-06 22:34:58 UTC (rev 90506)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/sheriff.py 2011-07-06 22:49:48 UTC (rev 90507)
@@ -89,6 +89,18 @@
])
return parse_bug_id(output)
+ def post_chromium_deps_roll(self, revision):
+ args = [
+ "post-chromium-deps-roll",
+ "--force-clean",
+ "--non-interactive",
+ "--parent-command=sheriff-bot",
+ ]
+ if revision:
+ args += [revision]
+ output = self._sheriffbot.run_webkit_patch(args)
+ return parse_bug_id(output)
+
def post_blame_comment_on_bug(self, commit_info, builders, tests):
if not commit_info.bug_id():
return
Modified: trunk/Tools/Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py (90506 => 90507)
--- trunk/Tools/Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py 2011-07-06 22:34:58 UTC (rev 90506)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py 2011-07-06 22:49:48 UTC (rev 90507)
@@ -82,7 +82,7 @@
OutputCapture().assert_outputs(self, run, args=["hi"], expected_stderr=expected_stderr)
def test_help(self):
- expected_stderr = "MOCK: irc.post: mock_nick: Available commands: whois, create-bug, hi, last-green-revision, rollout, restart, help\n"
+ expected_stderr = "MOCK: irc.post: mock_nick: Available commands: hi, help, last-green-revision, rollout, roll-chromium-deps, create-bug, restart, whois\n"
OutputCapture().assert_outputs(self, run, args=["help"], expected_stderr=expected_stderr)
def test_lgr(self):
@@ -97,6 +97,14 @@
expected_stderr = "MOCK: irc.post: mock_nick, abarth, darin, eseidel: Preparing rollout for http://trac.webkit.org/changeset/21654...\nMOCK: irc.post: mock_nick, abarth, darin, eseidel: Created rollout: http://example.com/36936\n"
OutputCapture().assert_outputs(self, run, args=["rollout 21654 This patch broke the world"], expected_stderr=expected_stderr)
+ def test_roll_chromium_deps(self):
+ expected_stderr = "MOCK: irc.post: mock_nick: Rolling Chromium DEPS to r21654\nMOCK: irc.post: mock_nick: Created DEPS roll: http://example.com/36936\n"
+ OutputCapture().assert_outputs(self, run, args=["roll-chromium-deps 21654"], expected_stderr=expected_stderr)
+
+ def test_roll_chromium_deps_to_lkgr(self):
+ expected_stderr = "MOCK: irc.post: mock_nick: Rolling Chromium DEPS to last-known good revision\nMOCK: irc.post: mock_nick: Created DEPS roll: http://example.com/36936\n"
+ OutputCapture().assert_outputs(self, run, args=["roll-chromium-deps"], expected_stderr=expected_stderr)
+
def test_multi_rollout(self):
expected_stderr = "MOCK: irc.post: mock_nick, abarth, darin, eseidel: Preparing rollout for http://trac.webkit.org/changeset/21654, http://trac.webkit.org/changeset/21655, and http://trac.webkit.org/changeset/21656...\nMOCK: irc.post: mock_nick, abarth, darin, eseidel: Created rollout: http://example.com/36936\n"
OutputCapture().assert_outputs(self, run, args=["rollout 21654 21655 21656 This 21654 patch broke the world"], expected_stderr=expected_stderr)
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/roll.py (90506 => 90507)
--- trunk/Tools/Scripts/webkitpy/tool/commands/roll.py 2011-07-06 22:34:58 UTC (rev 90506)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/roll.py 2011-07-06 22:49:48 UTC (rev 90507)
@@ -46,3 +46,28 @@
return {
"chromium_revision": (args and args[0]),
}
+
+
+class PostChromiumDEPSRoll(AbstractSequencedCommand):
+ name = "post-chromium-deps-roll"
+ help_text = "Posts a patch to update Chromium DEPS (defaults to the last-known good revision of Chromium)"
+ argument_names = "[CHROMIUM_REVISION]"
+ steps = [
+ steps.CleanWorkingDirectory,
+ steps.Update,
+ steps.UpdateChromiumDEPS,
+ steps.PrepareChangeLogForDEPSRoll,
+ steps.CreateBug,
+ steps.PostDiff,
+ ]
+
+ def _prepare_state(self, options, args, tool):
+ options.review = False
+ options.request_commit = True
+
+ chromium_revision = (args and args[0])
+ return {
+ "chromium_revision": chromium_revision,
+ "bug_title": "Roll Chromium DEPS to r%s" % chromium_revision,
+ "bug_description": "A DEPS roll a day keeps the build break away.",
+ }
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/roll_unittest.py (90506 => 90507)
--- trunk/Tools/Scripts/webkitpy/tool/commands/roll_unittest.py 2011-07-06 22:34:58 UTC (rev 90506)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/roll_unittest.py 2011-07-06 22:49:48 UTC (rev 90507)
@@ -43,7 +43,8 @@
self.assert_execute_outputs(RollChromiumDEPS(), [6764], expected_stderr=expected_stderr)
def test_update_chromium_deps_older_revision(self):
+ options = MockOptions(non_interactive=False)
expected_stderr = """Current Chromium DEPS revision 6564 is newer than 5764.
ERROR: Unable to update Chromium DEPS
"""
- self.assert_execute_outputs(RollChromiumDEPS(), [5764], expected_stderr=expected_stderr, expected_exception=SystemExit)
+ self.assert_execute_outputs(RollChromiumDEPS(), [5764], options=options, expected_stderr=expected_stderr, expected_exception=SystemExit)
Modified: trunk/Tools/Scripts/webkitpy/tool/steps/updatechromiumdeps.py (90506 => 90507)
--- trunk/Tools/Scripts/webkitpy/tool/steps/updatechromiumdeps.py 2011-07-06 22:34:58 UTC (rev 90506)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/updatechromiumdeps.py 2011-07-06 22:49:48 UTC (rev 90507)
@@ -35,13 +35,22 @@
class UpdateChromiumDEPS(AbstractStep):
+ @classmethod
+ def options(cls):
+ return AbstractStep.options() + [
+ Options.non_interactive,
+ ]
+
# Notice that this method throws lots of exciting exceptions!
def _fetch_last_known_good_revision(self):
return int(urllib2.urlopen(urls.chromium_lkgr_url).read())
def _validate_revisions(self, current_chromium_revision, new_chromium_revision):
if new_chromium_revision < current_chromium_revision:
- log("Current Chromium DEPS revision %s is newer than %s." % (current_chromium_revision, new_chromium_revision))
+ message = "Current Chromium DEPS revision %s is newer than %s." % (current_chromium_revision, new_chromium_revision)
+ if self._options.non_interactive:
+ error(message) # Causes the process to terminate.
+ log(message)
new_chromium_revision = self._tool.user.prompt("Enter new chromium revision (enter nothing to cancel):\n")
try:
new_chromium_revision = int(new_chromium_revision)