[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

abarth at webkit.org abarth at webkit.org
Thu Apr 8 00:28:55 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit aa7831f9d711f72edb6deb104c5f25b55b156bc3
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 9 09:24:40 2009 +0000

    2009-12-09  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            [bzt] Convert Build to use Sequence
            https://bugs.webkit.org/show_bug.cgi?id=32310
    
            So much prettier.
    
            * Scripts/modules/buildsteps.py:
            * Scripts/modules/commands/download.py:
            * Scripts/modules/landingsequence.py:
            * Scripts/modules/stepsequence.py: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51893 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 0d4c9ec..1c42711 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,5 +1,19 @@
 2009-12-09  Adam Barth  <abarth at webkit.org>
 
+        Reviewed by Eric Seidel.
+
+        [bzt] Convert Build to use Sequence
+        https://bugs.webkit.org/show_bug.cgi?id=32310
+
+        So much prettier.
+
+        * Scripts/modules/buildsteps.py:
+        * Scripts/modules/commands/download.py:
+        * Scripts/modules/landingsequence.py:
+        * Scripts/modules/stepsequence.py: Added.
+
+2009-12-09  Adam Barth  <abarth at webkit.org>
+
         Add missing file.
 
         * Scripts/modules/executive.py: Added.
diff --git a/WebKitTools/Scripts/modules/buildsteps.py b/WebKitTools/Scripts/modules/buildsteps.py
index 956f2ea..8342562 100644
--- a/WebKitTools/Scripts/modules/buildsteps.py
+++ b/WebKitTools/Scripts/modules/buildsteps.py
@@ -50,9 +50,10 @@ class CommandOptions(object):
 
 
 class AbstractStep(object):
-    def __init__(self, tool, options):
+    def __init__(self, tool, options, patch=None):
         self._tool = tool
         self._options = options
+        self._patch = patch
         self._port = None
 
     def _run_script(self, script_name, quiet=False, port=WebKitPort):
@@ -74,20 +75,14 @@ class AbstractStep(object):
         raise NotImplementedError, "subclasses must implement"
 
 
-class AbstractPatchStep(AbstractStep):
-    def __init__(self, tool, options, patch):
-        AbstractStep.__init__(self, tool, options)
-        self._patch = patch
-
-
 class PrepareChangelogStep(AbstractStep):
     def run(self):
         self._run_script("prepare-ChangeLog")
 
 
 class CleanWorkingDirectoryStep(AbstractStep):
-    def __init__(self, tool, options, allow_local_commits=False):
-        AbstractStep.__init__(self, tool, options)
+    def __init__(self, tool, options, patch=None, allow_local_commits=False):
+        AbstractStep.__init__(self, tool, options, patch)
         self._allow_local_commits = allow_local_commits
 
     @classmethod
@@ -98,7 +93,7 @@ class CleanWorkingDirectoryStep(AbstractStep):
         ]
 
     def run(self):
-        os.chdir(self._tool._scm.checkout_root)
+        os.chdir(self._tool.scm().checkout_root)
         if not self._allow_local_commits:
             self._tool.scm().ensure_no_local_commits(self._options.force_clean)
         if self._options.clean:
@@ -120,7 +115,7 @@ class UpdateStep(AbstractStep):
         self._tool.executive.run_and_throw_if_fail(self.port().update_webkit_command())
 
 
