2009-11-20 Adam Barth <abarth@webkit.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Nov 2009 18:57:50 +0000 (18:57 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Nov 2009 18:57:50 +0000 (18:57 +0000)
        Reviewed by Eric Seidel.

        Implement bugzilla-tool build-attachment
        https://bugs.webkit.org/show_bug.cgi?id=31722

        This command builds an attachment from bugzilla.  It leaves the built
        patch in the working copy.

        * Scripts/bugzilla-tool:
        * Scripts/modules/landingsequence.py:
        * Scripts/modules/webkitlandingscripts.py:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51243 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/Scripts/bugzilla-tool
WebKitTools/Scripts/modules/landingsequence.py
WebKitTools/Scripts/modules/webkitlandingscripts.py

index 9bbbbff3ee8d6cd3fb76fa733cc9d32e4f936728..ac1e16ef5bf5a29ba8cd2038c3a4a6bda9196ca1 100644 (file)
@@ -1,3 +1,17 @@
+2009-11-20  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        Implement bugzilla-tool build-attachment
+        https://bugs.webkit.org/show_bug.cgi?id=31722
+
+        This command builds an attachment from bugzilla.  It leaves the built
+        patch in the working copy.
+
+        * Scripts/bugzilla-tool:
+        * Scripts/modules/landingsequence.py:
+        * Scripts/modules/webkitlandingscripts.py:
+
 2009-11-20  Alejandro G. Castro  <alex@igalia.com>
 
         Reviewed by Xan Lopez.
index 6cfecbe4a223f018301f63e41b40cc1a40ac14b4..922595a867c1db0427602995de9e27b0ec646f62 100755 (executable)
@@ -45,7 +45,7 @@ from modules.comments import bug_comment_from_commit_text
 from modules.bugzilla import Bugzilla, parse_bug_id
 from modules.buildbot import BuildBot
 from modules.changelogs import ChangeLog
-from modules.landingsequence import ConditionalLandingSequence
+from modules.landingsequence import LandingSequence, ConditionalLandingSequence
 from modules.logging import error, log, tee
 from modules.multicommandtool import MultiCommandTool, Command
 from modules.patchcollection import PatchCollection
@@ -186,7 +186,7 @@ class WebKitApplyingScripts:
                 scm.commit_locally_with_message(commit_message.message() or patch["name"])
 
 
-class LandDiffLandingSequence(ConditionalLandingSequence):
+class LandDiffSequence(ConditionalLandingSequence):
     def __init__(self, patch, options, tool):
         ConditionalLandingSequence.__init__(self, patch, options, tool)
 
@@ -221,6 +221,7 @@ class LandDiff(Command):
         options = [
             make_option("-r", "--reviewer", action="store", type="string", dest="reviewer", help="Update ChangeLogs to say Reviewed by REVIEWER."),
         ]
+        options += WebKitLandingScripts.build_options()
         options += WebKitLandingScripts.land_options()
         Command.__init__(self, "Lands the current working directory diff and updates the bug if provided.", "[BUGID]", options=options)
 
@@ -261,7 +262,7 @@ class LandDiff(Command):
             "bug_id": bug_id
         }
 
-        sequence = LandDiffLandingSequence(fake_patch, options, tool)
+        sequence = LandDiffSequence(fake_patch, options, tool)
         sequence.run()
 
 
@@ -298,9 +299,41 @@ class AbstractPatchProcessingCommand(Command):
             self._process_patch(patch, options, args, tool)
 
 
+class BuildAttachmentSequence(LandingSequence):
+    def __init__(self, patch, options, tool):
+        LandingSequence.__init__(self, patch, options, tool)
+
+    def run(self):
+        self.update()
+        self.apply_patch()
+        self.build()
+
+
+class BuildAttachment(AbstractPatchProcessingCommand):
+    name = "build-attachment"
+    def __init__(self):
+        options = WebKitLandingScripts.cleaning_options()
+        options += WebKitLandingScripts.build_options()
+        AbstractPatchProcessingCommand.__init__(self, "Builds patches from bugzilla", "ATTACHMENT_ID [ATTACHMENT_IDS]", options)
+
+    def _fetch_list_of_patches_to_process(self, options, args, tool):
+        return map(lambda patch_id: tool.bugs.fetch_attachment(patch_id), args)
+
+    def _prepare_to_process(self, options, args, tool):
+        # Check the tree status first so we can fail early.
+        WebKitLandingScripts.ensure_builders_are_green(tool.buildbot, options)
+        WebKitLandingScripts.prepare_clean_working_directory(tool.scm(), options)
+
+    def _process_patch(self, patch, options, args, tool):
+        sequence = BuildAttachmentSequence(patch, options, tool)
+        sequence.run_and_handle_errors()
+
+
 class AbstractPatchLandingCommand(AbstractPatchProcessingCommand):
     def __init__(self, help_text, args_description):
