Ejemplo n.º 1
0
 def handle_script_error(cls, tool, state, script_error):
     status_id = cls._update_status_for_script_error(
         tool, state, script_error)
     validator = CommitterValidator(tool.bugs)
     validator.reject_patch_from_commit_queue(
         state["patch"].id(),
         cls._error_message_for_bug(tool, status_id, script_error))
Ejemplo n.º 2
0
    def test_flag_permission_rejection_message(self):
        validator = CommitterValidator(bugzilla=None)
        self.assertEqual(validator._committers_py_path(), "WebKitTools/Scripts/webkitpy/common/config/committers.py")
        expected_messsage="""[email protected] does not have review permissions according to http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/webkitpy/common/config/committers.py.

- If you do not have review rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.

- If you have review rights please correct the error in WebKitTools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your review rights."""
        self.assertEqual(validator._flag_permission_rejection_message("*****@*****.**", "review"), expected_messsage)
Ejemplo n.º 3
0
    def test_flag_permission_rejection_message(self):
        validator = CommitterValidator(bugzilla=None)
        self.assertEqual(validator._committers_py_path(), "WebKitTools/Scripts/webkitpy/common/config/committers.py")
        expected_messsage="""[email protected] does not have review permissions according to http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/webkitpy/common/config/committers.py.

- If you do not have review rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.

- If you have review rights please correct the error in WebKitTools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  Due to bug 30084 the commit-queue will require a restart after your change.  Please contact [email protected] to request a commit-queue restart.  After restart the commit-queue will correctly respect your review rights."""
        self.assertEqual(validator._flag_permission_rejection_message("*****@*****.**", "review"), expected_messsage)
Ejemplo n.º 4
0
 def process_work_item(self, patch):
     self._cc_watchers(patch.bug_id())
     task = CommitQueueTask(self._tool, self, patch)
     try:
         if task.run():
             self._did_pass(patch)
             return True
         self._did_retry(patch)
     except ScriptError, e:
         validator = CommitterValidator(self._tool.bugs)
         validator.reject_patch_from_commit_queue(patch.id(), self._error_message_for_bug(task.failure_status_id, e))
         self._did_fail(patch)
Ejemplo n.º 5
0
class CommitQueueFeeder(AbstractFeeder):
    queue_name = "commit-queue"

    def __init__(self, tool):
        AbstractFeeder.__init__(self, tool)
        self.committer_validator = CommitterValidator(self._tool.bugs)

    def feed(self):
        patches = self._validate_patches()
        patches = sorted(patches, self._patch_cmp)
        patch_ids = [patch.id() for patch in patches]
        self.update_work_items(patch_ids)

    def _patches_for_bug(self, bug_id):
        return self._tool.bugs.fetch_bug(bug_id).commit_queued_patches(include_invalid=True)

    def _validate_patches(self):
        # Not using BugzillaQueries.fetch_patches_from_commit_queue() so we can reject patches with invalid committers/reviewers.
        bug_ids = self._tool.bugs.queries.fetch_bug_ids_from_commit_queue()
        all_patches = sum([self._patches_for_bug(bug_id) for bug_id in bug_ids], [])
        return self.committer_validator.patches_after_rejecting_invalid_commiters_and_reviewers(all_patches)

    def _patch_cmp(self, a, b):
        # Sort first by is_rollout, then by attach_date.
        # Reversing the order so that is_rollout is first.
        rollout_cmp = cmp(b.is_rollout(), a.is_rollout())
        if rollout_cmp != 0:
            return rollout_cmp
        return cmp(a.attach_date(), b.attach_date())
