2009-11-26 Adam Barth <abarth@webkit.org>
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Nov 2009 07:56:51 +0000 (07:56 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Nov 2009 07:56:51 +0000 (07:56 +0000)
        Reviewed by Eric Seidel.

        [bzt] Kill WebKitLandingScripts
        https://bugs.webkit.org/show_bug.cgi?id=31904

        Step 5: Kill run_and_throw_if_fail.

        * Scripts/modules/buildsteps.py:
        * Scripts/modules/processutils.py: Added.
        * Scripts/modules/webkitlandingscripts.py:

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

WebKitTools/ChangeLog
WebKitTools/Scripts/modules/buildsteps.py
WebKitTools/Scripts/modules/commands/queues.py
WebKitTools/Scripts/modules/processutils.py [new file with mode: 0644]
WebKitTools/Scripts/modules/webkitlandingscripts.py

index dc007189d302817388cbebfc0834b9b871471981..81ff87f92318e59344b86b9ef99e59d255fc8d90 100644 (file)
@@ -1,3 +1,16 @@
+2009-11-26  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        [bzt] Kill WebKitLandingScripts
+        https://bugs.webkit.org/show_bug.cgi?id=31904
+
+        Step 5: Kill run_and_throw_if_fail.
+
+        * Scripts/modules/buildsteps.py:
+        * Scripts/modules/processutils.py: Added.
+        * Scripts/modules/webkitlandingscripts.py:
+
 2009-11-26  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Eric Seidel.
index 13a5777317b4a47454cf9367b3de6b6020a7b702..07dc63d3b6482ff2be7bddc078947f5bdac87d02 100644 (file)
 import os
 
 from modules.logging import log, error
+from modules.processutils import run_and_throw_if_fail
 from modules.webkitlandingscripts import WebKitLandingScripts
 from modules.webkitport import WebKitPort
 
 class BuildSteps:
     def _run_script(cls, script_name, quiet=False, port=WebKitPort):
         log("Running %s" % script_name)
-        WebKitLandingScripts.run_and_throw_if_fail(port.script_path(script_name), quiet)
+        run_and_throw_if_fail(port.script_path(script_name), quiet)
 
     def prepare_changelog(self):
         self.run_script("prepare-ChangeLog")
@@ -55,7 +56,7 @@ class BuildSteps:
             args.append("--quiet")
         if fail_fast:
             args.append("--exit-after-n-failures=1")
-        WebKitLandingScripts.run_and_throw_if_fail(args)
+        run_and_throw_if_fail(args)
 
     def ensure_builders_are_green(self, buildbot, options):
         if not options.check_builders or buildbot.core_builders_are_green():
@@ -64,7 +65,7 @@ class BuildSteps:
 
     def build_webkit(self, quiet=False, port=WebKitPort):
         log("Building WebKit")
-        WebKitLandingScripts.run_and_throw_if_fail(port.build_webkit_command(), quiet)
+        run_and_throw_if_fail(port.build_webkit_command(), quiet)
 
     def check_style(self):
         self._run_script("check-webkit-style")
index 27c4be8f11a62421f2bd679a94ad63a45a3ecd7f..1f02e61d9e3107200a802a0a4b8a0b2847b74811 100644 (file)
@@ -48,9 +48,9 @@ from modules.landingsequence import LandingSequence, ConditionalLandingSequence
 from modules.logging import error, log, tee
 from modules.multicommandtool import MultiCommandTool, Command
 from modules.patchcollection import PatchCollection
+from modules.processutils import run_and_throw_if_fail
 from modules.scm import CommitMessage, detect_scm_system, ScriptError, CheckoutNeedsUpdate
 from modules.statusbot import StatusBot
-from modules.webkitlandingscripts import WebKitLandingScripts, commit_message_for_this_commit
 from modules.webkitport import WebKitPort
 from modules.workqueue import WorkQueue, WorkQueueDelegate
 
@@ -96,7 +96,7 @@ class AbstractQueue(Command, WorkQueueDelegate):
 
     def run_bugzilla_tool(self, args):
         bugzilla_tool_args = [self.tool.path()] + args
-        WebKitLandingScripts.run_and_throw_if_fail(bugzilla_tool_args)
+        run_and_throw_if_fail(bugzilla_tool_args)
 
     def log_progress(self, patch_ids):
         log("%s in %s [%s]" % (pluralize("patch", len(patch_ids)), self.name, ", ".join(patch_ids)))
diff --git a/WebKitTools/Scripts/modules/processutils.py b/WebKitTools/Scripts/modules/processutils.py
new file mode 100644 (file)
index 0000000..68cf215
--- /dev/null
@@ -0,0 +1,63 @@
+# Copyright (c) 2009, Google Inc. All rights reserved.
+# Copyright (c) 2009 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# 
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os
+import StringIO
+import subprocess
+import sys
+
+from modules.logging import tee
+from modules.scm import ScriptError
+
+def run_command_with_teed_output(args, teed_output):
+    child_process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+
+    # Use our own custom wait loop because Popen ignores a tee'd stderr/stdout.
+    # FIXME: This could be improved not to flatten output to stdout.
+    while True:
+        output_line = child_process.stdout.readline()
+        if output_line == "" and child_process.poll() != None:
+            return child_process.poll()
+        teed_output.write(output_line)
+
+def run_and_throw_if_fail(args, quiet=False):
+    # Cache the child's output locally so it can be used for error reports.
+    child_out_file = StringIO.StringIO()
+    if quiet:
+        dev_null = open(os.devnull, "w")
+    child_stdout = tee(child_out_file, dev_null if quiet else sys.stdout)
+    exit_code = run_command_with_teed_output(args, child_stdout)
+    if quiet:
+        dev_null.close()
+
+    child_output = child_out_file.getvalue()
+    child_out_file.close()
+
+    if exit_code:
+        raise ScriptError(script_args=args, exit_code=exit_code, output=child_output)
index 24935932d06cb3b20383b49aab1fe325e441ba68..96aa47bff0602bd89853f15aef26400a070a6b15 100644 (file)
@@ -84,34 +84,6 @@ class WebKitLandingScripts:
             make_option("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing."),
         ]
 
-    @staticmethod
-    def run_command_with_teed_output(args, teed_output):
-        child_process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-
-        # Use our own custom wait loop because Popen ignores a tee'd stderr/stdout.
-        # FIXME: This could be improved not to flatten output to stdout.
-        while True:
-            output_line = child_process.stdout.readline()
-            if output_line == "" and child_process.poll() != None:
-                return child_process.poll()
-            teed_output.write(output_line)
-
-    @staticmethod
-    def run_and_throw_if_fail(args, quiet=False):
-        # Cache the child's output locally so it can be used for error reports.
-        child_out_file = StringIO.StringIO()
-        if quiet:
-            dev_null = open(os.devnull, "w")
-        child_stdout = tee(child_out_file, dev_null if quiet else sys.stdout)
-        exit_code = WebKitLandingScripts.run_command_with_teed_output(args, child_stdout)
-        if quiet:
-            dev_null.close()
-
-        child_output = child_out_file.getvalue()
-        child_out_file.close()
-
-        if exit_code:
-            raise ScriptError(script_args=args, exit_code=exit_code, output=child_output)