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())
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
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
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
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