Ejemplo n.º 6
0
class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler):
    name = "commit-queue"

    def __init__(self):
        AbstractPatchQueue.__init__(self)

    # AbstractPatchQueue methods

    def begin_work_queue(self):
        AbstractPatchQueue.begin_work_queue(self)
        self.committer_validator = CommitterValidator(self.tool.bugs)

    def _validate_patches_in_commit_queue(self):
        # Not using BugzillaQueries.fetch_patches_from_commit_queue() so we can reject patches with invalid committers/reviewers.
        bug_ids = self.tool.bugs.queries.fetch_bug_ids_from_commit_queue()
        all_patches = sum(
            [self.tool.bugs.fetch_bug(bug_id).commit_queued_patches(include_invalid=True) for bug_id in bug_ids], []
        )
        return self.committer_validator.patches_after_rejecting_invalid_commiters_and_reviewers(all_patches)

    def _patch_cmp(self, a, b):
        # Sort first by is_rollout, then by attach_date.
        # Reversing the order so that is_rollout is first.
        rollout_cmp = cmp(b.is_rollout(), a.is_rollout())
        if rollout_cmp != 0:
            return rollout_cmp
        return cmp(a.attach_date(), b.attach_date())

    def next_work_item(self):
        patches = self._validate_patches_in_commit_queue()
        patches = sorted(patches, self._patch_cmp)
        self._update_work_items([patch.id() for patch in patches])
        if not patches:
            return None
        # Only bother logging if we have patches in the queue.
        self.log_progress([patch.id() for patch in patches])
        return patches[0]

    def _can_build_and_test(self):
        try:
            self.run_webkit_patch(
                [
                    "build-and-test",
                    "--force-clean",
                    "--build",
                    "--test",
                    "--non-interactive",
                    "--no-update",
                    "--build-style=both",
                    "--quiet",
                ]
            )
        except ScriptError, e:
            failure_log = self._log_from_script_error_for_upload(e)
            self._update_status("Unable to successfully do a clean build and test", results_file=failure_log)
            return False
        return True
Ejemplo n.º 7
0
class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler):
    name = "commit-queue"

    def __init__(self):
        AbstractPatchQueue.__init__(self)

    # AbstractPatchQueue methods

    def begin_work_queue(self):
        AbstractPatchQueue.begin_work_queue(self)
        self.committer_validator = CommitterValidator(self.tool.bugs)

    def _validate_patches_in_commit_queue(self):
        # Not using BugzillaQueries.fetch_patches_from_commit_queue() so we can reject patches with invalid committers/reviewers.
        bug_ids = self.tool.bugs.queries.fetch_bug_ids_from_commit_queue()
        all_patches = sum([
            self.tool.bugs.fetch_bug(bug_id).commit_queued_patches(
                include_invalid=True) for bug_id in bug_ids
        ], [])
        return self.committer_validator.patches_after_rejecting_invalid_commiters_and_reviewers(
            all_patches)

    def _patch_cmp(self, a, b):
        # Sort first by is_rollout, then by attach_date.
        # Reversing the order so that is_rollout is first.
        rollout_cmp = cmp(b.is_rollout(), a.is_rollout())
        if (rollout_cmp != 0):
            return rollout_cmp
        return cmp(a.attach_date(), b.attach_date())

    def next_work_item(self):
        patches = self._validate_patches_in_commit_queue()
        patches = sorted(patches, self._patch_cmp)
        self._update_work_items([patch.id() for patch in patches])
        if not patches:
            return None
        # Only bother logging if we have patches in the queue.
        self.log_progress([patch.id() for patch in patches])
        return patches[0]

    def _can_build_and_test(self):
        try:
            self.run_webkit_patch([
                "build-and-test", "--force-clean", "--build", "--test",
                "--non-interactive", "--no-update", "--build-style=both",
                "--quiet"
            ])
        except ScriptError, e:
            failure_log = self._log_from_script_error_for_upload(e)
            self._update_status(
                "Unable to successfully do a clean build and test",
                results_file=failure_log)
            return False
        return True