-class ApplyPatchStep(AbstractPatchStep):
+class ApplyPatchStep(AbstractStep):
     @classmethod
     def options(cls):
         return [
@@ -197,13 +192,13 @@ class CommitStep(AbstractStep):
         return self._tool.scm().commit_with_message(commit_message.message())
 
 
-class ClosePatchStep(AbstractPatchStep):
+class ClosePatchStep(AbstractStep):
     def run(self, commit_log):
         comment_text = bug_comment_from_commit_text(self._tool.scm(), commit_log)
         self._tool.bugs.clear_attachment_flags(self._patch["id"], comment_text)
 
 
-class CloseBugStep(AbstractPatchStep):
+class CloseBugStep(AbstractStep):
     @classmethod
     def options(cls):
         return [
diff --git a/WebKitTools/Scripts/modules/commands/download.py b/WebKitTools/Scripts/modules/commands/download.py
index 2e39899..d53a8ff 100644
--- a/WebKitTools/Scripts/modules/commands/download.py
+++ b/WebKitTools/Scripts/modules/commands/download.py
@@ -33,7 +33,7 @@ import os
 from optparse import make_option
 
 from modules.bugzilla import parse_bug_id
-from modules.buildsteps import BuildSteps, EnsureBuildersAreGreenStep, CleanWorkingDirectoryStep, UpdateStep, CheckStyleStep, PrepareChangelogStep, CleanWorkingDirectoryStep
+from modules.buildsteps import BuildSteps, EnsureBuildersAreGreenStep, CleanWorkingDirectoryStep, UpdateStep, BuildStep, CheckStyleStep, PrepareChangelogStep
 from modules.changelogs import ChangeLog
 from modules.comments import bug_comment_from_commit_text
 from modules.grammar import pluralize
@@ -41,27 +41,22 @@ from modules.landingsequence import LandingSequence
 from modules.logging import error, log
 from modules.multicommandtool import Command
 from modules.processutils import ScriptError
-
-
-class BuildSequence(LandingSequence):
-    def run(self):
-        self.clean()
-        self.update()
-        self.build()
+from modules.stepsequence import StepSequence
 
 
 class Build(Command):
     name = "build"
     show_in_main_help = False
     def __init__(self):
-        options = BuildSteps.cleaning_options()
-        options += BuildSteps.build_options()
-        options += BuildSteps.land_options()
-        Command.__init__(self, "Update working copy and build", "", options)
+        self._sequence = StepSequence([
+            CleanWorkingDirectoryStep,
+            UpdateStep,
+            BuildStep
+        ])
+        Command.__init__(self, "Update working copy and build", "", self._sequence.options())
 
     def execute(self, options, args, tool):
-        sequence = BuildSequence(None, options, tool)
-        sequence.run_and_handle_errors()
+        self._sequence.run_and_handle_errors(tool, options)
 
 
 class ApplyAttachment(Command):
diff --git a/WebKitTools/Scripts/modules/landingsequence.py b/WebKitTools/Scripts/modules/landingsequence.py
index 4f03260..90683f4 100644
--- a/WebKitTools/Scripts/modules/landingsequence.py
+++ b/WebKitTools/Scripts/modules/landingsequence.py
@@ -42,7 +42,7 @@ class LandingSequenceErrorHandler():
     def handle_script_error(cls, tool, patch, script_error):
         raise NotImplementedError, "subclasses must implement"
 
-
+# FIXME: This class is slowing being killed and replaced with StepSequence.
 class LandingSequence:
     def __init__(self, patch, options, tool):
         self._patch = patch
diff --git a/WebKitTools/Scripts/modules/stepsequence.py b/WebKitTools/Scripts/modules/stepsequence.py
new file mode 100644
index 0000000..65bc424
--- /dev/null
+++ b/WebKitTools/Scripts/modules/stepsequence.py
@@ -0,0 +1,65 @@
+# Copyright (C) 2009 Google 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.
+
+from modules.buildsteps import CommandOptions
+from modules.executive import ScriptError
+from modules.logging import log
+from modules.scm import CheckoutNeedsUpdate
+from modules.workqueue import WorkQueue
+
+
+class StepSequence(object):
+    def __init__(self, steps):
+        self._steps = steps
+
+    def options(self):
+        collected_options = [CommandOptions.parent_command]
+        for step in self._steps:
+            collected_options = collected_options + step.options()
+        # Remove duplicates.
+        collected_options = sorted(set(collected_options))
+        return collected_options
+
+    def _run(self, tool, options, patch):
+        for step in self._steps:
+            step(tool, options, patch).run()
+
+    def run_and_handle_errors(self, tool, options, patch=None):
+        try:
+            self._run(tool, options, patch)
+        except CheckoutNeedsUpdate, e:
+            log("Commit failed because the checkout is out of date.  Please update and try again.")
+            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:
+            if not options.quiet:
+                log(e.message_with_output())
+            if options.parent_command:
+                command = tool.command_by_name(options.parent_command)
+                command.handle_script_error(tool, patch, e)
+            WorkQueue.exit_after_handled_error(e)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list