[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

eric at webkit.org eric at webkit.org
Wed Dec 22 14:46:51 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit f780046504cff16feab431d0cd296ee1fe98e0cd
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 20 01:26:21 2010 +0000

    2010-10-19  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Adam Barth.
    
            Teach feeder-queue how to feed the EWS bots
            https://bugs.webkit.org/show_bug.cgi?id=47943
    
            queues.webkit.org already knew how to accept EWS submissions
            via /submit-to-ews.  This teaches the feeder queue how to post
            to that page with any new r? patches it sees.
    
            * QueueStatusServer/model/activeworkitems_unitest.py: Added.
             - More unit testing is always a good thing.
            * Scripts/webkitpy/common/net/bugzilla.py:
            * Scripts/webkitpy/common/net/statusserver.py:
            * Scripts/webkitpy/tool/bot/feeders.py:
            * Scripts/webkitpy/tool/commands/queues.py:
            * Scripts/webkitpy/tool/commands/queues_unittest.py:
            * Scripts/webkitpy/tool/mocktool.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70117 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index f7ba536..bdff774 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,5 +1,25 @@
 2010-10-19  Eric Seidel  <eric at webkit.org>
 
+        Reviewed by Adam Barth.
+
+        Teach feeder-queue how to feed the EWS bots
+        https://bugs.webkit.org/show_bug.cgi?id=47943
+
+        queues.webkit.org already knew how to accept EWS submissions
+        via /submit-to-ews.  This teaches the feeder queue how to post
+        to that page with any new r? patches it sees.
+
+        * QueueStatusServer/model/activeworkitems_unitest.py: Added.
+         - More unit testing is always a good thing.
+        * Scripts/webkitpy/common/net/bugzilla.py:
+        * Scripts/webkitpy/common/net/statusserver.py:
+        * Scripts/webkitpy/tool/bot/feeders.py:
+        * Scripts/webkitpy/tool/commands/queues.py:
+        * Scripts/webkitpy/tool/commands/queues_unittest.py:
+        * Scripts/webkitpy/tool/mocktool.py:
+
+2010-10-19  Eric Seidel  <eric at webkit.org>
+
         Unreviewed, just fixing test-webkitpy.  I'm really on a roll today.
 
         commit-queue gets stuck when release-patch returns 404
diff --git a/WebKitTools/QueueStatusServer/model/activeworkitems_unitest.py b/WebKitTools/QueueStatusServer/model/activeworkitems_unitest.py
new file mode 100644
index 0000000..6d915a1
--- /dev/null
+++ b/WebKitTools/QueueStatusServer/model/activeworkitems_unitest.py
@@ -0,0 +1,52 @@
+# Copyright (C) 2010 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 Research in Motion Ltd. 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 unittest
+from datetime import datetime
+
+from model.activeworkitems import ActiveWorkItems
+
+
+class ActiveWorkItemsTest(unittest.TestCase):
+    def test_basic(self):
+        items = ActiveWorkItems()
+        queued_items = [1, 2]
+        time = datetime.now()
+        self.assertEqual(items.next_item(queued_items, time), 1)
+        self.assertEqual(items.next_item([1], time), None)
+        self.assertEqual(items.next_item([], time), None)
+
+        self.assertEqual(items.time_for_item(1), time)
+        self.assertEqual(items.time_for_item(2), None)
+
+        items.expire_item(1)
+        self.assertEqual(items.time_for_item(1), None)
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py b/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py
index cc64fac..94519a7 100644
--- a/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py
+++ b/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py
@@ -301,15 +301,14 @@ class BugzillaQueries(object):
         review_queue_url = "buglist.cgi?query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=review?"
         return self._fetch_bug_ids_advanced_query(review_queue_url)
 
+    # This method will make several requests to bugzilla.
     def fetch_patches_from_review_queue(self, limit=None):
         # [:None] returns the whole array.
         return sum([self._fetch_bug(bug_id).unreviewed_patches()
             for bug_id in self._fetch_bug_ids_from_review_queue()[:limit]], [])
 
-    # FIXME: Why do we have both fetch_patches_from_review_queue and
-    # fetch_attachment_ids_from_review_queue??
-    # NOTE: This is also the only client of _fetch_attachment_ids_request_query
-
+    # NOTE: This is the only client of _fetch_attachment_ids_request_query
+    # This method only makes one request to bugzilla.
     def fetch_attachment_ids_from_review_queue(self):
         review_queue_url = "request.cgi?action=queue&type=review&group=type"
         return self._fetch_attachment_ids_request_query(review_queue_url)
diff --git a/WebKitTools/Scripts/webkitpy/common/net/statusserver.py b/WebKitTools/Scripts/webkitpy/common/net/statusserver.py
index 756ee99..e457bef 100644
--- a/WebKitTools/Scripts/webkitpy/common/net/statusserver.py
+++ b/WebKitTools/Scripts/webkitpy/common/net/statusserver.py
@@ -102,6 +102,17 @@ class StatusServer:
         self._browser["work_items"] = " ".join(work_items)
         return self._browser.submit().read()
 
+    def _post_work_item_to_ews(self, attachment_id):
+        submit_to_ews_url = "%s/submit-to-ews" % self.url
+        self._browser.open(submit_to_ews_url)
+        self._browser.select_form(name="submit_to_ews")
+        self._browser["attachment_id"] = unicode(attachment_id)
+        self._browser.submit()
+
+    def submit_to_ews(self, attachment_id):
+        _log.info("Submitting attachment %s to EWS queues" % attachment_id)
+        return NetworkTransaction().run(lambda: self._post_work_item_to_ews(attachment_id))
+
     def next_work_item(self, queue_name):
         _log.debug("Fetching next work item for %s" % queue_name)
         patch_status_url = "%s/next-patch/%s" % (self.url, queue_name)
diff --git a/WebKitTools/Scripts/webkitpy/tool/bot/feeders.py b/WebKitTools/Scripts/webkitpy/tool/bot/feeders.py
index 15eaaf3..2b8368e 100644
--- a/WebKitTools/Scripts/webkitpy/tool/bot/feeders.py
+++ b/WebKitTools/Scripts/webkitpy/tool/bot/feeders.py
@@ -28,18 +28,15 @@
 
 from webkitpy.common.system.deprecated_logging import log
 from webkitpy.common.net.bugzilla import CommitterValidator
+from webkitpy.tool.grammar import pluralize
 
 
 class AbstractFeeder(object):
     def __init__(self, tool):
         self._tool = tool
 
-    def feed(tool):
-        raise NotImplementedError, "subclasses must implement"
-
-    def update_work_items(self, item_ids):
-        self._tool.status_server.update_work_items(self.queue_name, item_ids)
-        log("Feeding %s items %s" % (self.queue_name, item_ids))
+    def feed(self):
+        raise NotImplementedError("subclasses must implement")
 
 
 class CommitQueueFeeder(AbstractFeeder):
@@ -49,11 +46,15 @@ class CommitQueueFeeder(AbstractFeeder):
         AbstractFeeder.__init__(self, tool)
         self.committer_validator = CommitterValidator(self._tool.bugs)
 
+    def _update_work_items(self, item_ids):
+        self._tool.status_server.update_work_items(self.queue_name, item_ids)
+        log("Feeding %s items %s" % (self.queue_name, item_ids))
+
     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)
