[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
abarth at webkit.org
abarth at webkit.org
Tue Jan 5 23:45:37 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 2271578d1cdf47b1b28cfb51b229dc98b8b93224
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 9 08:20:57 2009 +0000
2009-12-09 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
[bzt] Implement abstract Steps
https://bugs.webkit.org/show_bug.cgi?id=32212
This is a fairly disruptive change that refactors how we build
commands. Instead of using a landing sequence, we can now assemble a
sequence of steps directly. We still use the landing sequence in the
interim, but this will be removed soon.
* Scripts/bugzilla-tool:
* Scripts/modules/buildsteps.py:
* Scripts/modules/commands/download.py:
* Scripts/modules/commands/early_warning_system.py:
* Scripts/modules/commands/queues.py:
* Scripts/modules/commands/queues_unittest.py:
* Scripts/modules/landingsequence.py:
* Scripts/modules/mock_bugzillatool.py:
* Scripts/modules/processutils.py: Removed.
* Scripts/modules/scm.py:
* Scripts/modules/scm_unittest.py:
* Scripts/modules/webkitport.py:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51889 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index b6931df..652df1c 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,28 @@
+2009-12-09 Adam Barth <abarth at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ [bzt] Implement abstract Steps
+ https://bugs.webkit.org/show_bug.cgi?id=32212
+
+ This is a fairly disruptive change that refactors how we build
+ commands. Instead of using a landing sequence, we can now assemble a
+ sequence of steps directly. We still use the landing sequence in the
+ interim, but this will be removed soon.
+
+ * Scripts/bugzilla-tool:
+ * Scripts/modules/buildsteps.py:
+ * Scripts/modules/commands/download.py:
+ * Scripts/modules/commands/early_warning_system.py:
+ * Scripts/modules/commands/queues.py:
+ * Scripts/modules/commands/queues_unittest.py:
+ * Scripts/modules/landingsequence.py:
+ * Scripts/modules/mock_bugzillatool.py:
+ * Scripts/modules/processutils.py: Removed.
+ * Scripts/modules/scm.py:
+ * Scripts/modules/scm_unittest.py:
+ * Scripts/modules/webkitport.py:
+
2009-12-08 Eric Seidel <eric at webkit.org>
Reviewed by Adam Barth.
diff --git a/WebKitTools/Scripts/bugzilla-tool b/WebKitTools/Scripts/bugzilla-tool
index e0f56cb..fdbb740 100755
--- a/WebKitTools/Scripts/bugzilla-tool
+++ b/WebKitTools/Scripts/bugzilla-tool
@@ -40,6 +40,7 @@ from modules.commands.early_warning_system import *
from modules.commands.queries import *
from modules.commands.queues import *
from modules.commands.upload import *
+from modules.executive import Executive
from modules.logging import log
from modules.multicommandtool import MultiCommandTool
from modules.scm import detect_scm_system
@@ -51,6 +52,7 @@ class BugzillaTool(MultiCommandTool):
self.bugs = Bugzilla()
self.buildbot = BuildBot()
+ self.executive = Executive()
self._scm = None
self._status = None
self.steps = BuildSteps()
diff --git a/WebKitTools/Scripts/modules/buildsteps.py b/WebKitTools/Scripts/modules/buildsteps.py
index c566401..956f2ea 100644
--- a/WebKitTools/Scripts/modules/buildsteps.py
+++ b/WebKitTools/Scripts/modules/buildsteps.py
@@ -30,75 +30,227 @@ import os
from optparse import make_option
+from modules.comments import bug_comment_from_commit_text
from modules.logging import log, error
-from modules.processutils import run_and_throw_if_fail
from modules.webkitport import WebKitPort
-class BuildSteps:
- # FIXME: The options should really live on each "Step" object.
- @staticmethod
- def cleaning_options():
+
+class CommandOptions(object):
+ force_clean = make_option("--force-clean", action="store_true", dest="force_clean", default=False, help="Clean working directory before applying patches (removes local changes and commits)")
+ clean = make_option("--no-clean", action="store_false", dest="clean", default=True, help="Don't check if the working directory is clean before applying patches")
+ check_builders = 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.")
+ quiet = make_option("--quiet", action="store_true", dest="quiet", default=False, help="Produce less console output.")
+ non_interactive = make_option("--non-interactive", action="store_true", dest="non_interactive", default=False, help="Never prompt the user, fail as fast as possible.")
+ parent_command = make_option("--parent-command", action="store", dest="parent_command", default=None, help="(Internal) The command that spawned this instance.")
+ update = make_option("--no-update", action="store_false", dest="update", default=True, help="Don't update the working directory.")
+ build = make_option("--no-build", action="store_false", dest="build", default=True, help="Commit without building first, implies --no-test.")
+ test = make_option("--no-test", action="store_false", dest="test", default=True, help="Commit without running run-webkit-tests.")
+ close_bug = make_option("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing.")
+ port = make_option("--port", action="store", dest="port", default=None, help="Specify a port (e.g., mac, qt, gtk, ...).")
+
+
+class AbstractStep(object):
+ def __init__(self, tool, options):
+ self._tool = tool
+ self._options = options
+ self._port = None
+
+ def _run_script(self, script_name, quiet=False, port=WebKitPort):
+ log("Running %s" % script_name)
+ self._tool.executive.run_and_throw_if_fail(port.script_path(script_name), quiet)
+
+ # FIXME: The port should live on the tool.
+ def port(self):
+ if self._port:
+ return self._port
+ self._port = WebKitPort.port(self._options.port)
+ return self._port
+
+ @classmethod
+ def options(cls):
+ return []
+
+ def run(self, tool):
+ 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)
+ self._allow_local_commits = allow_local_commits
+
+ @classmethod
+ def options(cls):
return [
- make_option("--force-clean", action="store_true", dest="force_clean", default=False, help="Clean working directory before applying patches (removes local changes and commits)"),
- make_option("--no-clean", action="store_false", dest="clean", default=True, help="Don't check if the working directory is clean before applying patches"),
+ CommandOptions.force_clean,
+ CommandOptions.clean,
]
- # FIXME: These distinctions are bogus. We need a better model for handling options.
- @staticmethod
- def build_options():
+ def run(self):
+ 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:
+ self._tool.scm().ensure_clean_working_directory(force_clean=self._options.force_clean)
+
+
+class UpdateStep(AbstractStep):
+ @classmethod
+ def options(cls):
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("--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."),
- make_option("--parent-command", action="store", dest="parent_command", default=None, help="(Internal) The command that spawned this instance."),
- ] + WebKitPort.port_options()
+ CommandOptions.update,
+ CommandOptions.port,
+ ]
- @staticmethod
- def land_options():
+ def run(self):
+ if not self._options.update:
+ return
+ log("Updating working directory")
+ self._tool.executive.run_and_throw_if_fail(self.port().update_webkit_command())
+
+
+class ApplyPatchStep(AbstractPatchStep):
+ @classmethod
+ def options(cls):
return [
- make_option("--no-update", action="store_false", dest="update", default=True, help="Don't update the working directory."),
- 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("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing."),
+ CommandOptions.non_interactive,
]
- def _run_script(cls, script_name, quiet=False, port=WebKitPort):
- log("Running %s" % script_name)
- run_and_throw_if_fail(port.script_path(script_name), quiet)
+ def run(self):
+ log("Processing patch %s from bug %s." % (self._patch["id"], self._patch["bug_id"]))
+ self._tool.scm().apply_patch(self._patch, force=self._options.non_interactive)
- def prepare_changelog(self):
- self.run_script("prepare-ChangeLog")
- def clean_working_directory(self, scm, options, allow_local_commits=False):
- os.chdir(scm.checkout_root)
- if not allow_local_commits:
- scm.ensure_no_local_commits(options.force_clean)
- if options.clean:
- scm.ensure_clean_working_directory(force_clean=options.force_clean)
+class EnsureBuildersAreGreenStep(AbstractStep):
+ @classmethod
+ def options(cls):
+ return [
+ CommandOptions.check_builders,
+ ]
- def update(self, port=WebKitPort):
- log("Updating working directory")
- run_and_throw_if_fail(port.update_webkit_command())
+ def run(self):
+ if not self._options.check_builders:
+ return
+ if not self._tool.buildbot.core_builders_are_green():
+ error("Builders at %s are red, please do not commit. Pass --ignore-builders to bypass this check." % (self._tool.buildbot.buildbot_host))
- def run_tests(self, launch_safari, fail_fast=False, quiet=False, port=WebKitPort):
- args = port.run_webkit_tests_command()
- if not launch_safari:
+
+class BuildStep(AbstractStep):
+ @classmethod
+ def options(cls):
+ return [
+ CommandOptions.build,
+ CommandOptions.quiet,
+ ]
+
+ def run(self):
+ if not self._options.build:
+ return
+ log("Building WebKit")
+ self._tool.executive.run_and_throw_if_fail(self.port().build_webkit_command(), self._options.quiet)
+
+
+class CheckStyleStep(AbstractStep):
+ def run(self):
+ self._run_script("check-webkit-style")
+
+
+class RunTestsStep(AbstractStep):
+ @classmethod
+ def options(cls):
+ return [
+ CommandOptions.build,
+ CommandOptions.test,
+ CommandOptions.non_interactive,
+ CommandOptions.quiet,
+ CommandOptions.port,
+ ]
+
+ def run(self):
+ if not self._options.build:
+ return
+ if not self._options.test:
+ return
+ args = self.port().run_webkit_tests_command()
+ if self._options.non_interactive:
args.append("--no-launch-safari")
- if quiet:
- args.append("--quiet")
- if fail_fast:
args.append("--exit-after-n-failures=1")
- run_and_throw_if_fail(args)
+ if self._options.quiet:
+ args.append("--quiet")
+ self._tool.executive.run_and_throw_if_fail(args)
+
+
+class CommitStep(AbstractStep):
+ def run(self):
+ commit_message = self._tool.scm().commit_message_for_this_commit()
+ return self._tool.scm().commit_with_message(commit_message.message())
+
+
+class ClosePatchStep(AbstractPatchStep):
+ 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):
+ @classmethod
+ def options(cls):
+ return [
+ CommandOptions.close_bug,
+ ]
- def ensure_builders_are_green(self, buildbot, options):
- if not options.check_builders or buildbot.core_builders_are_green():
+ def run(self):
+ if not self._options.close_bug:
return
- error("Builders at %s are red, please do not commit. Pass --ignore-builders to bypass this check." % (buildbot.buildbot_host))
+ # Check to make sure there are no r? or r+ patches on the bug before closing.
+ # Assume that r- patches are just previous patches someone forgot to obsolete.
+ patches = self._tool.bugs.fetch_patches_from_bug(self._patch["bug_id"])
+ for patch in patches:
+ review_flag = patch.get("review")
+ if review_flag == "?" or review_flag == "+":
+ log("Not closing bug %s as attachment %s has review=%s. Assuming there are more patches to land from this bug." % (patch["bug_id"], patch["id"], review_flag))
+ return
+ self._tool.bugs.close_bug_as_fixed(self._patch["bug_id"], "All reviewed patches have been landed. Closing bug.")
- def build_webkit(self, quiet=False, port=WebKitPort):
- log("Building WebKit")
- run_and_throw_if_fail(port.build_webkit_command(), quiet)
- def check_style(self):
- self._run_script("check-webkit-style")
+# FIXME: This class is a dinosaur and should be extinct soon.
+class BuildSteps:
+ # FIXME: The options should really live on each "Step" object.
+ @staticmethod
+ def cleaning_options():
+ return [
+ CommandOptions.force_clean,
+ CommandOptions.clean,
+ ]
+
+ # FIXME: These distinctions are bogus. We need a better model for handling options.
+ @staticmethod
+ def build_options():
+ return [
+ CommandOptions.check_builders,
+ CommandOptions.quiet,
+ CommandOptions.non_interactive,
+ CommandOptions.parent_command,
+ CommandOptions.port,
+ ]
+
+ @staticmethod
+ def land_options():
+ return [
+ CommandOptions.update,
+ CommandOptions.build,
+ CommandOptions.test,
+ CommandOptions.close_bug,
+ ]
diff --git a/WebKitTools/Scripts/modules/commands/download.py b/WebKitTools/Scripts/modules/commands/download.py
index 3bfa55f..2e39899 100644
--- a/WebKitTools/Scripts/modules/commands/download.py
+++ b/WebKitTools/Scripts/modules/commands/download.py
@@ -33,20 +33,17 @@ import os
from optparse import make_option
from modules.bugzilla import parse_bug_id
-from modules.buildsteps import BuildSteps
+from modules.buildsteps import BuildSteps, EnsureBuildersAreGreenStep, CleanWorkingDirectoryStep, UpdateStep, CheckStyleStep, PrepareChangelogStep, CleanWorkingDirectoryStep
from modules.changelogs import ChangeLog
from modules.comments import bug_comment_from_commit_text
from modules.grammar import pluralize
-from modules.landingsequence import LandingSequence, ConditionalLandingSequence
+from modules.landingsequence import LandingSequence
from modules.logging import error, log
from modules.multicommandtool import Command
from modules.processutils import ScriptError
-class BuildSequence(ConditionalLandingSequence):
- def __init__(self, options, tool):
- ConditionalLandingSequence.__init__(self, None, options, tool)
-
+class BuildSequence(LandingSequence):
def run(self):
self.clean()
self.update()
@@ -63,7 +60,7 @@ class Build(Command):
Command.__init__(self, "Update working copy and build", "", options)
def execute(self, options, args, tool):
- sequence = BuildSequence(options, tool)
+ sequence = BuildSequence(None, options, tool)
sequence.run_and_handle_errors()
@@ -107,9 +104,10 @@ class WebKitApplyingScripts:
@staticmethod
def setup_for_patch_apply(tool, options):
- tool.steps.clean_working_directory(tool.scm(), options, allow_local_commits=True)
- if options.update:
- tool.steps.update()
+ clean_step = CleanWorkingDirectoryStep(tool, options, allow_local_commits=True)
+ clean_step.run()
+ update_step = UpdateStep(tool, options)
+ update_step.run()
@staticmethod
def apply_patches_with_options(scm, patches, options):
@@ -124,10 +122,7 @@ class WebKitApplyingScripts:
scm.commit_locally_with_message(commit_message.message() or patch["name"])
-class LandDiffSequence(ConditionalLandingSequence):
- def __init__(self, patch, options, tool):
- ConditionalLandingSequence.__init__(self, patch, options, tool)
-
+class LandDiffSequence(LandingSequence):
def run(self):
self.check_builders()
self.build()
@@ -189,7 +184,7 @@ class LandDiff(Command):
def execute(self, options, args, tool):
bug_id = (args and args[0]) or parse_bug_id(tool.scm().create_patch())
- tool.steps.ensure_builders_are_green(tool.buildbot, options)
+ EnsureBuildersAreGreenStep(tool, options).run()
os.chdir(tool.scm().checkout_root)
self.update_changelogs_with_reviewer(options.reviewer, bug_id, tool)
@@ -234,9 +229,6 @@ class AbstractPatchProcessingCommand(Command):
class CheckStyleSequence(LandingSequence):
- def __init__(self, patch, options, tool):
- LandingSequence.__init__(self, patch, options, tool)
-
def run(self):
self.clean()
self.update()
@@ -245,7 +237,8 @@ class CheckStyleSequence(LandingSequence):
def build(self):
# Instead of building, we check style.
- self._tool.steps.check_style()
+ step = CheckStyleStep(self._tool, self._options)
+ step.run()
class CheckStyle(AbstractPatchProcessingCommand):
@@ -267,10 +260,7 @@ class CheckStyle(AbstractPatchProcessingCommand):
sequence.run_and_handle_errors()
-class BuildAttachmentSequence(ConditionalLandingSequence):
- def __init__(self, patch, options, tool):
- LandingSequence.__init__(self, patch, options, tool)
-
+class BuildAttachmentSequence(LandingSequence):
def run(self):
self.clean()
self.update()
@@ -307,10 +297,10 @@ class AbstractPatchLandingCommand(AbstractPatchProcessingCommand):
def _prepare_to_process(self, options, args, tool):
# Check the tree status first so we can fail early.
- tool.steps.ensure_builders_are_green(tool.buildbot, options)
+ EnsureBuildersAreGreenStep(tool, options).run()
def _process_patch(self, patch, options, args, tool):
- sequence = ConditionalLandingSequence(patch, options, tool)
+ sequence = LandingSequence(patch, options, tool)
sequence.run_and_handle_errors()
@@ -358,7 +348,7 @@ class Rollout(Command):
# Second, make new ChangeLog entries for this rollout.
# This could move to prepare-ChangeLog by adding a --revert= option.
- tool.steps.prepare_changelog()
+ PrepareChangelogStep(tool, None).run()
for changelog_path in changelog_paths:
ChangeLog(changelog_path).update_for_revert(revision)
@@ -384,8 +374,8 @@ class Rollout(Command):
else:
log("Failed to parse bug number from diff. No bugs will be updated/reopened after the rollout.")
- tool.steps.clean_working_directory(tool.scm(), options)
- tool.steps.update()
+ CleanWorkingDirectoryStep(tool, options).run()
+ UpdateStep(tool, options).run()
tool.scm().apply_reverse_diff(revision)
self._create_changelogs_for_revert(tool, revision)
diff --git a/WebKitTools/Scripts/modules/commands/early_warning_system.py b/WebKitTools/Scripts/modules/commands/early_warning_system.py
index 75d7378..e8ef408 100644
--- a/WebKitTools/Scripts/modules/commands/early_warning_system.py
+++ b/WebKitTools/Scripts/modules/commands/early_warning_system.py
@@ -28,7 +28,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from modules.commands.queues import AbstractReviewQueue
-from modules.processutils import ScriptError
+from modules.executive import ScriptError
from modules.webkitport import WebKitPort
class AbstractEarlyWarningSystem(AbstractReviewQueue):
diff --git a/WebKitTools/Scripts/modules/commands/queues.py b/WebKitTools/Scripts/modules/commands/queues.py
index 5f70ce1..b907f03 100644
--- a/WebKitTools/Scripts/modules/commands/queues.py
+++ b/WebKitTools/Scripts/modules/commands/queues.py
@@ -33,12 +33,12 @@ import re
from datetime import datetime
from optparse import make_option
+from modules.executive import ScriptError
from modules.grammar import pluralize
-from modules.landingsequence import LandingSequence, ConditionalLandingSequence, LandingSequenceErrorHandler
+from modules.landingsequence import LandingSequence, LandingSequenceErrorHandler
from modules.logging import error, log
from modules.multicommandtool import Command
from modules.patchcollection import PatchCollection, PersistentPatchCollection, PersistentPatchCollectionDelegate
-from modules.processutils import run_and_throw_if_fail, ScriptError
from modules.statusbot import StatusBot
from modules.workqueue import WorkQueue, WorkQueueDelegate
@@ -92,7 +92,7 @@ class AbstractQueue(Command, WorkQueueDelegate):
def run_bugzilla_tool(self, args):
bugzilla_tool_args = [self.tool.path()] + map(str, args)
- run_and_throw_if_fail(bugzilla_tool_args)
+ self.tool.executive.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(map(str, patch_ids))))
diff --git a/WebKitTools/Scripts/modules/commands/queues_unittest.py b/WebKitTools/Scripts/modules/commands/queues_unittest.py
index c8699e9..75abbe5 100644
--- a/WebKitTools/Scripts/modules/commands/queues_unittest.py
+++ b/WebKitTools/Scripts/modules/commands/queues_unittest.py
@@ -62,5 +62,5 @@ class AbstractQueueTest(CommandsTest):
self._assert_output(queue.run_bugzilla_tool, [run_args], expected_stdout=tool_output)
def test_run_bugzilla_tool(self):
- self._assert_run_bugzilla_tool_output([1], "1\n")
- self._assert_run_bugzilla_tool_output(["one", 2], "one 2\n")
+ self._assert_run_bugzilla_tool_output([1], "")
+ self._assert_run_bugzilla_tool_output(["one", 2], "")
diff --git a/WebKitTools/Scripts/modules/landingsequence.py b/WebKitTools/Scripts/modules/landingsequence.py
index 72c2959..fc20baa 100644
--- a/WebKitTools/Scripts/modules/landingsequence.py
+++ b/WebKitTools/Scripts/modules/landingsequence.py
@@ -34,6 +34,8 @@ from modules.processutils import ScriptError
from modules.scm import CheckoutNeedsUpdate
from modules.webkitport import WebKitPort
from modules.workqueue import WorkQueue
+from modules.buildsteps import CleanWorkingDirectoryStep, UpdateStep, ApplyPatchStep, EnsureBuildersAreGreenStep, BuildStep, RunTestsStep, CommitStep, ClosePatchStep, CloseBugStep
+
class LandingSequenceErrorHandler():
@classmethod
@@ -75,66 +77,37 @@ class LandingSequence:
WorkQueue.exit_after_handled_error(e)
def clean(self):
- self._tool.steps.clean_working_directory(self._tool.scm(), self._options)
+ step = CleanWorkingDirectoryStep(self._tool, self._options)
+ step.run()
def update(self):
- self._tool.steps.update(port=self._port)
+ step = UpdateStep(self._tool, self._options)
+ step.run()
def apply_patch(self):
- log("Processing patch %s from bug %s." % (self._patch["id"], self._patch["bug_id"]))
- self._tool.scm().apply_patch(self._patch, force=self._options.non_interactive)
+ step = ApplyPatchStep(self._tool, self._options, self._patch)
+ step.run()
def check_builders(self):
- self._tool.steps.ensure_builders_are_green(self._tool.buildbot, self._options)
+ step = EnsureBuildersAreGreenStep(self._tool, self._options)
+ step.run()
def build(self):
- self._tool.steps.build_webkit(quiet=self._options.quiet, port=self._port)
+ step = BuildStep(self._tool, self._options)
+ step.run()
def test(self):
- # When running non-interactively we don't want to launch Safari and we want to exit after the first failure.
- self._tool.steps.run_tests(launch_safari=not self._options.non_interactive, fail_fast=self._options.non_interactive, quiet=self._options.quiet, port=self._port)
+ step = RunTestsStep(self._tool, self._options)
+ step.run()
def commit(self):
- commit_message = self._tool.scm().commit_message_for_this_commit()
- return self._tool.scm().commit_with_message(commit_message.message())
+ step = CommitStep(self._tool, self._options)
+ return step.run()
def close_patch(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)
+ step = ClosePatchStep(self._tool, self._options, self._patch)
+ step.run(commit_log)
def close_bug(self):
- # Check to make sure there are no r? or r+ patches on the bug before closing.
- # Assume that r- patches are just previous patches someone forgot to obsolete.
- patches = self._tool.bugs.fetch_patches_from_bug(self._patch["bug_id"])
- for patch in patches:
- review_flag = patch.get("review")
- if review_flag == "?" or review_flag == "+":
- log("Not closing bug %s as attachment %s has review=%s. Assuming there are more patches to land from this bug." % (patch["bug_id"], patch["id"], review_flag))
- return
- self._tool.bugs.close_bug_as_fixed(self._patch["bug_id"], "All reviewed patches have been landed. Closing bug.")
-
-
-class ConditionalLandingSequence(LandingSequence):
- def __init__(self, patch, options, tool):
- LandingSequence.__init__(self, patch, options, tool)
-
- def update(self):
- if self._options.update:
- LandingSequence.update(self)
-
- def check_builders(self):
- if self._options.build:
- LandingSequence.check_builders(self)
-
- def build(self):
- if self._options.build:
- LandingSequence.build(self)
-
- def test(self):
- if self._options.build and self._options.test:
- LandingSequence.test(self)
-
- def close_bug(self):
- if self._options.close_bug:
- LandingSequence.close_bug(self)
-
+ step = CloseBugStep(self._tool, self._options, self._patch)
+ step.run()
diff --git a/WebKitTools/Scripts/modules/mock_bugzillatool.py b/WebKitTools/Scripts/modules/mock_bugzillatool.py
index 963a7d7..47f3880 100644
--- a/WebKitTools/Scripts/modules/mock_bugzillatool.py
+++ b/WebKitTools/Scripts/modules/mock_bugzillatool.py
@@ -125,7 +125,7 @@ class MockBugzillaTool():
def __init__(self):
self.bugs = MockBugzilla()
self.buildbot = MockBuildBot()
- self.steps = Mock()
+ self.executive = Mock()
self._scm = MockSCM()
def scm(self):
diff --git a/WebKitTools/Scripts/modules/processutils.py b/WebKitTools/Scripts/modules/processutils.py
deleted file mode 100644
index 7a681bf..0000000
--- a/WebKitTools/Scripts/modules/processutils.py
+++ /dev/null
@@ -1,113 +0,0 @@
-# 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
-
-# FIXME: These methods could all be unified into one!
-
-class ScriptError(Exception):
- def __init__(self, message=None, script_args=None, exit_code=None, output=None, cwd=None):
- if not message:
- message = 'Failed to run "%s"' % script_args
- if exit_code:
- message += " exit_code: %d" % exit_code
- if cwd:
- message += " cwd: %s" % cwd
-
- Exception.__init__(self, message)
- self.script_args = script_args # 'args' is already used by Exception
- self.exit_code = exit_code
- self.output = output
- self.cwd = cwd
-
- def message_with_output(self, output_limit=500):
- if self.output:
- if output_limit and len(self.output) > output_limit:
- return "%s\nLast %s characters of output:\n%s" % (self, output_limit, self.output[-output_limit:])
- return "%s\n%s" % (self, self.output)
- return str(self)
-
-def default_error_handler(error):
- raise error
-
-def ignore_error(error):
- pass
-
-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_command(args, cwd=None, input=None, error_handler=default_error_handler, return_exit_code=False, return_stderr=True):
- if hasattr(input, 'read'): # Check if the input is a file.
- stdin = input
- string_to_communicate = None
- else:
- stdin = subprocess.PIPE if input else None
- string_to_communicate = input
- if return_stderr:
- stderr = subprocess.STDOUT
- else:
- stderr = None
- process = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE, stderr=stderr, cwd=cwd)
- output = process.communicate(string_to_communicate)[0]
- exit_code = process.wait()
- if exit_code:
- script_error = ScriptError(script_args=args, exit_code=exit_code, output=output, cwd=cwd)
- error_handler(script_error)
- if return_exit_code:
- return exit_code
- return output
-
-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)
diff --git a/WebKitTools/Scripts/modules/scm.py b/WebKitTools/Scripts/modules/scm.py
index a09236c..613f878 100644
--- a/WebKitTools/Scripts/modules/scm.py
+++ b/WebKitTools/Scripts/modules/scm.py
@@ -35,8 +35,8 @@ import subprocess
# Import WebKit-specific modules.
from modules.changelogs import ChangeLog
+from modules.executive import run_command, ScriptError, default_error_handler, ignore_error
from modules.logging import error, log
-from modules.processutils import run_command, ScriptError, default_error_handler, ignore_error
def detect_scm_system(path):
if SVN.in_working_directory(path):
diff --git a/WebKitTools/Scripts/modules/scm_unittest.py b/WebKitTools/Scripts/modules/scm_unittest.py
index f3f6960..e89e276 100644
--- a/WebKitTools/Scripts/modules/scm_unittest.py
+++ b/WebKitTools/Scripts/modules/scm_unittest.py
@@ -38,13 +38,13 @@ import unittest
import urllib
from datetime import date
+from modules.executive import run_command, ignore_error, ScriptError
from modules.scm import detect_scm_system, SCM, CheckoutNeedsUpdate, commit_error_handler
-from modules.processutils import run_command, ignore_error, ScriptError
# Eventually we will want to write tests which work for both scms. (like update_webkit, changed_files, etc.)
# Perhaps through some SCMTest base-class which both SVNTest and GitTest inherit from.
-# FIXME: This should be unified into one of the processutils.py commands!
+# FIXME: This should be unified into one of the executive.py commands!
def run_silent(args, cwd=None):
process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd)
process.communicate() # ignore output
diff --git a/WebKitTools/Scripts/modules/webkitport.py b/WebKitTools/Scripts/modules/webkitport.py
index 37dd41d..849ac4b 100644
--- a/WebKitTools/Scripts/modules/webkitport.py
+++ b/WebKitTools/Scripts/modules/webkitport.py
@@ -39,12 +39,6 @@ class WebKitPort():
return os.path.join("WebKitTools", "Scripts", script_name)
@staticmethod
- def port_options():
- return [
- make_option("--port", action="store", dest="port", default=None, help="Specify a port (e.g., mac, qt, gtk, ...)."),
- ]
-
- @staticmethod
def port(port_name):
if port_name == "mac":
return MacPort
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list