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
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)
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)
"bug_id": bug_id
}
- sequence = LandDiffLandingSequence(fake_patch, options, tool)
+ sequence = LandDiffSequence(fake_patch, options, tool)
sequence.run()
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):
class LandAttachment(AbstractPatchLandingCommand):
name = "land-attachment"
def __init__(self):
- AbstractPatchLandingCommand.__init__(self, "Lands a 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)
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)
]
@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)