+        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)
@@ -71,3 +72,17 @@ class CommitQueueFeeder(AbstractFeeder):
         if rollout_cmp != 0:
             return rollout_cmp
         return cmp(a.attach_date(), b.attach_date())
+
+
+class EWSFeeder(AbstractFeeder):
+    def __init__(self, tool):
+        self._ids_sent_to_server = set()
+        AbstractFeeder.__init__(self, tool)
+
+    def feed(self):
+        ids_needing_review = set(self._tool.bugs.queries.fetch_attachment_ids_from_review_queue())
+        new_ids = ids_needing_review.difference(self._ids_sent_to_server)
+        log("Feeding EWS (%s, %s new)" % (pluralize("r? patch", len(ids_needing_review)), len(new_ids)))
+        for attachment_id in new_ids:  # Order doesn't really matter for the EWS.
+            self._tool.status_server.submit_to_ews(attachment_id)
+            self._ids_sent_to_server.add(attachment_id)
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/queues.py b/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
index 900cbad..ca3066b 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
@@ -45,7 +45,7 @@ from webkitpy.common.system.executive import ScriptError
 from webkitpy.common.system.deprecated_logging import error, log
 from webkitpy.tool.commands.stepsequence import StepSequenceErrorHandler
 from webkitpy.tool.bot.commitqueuetask import CommitQueueTask, CommitQueueTaskDelegate
-from webkitpy.tool.bot.feeders import CommitQueueFeeder
+from webkitpy.tool.bot.feeders import CommitQueueFeeder, EWSFeeder
 from webkitpy.tool.bot.patchcollection import PersistentPatchCollection, PersistentPatchCollectionDelegate
 from webkitpy.tool.bot.queueengine import QueueEngine, QueueEngineDelegate
 from webkitpy.tool.grammar import pluralize
@@ -167,6 +167,7 @@ class FeederQueue(AbstractQueue):
         AbstractQueue.begin_work_queue(self)
         self.feeders = [
             CommitQueueFeeder(self._tool),
+            EWSFeeder(self._tool),
         ]
 
     def next_work_item(self):
@@ -372,6 +373,7 @@ class RietveldUploadQueue(AbstractPatchQueue, StepSequenceErrorHandler):
 
 
 class AbstractReviewQueue(AbstractPatchQueue, PersistentPatchCollectionDelegate, StepSequenceErrorHandler):
+    """This is the base-class for the EWS queues and the style-queue."""
     def __init__(self, options=None):
         AbstractPatchQueue.__init__(self, options)
 
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py b/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
index c3c3a42..22f1298 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
@@ -135,6 +135,8 @@ MOCK setting flag 'commit-queue' to '-' on attachment '128' with comment 'Reject
 - If you have committer 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 committer rights.'
 MOCK: update_work_items: commit-queue [106, 197]
 Feeding commit-queue items [106, 197]
+Feeding EWS (1 r? patch, 1 new)
+MOCK: submit_to_ews: 103
 """,
             "handle_unexpected_error": "Mock error message\n",
         }
diff --git a/WebKitTools/Scripts/webkitpy/tool/mocktool.py b/WebKitTools/Scripts/webkitpy/tool/mocktool.py
index dd67ff8..05b30dd 100644
--- a/WebKitTools/Scripts/webkitpy/tool/mocktool.py
+++ b/WebKitTools/Scripts/webkitpy/tool/mocktool.py
@@ -554,6 +554,9 @@ class MockStatusServer(object):
         self._work_items = work_items
         log("MOCK: update_work_items: %s %s" % (queue_name, work_items))
 
+    def submit_to_ews(self, patch_id):
+        log("MOCK: submit_to_ews: %s" % (patch_id))
+
     def update_status(self, queue_name, status, patch=None, results_file=None):
         log("MOCK: update_status: %s %s" % (queue_name, status))
         return 187

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list