-        options = WebKitLandingScripts.cleaning_options() + WebKitLandingScripts.land_options()
+        options = WebKitLandingScripts.cleaning_options()
+        options += WebKitLandingScripts.build_options()
+        options += WebKitLandingScripts.land_options()
         AbstractPatchProcessingCommand.__init__(self, help_text, args_description, options)
 
     def _prepare_to_process(self, options, args, tool):
@@ -315,7 +348,7 @@ class AbstractPatchLandingCommand(AbstractPatchProcessingCommand):
 class LandAttachment(AbstractPatchLandingCommand):
     name = "land-attachment"
     def __init__(self):
-        AbstractPatchLandingCommand.__init__(self, "Lands patches from bugzilla, optionally building and testing them first", "ATTACHMENT_ID [ATTACHMENT_IDS]")
+        AbstractPatchLandingCommand.__init__(self, "Lands patches from bugzilla, optionally building and testing them first", "ATTACHMENT_ID [ATTACHMENT_IDS]")
 
     def _fetch_list_of_patches_to_process(self, options, args, tool):
         return map(lambda patch_id: tool.bugs.fetch_attachment(patch_id), args)
@@ -453,8 +486,9 @@ class PostCommits(Command):
 class Rollout(Command):
     name = "rollout"
     def __init__(self):
-        options = WebKitLandingScripts.land_options()
-        options += WebKitLandingScripts.cleaning_options()
+        options = WebKitLandingScripts.cleaning_options()
+        options += WebKitLandingScripts.build_options()
+        options += WebKitLandingScripts.land_options()
         options.append(make_option("--complete-rollout", action="store_true", dest="complete_rollout", help="Experimental support for complete unsupervised rollouts, including re-opening the bug.  Not recommended."))
         Command.__init__(self, "Reverts the given revision and commits the revert and re-opens the original bug.", "REVISION [BUGID]", options=options)
 
index 3e9e4f7d680cab7e05cf3a6d5b8f2151df8f2e7e..7264ca376e2b2a3f70ec849182821b0b04ef864d 100644 (file)
@@ -59,8 +59,11 @@ class LandingSequence:
             log("You can pass --no-build to skip building/testing after update if you believe the new commits did not affect the results.")
             WorkQueue.exit_after_handled_error(e)
         except ScriptError, e:
-            # Mark the patch as commit-queue- and comment in the bug.
-            self._tool.bugs.reject_patch_from_commit_queue(self._patch["id"], e.message_with_output())
+            if not self._options.quiet:
+                log(e.message_with_output())
+            if self._options.non_interactive:
+                # Mark the patch as commit-queue- and comment in the bug.
+                self._tool.bugs.reject_patch_from_commit_queue(self._patch["id"], e.message_with_output())
             WorkQueue.exit_after_handled_error(e)
 
     def update(self):
index bfca90a19bb536633b92addda99cd1aa603cc2e1..87bcc4d4dacf2266cc7c1172b95f7c58143305ec 100644 (file)
@@ -68,16 +68,21 @@ class WebKitLandingScripts:
         ]
 
     @staticmethod
-    def land_options():
+    def build_options():
         return [
             make_option("--ignore-builders", action="store_false", dest="check_builders", default=True, help="Don't check to see if the build.webkit.org builders are green before landing."),
-            make_option("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing."),
-            make_option("--no-build", action="store_false", dest="build", default=True, help="Commit without building first, implies --no-test."),
-            make_option("--no-test", action="store_false", dest="test", default=True, help="Commit without running run-webkit-tests."),
             make_option("--quiet", action="store_true", dest="quiet", default=False, help="Produce less console output."),
             make_option("--non-interactive", action="store_true", dest="non_interactive", default=False, help="Never prompt the user, fail as fast as possible."),
         ] + WebKitPort.port_options()
 
+    @staticmethod
+    def land_options():
+        return [
+            make_option("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing."),
+            make_option("--no-build", action="store_false", dest="build", default=True, help="Commit without building first, implies --no-test."),
+            make_option("--no-test", action="store_false", dest="test", default=True, help="Commit without running run-webkit-tests."),
+        ]
+
     @staticmethod
     def run_command_with_teed_output(args, teed_output):
         child_process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)