Ejemplo n.º 8
0
class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler):
    name = "commit-queue"

    def __init__(self):
        AbstractPatchQueue.__init__(self)

    # AbstractPatchQueue methods

    def begin_work_queue(self):
        AbstractPatchQueue.begin_work_queue(self)
        self.committer_validator = CommitterValidator(self.tool.bugs)

    def _validate_patches_in_commit_queue(self):
        # Not using BugzillaQueries.fetch_patches_from_commit_queue() so we can reject patches with invalid committers/reviewers.
        bug_ids = self.tool.bugs.queries.fetch_bug_ids_from_commit_queue()
        all_patches = sum([
            self.tool.bugs.fetch_bug(bug_id).commit_queued_patches(
                include_invalid=True) for bug_id in bug_ids
        ], [])
        return self.committer_validator.patches_after_rejecting_invalid_commiters_and_reviewers(
            all_patches)

    def next_work_item(self):
        patches = self._validate_patches_in_commit_queue()
        builders_are_green = self._builders_are_green()
        if not builders_are_green:
            patches = filter(lambda patch: patch.is_rollout(), patches)
        # FIXME: We could sort the patches in a specific order here, was suggested by https://bugs.webkit.org/show_bug.cgi?id=33395
        if not patches:
            queue_text = "queue" if builders_are_green else "rollout queue"
            self._update_status("Empty %s" % queue_text)
            return None
        # Only bother logging if we have patches in the queue.
        self.log_progress([patch.id() for patch in patches])
        return patches[0]

    def _can_build_and_test(self):
        try:
            self.run_webkit_patch([
                "build-and-test", "--force-clean", "--build", "--test",
                "--non-interactive", "--no-update", "--build-style=both",
                "--quiet"
            ])
        except ScriptError, e:
            self._update_status("Unable to successfully build and test", None)
            return False
        return True
Ejemplo n.º 9
0
class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler):
    name = "commit-queue"
    def __init__(self):
        AbstractPatchQueue.__init__(self)

    # AbstractPatchQueue methods

    def begin_work_queue(self):
        AbstractPatchQueue.begin_work_queue(self)
        self.committer_validator = CommitterValidator(self.tool.bugs)

    def _validate_patches_in_commit_queue(self):
        # Not using BugzillaQueries.fetch_patches_from_commit_queue() so we can reject patches with invalid committers/reviewers.
        bug_ids = self.tool.bugs.queries.fetch_bug_ids_from_commit_queue()
        all_patches = sum([self.tool.bugs.fetch_bug(bug_id).commit_queued_patches(include_invalid=True) for bug_id in bug_ids], [])
        return self.committer_validator.patches_after_rejecting_invalid_commiters_and_reviewers(all_patches)

    def next_work_item(self):
        patches = self._validate_patches_in_commit_queue()
        builders_are_green = self._builders_are_green()
        if not builders_are_green:
            patches = filter(lambda patch: patch.is_rollout(), patches)
        # FIXME: We could sort the patches in a specific order here, was suggested by https://bugs.webkit.org/show_bug.cgi?id=33395
        if not patches:
            queue_text = "queue" if builders_are_green else "rollout queue"
            self._update_status("Empty %s" % queue_text)
            return None
        # Only bother logging if we have patches in the queue.
        self.log_progress([patch.id() for patch in patches])
        return patches[0]

    def _can_build_and_test(self):
        try:
            self.run_webkit_patch([
                "build-and-test",
                "--force-clean",
                "--build",
                "--test",
                "--non-interactive",
                "--no-update",
                "--build-style=both",
                "--quiet"])
        except ScriptError, e:
            self._update_status("Unable to successfully build and test", None)
            return False
        return True
Ejemplo n.º 10
0
 def __init__(self, tool):
     AbstractFeeder.__init__(self, tool)
     self.committer_validator = CommitterValidator(self._tool.bugs)
Ejemplo n.º 11
0
 def begin_work_queue(self):
     AbstractPatchQueue.begin_work_queue(self)
     self.committer_validator = CommitterValidator(self.tool.bugs)
Ejemplo n.º 12
0
 def handle_script_error(cls, tool, state, script_error):
     status_id = cls._update_status_for_script_error(tool, state, script_error)
     validator = CommitterValidator(tool.bugs)
     validator.reject_patch_from_commit_queue(state["patch"].id(), cls._error_message_for_bug(tool, status_id, script_error))
Ejemplo n.º 13
0
 def begin_work_queue(self):
     AbstractPatchQueue.begin_work_queue(self)
     self.committer_validator = CommitterValidator(self.tool.bugs)