Changeset 90507 in webkit


Ignore:
Timestamp:
Jul 6, 2011 3:49:48 PM (13 years ago)
Author:
abarth@webkit.org
Message:

2011-07-06 Adam Barth <abarth@webkit.org>

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:
Location:
trunk/Tools
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r90506 r90507  
     12011-07-06  Adam Barth  <abarth@webkit.org>
     2
     3        Add roll-chromium-deps command to sheriff-bot
     4        https://bugs.webkit.org/show_bug.cgi?id=64037
     5
     6        Reviewed by Eric Seidel.
     7
     8        Lo, and the DEPS were rolled on command.
     9
     10        * Scripts/webkitpy/tool/bot/irc_command.py:
     11        * Scripts/webkitpy/tool/bot/irc_command_unittest.py:
     12        * Scripts/webkitpy/tool/bot/sheriff.py:
     13        * Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py:
     14        * Scripts/webkitpy/tool/commands/roll.py:
     15        * Scripts/webkitpy/tool/commands/roll_unittest.py:
     16        * Scripts/webkitpy/tool/steps/updatechromiumdeps.py:
     17
    1182011-07-06  Eric Seidel  <eric@webkit.org>
    219
  • trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py

    r89520 r90507  
    3838from webkitpy.tool.grammar import join_with_separators
    3939
     40
     41def _post_error_and_check_for_bug_url(tool, nicks_string, exception):
     42    tool.irc().post("%s" % exception)
     43    bug_id = parse_bug_id(exception.output)
     44    if bug_id:
     45        bug_url = tool.bugs.bug_url_for_bug_id(bug_id)
     46        tool.irc().post("%s: Ugg...  Might have created %s" % (nicks_string, bug_url))
     47
     48
    4049# FIXME: Merge with Command?
    4150class IRCCommand(object):
     
    113122        except ScriptError, e:
    114123            tool.irc().post("%s: Failed to create rollout patch:" % nicks_string)
    115             tool.irc().post("%s" % e)
    116             bug_id = parse_bug_id(e.output)
    117             if bug_id:
    118                 tool.irc().post("%s: Ugg...  Might have created %s" % (nicks_string, tool.bugs.bug_url_for_bug_id(bug_id)))
     124            _post_error_and_check_for_bug_url(tool, nicks_string, e)
     125
     126
     127class RollChromiumDEPS(IRCCommand):
     128    def _parse_args(self, args):
     129        if not args:
     130            return
     131        revision = args[0].lstrip("r")
     132        if not revision.isdigit():
     133            return
     134        return revision
     135
     136    def execute(self, nick, args, tool, sheriff):
     137        revision = self._parse_args(args)
     138
     139        roll_target = "r%s" % revision if revision else "last-known good revision"
     140        tool.irc().post("%s: Rolling Chromium DEPS to %s" % (nick, roll_target))
     141
     142        try:
     143            bug_id = sheriff.post_chromium_deps_roll(revision)
     144            bug_url = tool.bugs.bug_url_for_bug_id(bug_id)
     145            tool.irc().post("%s: Created DEPS roll: %s" % (nick, bug_url))
     146        except ScriptError, e:
     147            match = re.search(r"Current Chromium DEPS revision \d+ is newer than \d+\.", e.output)
     148            if match:
     149                tool.irc().post("%s: %s" % (nick, match.group(0)))
     150                return
     151            tool.irc().post("%s: Failed to create DEPS roll:" % nick)
     152            _post_error_and_check_for_bug_url(tool, nick, e)
    119153
    120154
     
    187221    "whois": Whois,
    188222    "create-bug": CreateBug,
     223    "roll-chromium-deps": RollChromiumDEPS,
    189224}
  • trunk/Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py

    r89480 r90507  
    2929import unittest
    3030
     31from webkitpy.common.system.outputcapture import OutputCapture
    3132from webkitpy.tool.bot.irc_command import *
    3233from webkitpy.tool.mocktool import MockTool
     
    7172                          create_bug.execute("tom", example_args, tool, None))
    7273
     74    def test_roll_chromium_deps(self):
     75        roll = RollChromiumDEPS()
     76        self.assertEquals(None, roll._parse_args([]))
     77        self.assertEquals("1234", roll._parse_args(["1234"]))
     78
    7379    def test_rollout(self):
    7480        rollout = Rollout()
  • trunk/Tools/Scripts/webkitpy/tool/bot/sheriff.py

    r89480 r90507  
    9090        return parse_bug_id(output)
    9191
     92    def post_chromium_deps_roll(self, revision):
     93        args = [
     94            "post-chromium-deps-roll",
     95            "--force-clean",
     96            "--non-interactive",
     97            "--parent-command=sheriff-bot",
     98        ]
     99        if revision:
     100            args += [revision]
     101        output = self._sheriffbot.run_webkit_patch(args)
     102        return parse_bug_id(output)
     103
    92104    def post_blame_comment_on_bug(self, commit_info, builders, tests):
    93105        if not commit_info.bug_id():
  • trunk/Tools/Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py

    r89618 r90507  
    8383
    8484    def test_help(self):
    85         expected_stderr = "MOCK: irc.post: mock_nick: Available commands: whois, create-bug, hi, last-green-revision, rollout, restart, help\n"
     85        expected_stderr = "MOCK: irc.post: mock_nick: Available commands: hi, help, last-green-revision, rollout, roll-chromium-deps, create-bug, restart, whois\n"
    8686        OutputCapture().assert_outputs(self, run, args=["help"], expected_stderr=expected_stderr)
    8787
     
    9797        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"
    9898        OutputCapture().assert_outputs(self, run, args=["rollout 21654 This patch broke the world"], expected_stderr=expected_stderr)
     99
     100    def test_roll_chromium_deps(self):
     101        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"
     102        OutputCapture().assert_outputs(self, run, args=["roll-chromium-deps 21654"], expected_stderr=expected_stderr)
     103
     104    def test_roll_chromium_deps_to_lkgr(self):
     105        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"
     106        OutputCapture().assert_outputs(self, run, args=["roll-chromium-deps"], expected_stderr=expected_stderr)
    99107
    100108    def test_multi_rollout(self):
  • trunk/Tools/Scripts/webkitpy/tool/commands/roll.py

    r77913 r90507  
    4747            "chromium_revision": (args and args[0]),
    4848        }
     49
     50
     51class PostChromiumDEPSRoll(AbstractSequencedCommand):
     52    name = "post-chromium-deps-roll"
     53    help_text = "Posts a patch to update Chromium DEPS (defaults to the last-known good revision of Chromium)"
     54    argument_names = "[CHROMIUM_REVISION]"
     55    steps = [
     56        steps.CleanWorkingDirectory,
     57        steps.Update,
     58        steps.UpdateChromiumDEPS,
     59        steps.PrepareChangeLogForDEPSRoll,
     60        steps.CreateBug,
     61        steps.PostDiff,
     62    ]
     63
     64    def _prepare_state(self, options, args, tool):
     65        options.review = False
     66        options.request_commit = True
     67
     68        chromium_revision = (args and args[0])
     69        return {
     70            "chromium_revision": chromium_revision,
     71            "bug_title": "Roll Chromium DEPS to r%s" % chromium_revision,
     72            "bug_description": "A DEPS roll a day keeps the build break away.",
     73        }
  • trunk/Tools/Scripts/webkitpy/tool/commands/roll_unittest.py

    r82771 r90507  
    4444
    4545    def test_update_chromium_deps_older_revision(self):
     46        options = MockOptions(non_interactive=False)
    4647        expected_stderr = """Current Chromium DEPS revision 6564 is newer than 5764.
    4748ERROR: Unable to update Chromium DEPS
    4849"""
    49         self.assert_execute_outputs(RollChromiumDEPS(), [5764], expected_stderr=expected_stderr, expected_exception=SystemExit)
     50        self.assert_execute_outputs(RollChromiumDEPS(), [5764], options=options, expected_stderr=expected_stderr, expected_exception=SystemExit)
  • trunk/Tools/Scripts/webkitpy/tool/steps/updatechromiumdeps.py

    r76926 r90507  
    3636
    3737class UpdateChromiumDEPS(AbstractStep):
     38    @classmethod
     39    def options(cls):
     40        return AbstractStep.options() + [
     41            Options.non_interactive,
     42        ]
     43
    3844    # Notice that this method throws lots of exciting exceptions!
    3945    def _fetch_last_known_good_revision(self):
     
    4248    def _validate_revisions(self, current_chromium_revision, new_chromium_revision):
    4349        if new_chromium_revision < current_chromium_revision:
    44             log("Current Chromium DEPS revision %s is newer than %s." % (current_chromium_revision, new_chromium_revision))
     50            message = "Current Chromium DEPS revision %s is newer than %s." % (current_chromium_revision, new_chromium_revision)
     51            if self._options.non_interactive:
     52                error(message)  # Causes the process to terminate.
     53            log(message)
    4554            new_chromium_revision = self._tool.user.prompt("Enter new chromium revision (enter nothing to cancel):\n")
    4655            try:
Note: See TracChangeset for help on using the changeset viewer.