[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:44:37 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 7526439285fc3bd60257dabc79e5d57d384ee160
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 19 02:37:49 2010 +0000

    2010-10-18  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Eric Seidel.
    
            new-run-webkit-tests produces corrupt PNG baselines on Windows
            https://bugs.webkit.org/show_bug.cgi?id=47867
    
            * Scripts/webkitpy/layout_tests/port/base.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70019 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 65d4caa..5f40925 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -11,6 +11,31 @@
 
         Reviewed by Adam Barth.
 
+        Make it possible to submit patches to the EWS bots
+        https://bugs.webkit.org/show_bug.cgi?id=47869
+
+        * QueueStatusServer/handlers/nextpatch.py:
+         - Move more logic into Queue, so that it can be shared with SubmitToEWS.
+        * QueueStatusServer/handlers/queuestatus.py:
+         - Fix two typos from a previous commit.
+        * QueueStatusServer/handlers/submittoews.py: Added.
+        * QueueStatusServer/handlers/updatestatus.py:
+         - Use the new is_retry_request method to share this (hacky) code with SubmitToEWS
+        * QueueStatusServer/main.py:
+         - Add /submit-to-ews
+        * QueueStatusServer/model/queuepropertymixin.py:
+         - Fix circular imports caused by adding Queue.work_items()
+        * QueueStatusServer/model/queues.py:
+         - Add work_items() and active_work_items()
+        * QueueStatusServer/model/queuestatus.py:
+        * QueueStatusServer/model/workitems.py:
+         - Add transaction-safe add/remove methods.
+        * QueueStatusServer/templates/submittoews.html: Added.
+
+2010-10-18  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Adam Barth.
+
         Deploy Queue class in more places throughout QueueStatusServer
         https://bugs.webkit.org/show_bug.cgi?id=47855
 
diff --git a/WebKitTools/QueueStatusServer/handlers/nextpatch.py b/WebKitTools/QueueStatusServer/handlers/nextpatch.py
index edb702a..5304a73 100644
--- a/WebKitTools/QueueStatusServer/handlers/nextpatch.py
+++ b/WebKitTools/QueueStatusServer/handlers/nextpatch.py
@@ -26,26 +26,22 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+from datetime import datetime
+
 from google.appengine.ext import db
 from google.appengine.ext import webapp
 
-from model.workitems import WorkItems
-from model.activeworkitems import ActiveWorkItems
-from model import queuestatus
-
-from datetime import datetime, timedelta
+from model.queues import Queue
 
 
 class NextPatch(webapp.RequestHandler):
-    def _get_next_patch_id(self, queue_name):
-        work_items = WorkItems.all().filter("queue_name =", queue_name).get()
-        if not work_items:
-            return None
-        active_work_items = ActiveWorkItems.get_or_insert(key_name=queue_name, queue_name=queue_name)
-        return db.run_in_transaction(self._assign_patch, active_work_items.key(), work_items.item_ids)
-
     def get(self, queue_name):
-        patch_id = self._get_next_patch_id(queue_name)
+        queue = Queue.queue_for_name(queue_name)
+        if not queue:
+            self.error(404)
+            return
+        # FIXME: Patch assignment should probably move into Queue.
+        patch_id = db.run_in_transaction(self._assign_patch, queue.active_work_items().key(), queue.work_items().item_ids)
         if not patch_id:
             self.error(404)
             return
diff --git a/WebKitTools/QueueStatusServer/handlers/queuestatus.py b/WebKitTools/QueueStatusServer/handlers/queuestatus.py
index 2b9a378..52a926e 100644
--- a/WebKitTools/QueueStatusServer/handlers/queuestatus.py
+++ b/WebKitTools/QueueStatusServer/handlers/queuestatus.py
@@ -50,10 +50,11 @@ class QueueStatus(webapp.RequestHandler):
         return rows
 
     def get(self, queue_name):
-        queue_name = queue_name.lowercase()
+        queue_name = queue_name.lower()
         queue = Queue.queue_with_name(queue_name)
         if not queue:
             self.error(404)
+            return
 
         queued_items = WorkItems.all().filter("queue_name =", queue.name()).get()
         active_items = ActiveWorkItems.all().filter("queue_name =", queue.name()).get()
diff --git a/WebKitTools/QueueStatusServer/handlers/submittoews.py b/WebKitTools/QueueStatusServer/handlers/submittoews.py
new file mode 100644
index 0000000..115987c
--- /dev/null
+++ b/WebKitTools/QueueStatusServer/handlers/submittoews.py
@@ -0,0 +1,61 @@
+# 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 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.
+
+from google.appengine.ext import webapp, db
+from google.appengine.ext.webapp import template
+
+from handlers.updatebase import UpdateBase
+from model.attachment import Attachment
+from model.queues import Queue
+
+
+class SubmitToEWS(UpdateBase):
+    def get(self):
+        self.response.out.write(template.render("templates/submittoews.html", None))
+
+    def _should_add_to_ews_queue(self, queue, attachment):
+        assert(queue.is_ews())
+        latest_status = attachment.status_for_queue(queue)
+        if not latest_status:
+            return True
+        # Only ever re-submit to the EWS if the EWS specifically requested a retry.
+        # This allows us to restart the EWS feeder queue, without all r? patches
+        # being retried as a result of that restart!
+        # In some future version we might add a "force" button to allow the user
+        # to override this restriction.
+        return latest_status.is_retry_request()
+
+    def _add_attachment_to_ews_queues(self, attachment):
+        for queue in Queue.all_ews():
+            if self._should_add_to_ews_queue(queue, attachment):
+                queue.work_items().add_work_item(attachment.id)
+
+    def post(self):
+        attachment_id = self._int_from_request("attachment_id")
+        attachment = Attachment(attachment_id)
+        self._add_attachment_to_ews_queues(attachment)
diff --git a/WebKitTools/QueueStatusServer/handlers/updatestatus.py b/WebKitTools/QueueStatusServer/handlers/updatestatus.py
index 7f27cc6..2a46fd3 100644
--- a/WebKitTools/QueueStatusServer/handlers/updatestatus.py
+++ b/WebKitTools/QueueStatusServer/handlers/updatestatus.py
@@ -67,7 +67,7 @@ class UpdateStatus(UpdateBase):
 
     # FIXME: An explicit lock_release request would be cleaner than this magical "Retry" status.
     def _update_active_work_items(self, queue_status):
-        if queue_status.message != "Retry":  # From AbstractQueue._retry_status
+        if not queue_status.is_retry_request():
             return
         active_items = ActiveWorkItems.all().filter("queue_name =", queue_status.queue_name).get()
         if not active_items:
diff --git a/WebKitTools/QueueStatusServer/main.py b/WebKitTools/QueueStatusServer/main.py
index 93227ca..c85c9af 100644
--- a/WebKitTools/QueueStatusServer/main.py
+++ b/WebKitTools/QueueStatusServer/main.py
@@ -42,6 +42,7 @@ from handlers.queuestatus import QueueStatus
 from handlers.recentstatus import QueuesOverview
 from handlers.showresults import ShowResults
 from handlers.statusbubble import StatusBubble
+from handlers.submittoews import SubmitToEWS
 from handlers.svnrevision import SVNRevision
 from handlers.updatestatus import UpdateStatus
 from handlers.updatesvnrevision import UpdateSVNRevision
@@ -56,6 +57,7 @@ routes = [
     ('/gc', GC),
     (r'/patch-status/(.*)/(.*)', PatchStatus),
     (r'/patch/(.*)', Patch),
+    (r'/submit-to-ews', SubmitToEWS),
     (r'/results/(.*)', ShowResults),
     (r'/status-bubble/(.*)', StatusBubble),
     (r'/svn-revision/(.*)', SVNRevision),
diff --git a/WebKitTools/QueueStatusServer/model/queuepropertymixin.py b/WebKitTools/QueueStatusServer/model/queuepropertymixin.py
index 1e3853e..8f9cc29 100644
--- a/WebKitTools/QueueStatusServer/model/queuepropertymixin.py
+++ b/WebKitTools/QueueStatusServer/model/queuepropertymixin.py
@@ -26,11 +26,11 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-from model.queues import Queue
-
 
 class QueuePropertyMixin(object):
     def _queue_getter(self):
+        # Import at runtime to avoid circular imports
+        from model.queues import Queue
         return Queue.queue_from_name(self.queue_name)
 
     def _queue_setter(self, queue):
diff --git a/WebKitTools/QueueStatusServer/model/queues.py b/WebKitTools/QueueStatusServer/model/queues.py
index 9ca1e1e..46ed4e1 100644
--- a/WebKitTools/QueueStatusServer/model/queues.py
+++ b/WebKitTools/QueueStatusServer/model/queues.py
@@ -29,6 +29,9 @@
 
 import re
 
+from model.activeworkitems import ActiveWorkItems
+from model.workitems import WorkItems
+
 
 class Queue(object):
 
@@ -58,9 +61,22 @@ class Queue(object):
     def all(cls):
         return [Queue(name) for name in cls._all_queue_names]
 
+    @classmethod
+    def all_ews(cls):
+        return [queue for queue in cls.all() if queue.is_ews()]
+
     def name(self):
         return self._name
 
+    def work_items(self):
+        key_name = "work-items-%s" % (self._name)
+        return WorkItems.get_or_insert(key_name=key_name, queue_name=self._name)
+
+    # FIXME: active_work_items is a bad name for this lock-table.
+    def active_work_items(self):
+        key_name = "active-work-items-%s" % (self._name)
+        return ActiveWorkItems.get_or_insert(key_name=key_name, queue_name=self._name)
+
     def _caplitalize_after_dash(self, string):
         return "-".join([word[0].upper() + word[1:] for word in string.split("-")])
 
diff --git a/WebKitTools/QueueStatusServer/model/queuestatus.py b/WebKitTools/QueueStatusServer/model/queuestatus.py
index 68b50da..8002f89 100644
--- a/WebKitTools/QueueStatusServer/model/queuestatus.py
+++ b/WebKitTools/QueueStatusServer/model/queuestatus.py
@@ -39,3 +39,6 @@ class QueueStatus(db.Model, QueuePropertyMixin):
     message = db.StringProperty(multiline=True)
     date = db.DateTimeProperty(auto_now_add=True)
     results_file = db.BlobProperty()
+
+    def is_retry_request(self):
+        return self.message == "Retry"  # From AbstractQueue._retry_status
diff --git a/WebKitTools/QueueStatusServer/model/workitems.py b/WebKitTools/QueueStatusServer/model/workitems.py
index 45125c9..c39f790 100644
--- a/WebKitTools/QueueStatusServer/model/workitems.py
+++ b/WebKitTools/QueueStatusServer/model/workitems.py
@@ -43,3 +43,24 @@ class WorkItems(db.Model, QueuePropertyMixin):
         if attachment_id in attachment_id:
             return self.item_ids.index(attachment_id) + 1
         return None
+
+    @staticmethod
+    def _unguarded_add(key, attachment_id):
+        work_items = db.get(key)
+        if attachment_id in work_items.item_ids:
+            return
+        work_items.item_ids.append(attachment_id)
+        work_items.put()
+
+    def add_work_item(self, attachment_id):
+        db.run_in_transaction(self._unguarded_add, self.key(), attachment_id)
+
+    @staticmethod
+    def _unguarded_remove(key, attachment_id):
+        work_items = db.get(key)
+        # We should never have more than one entry for a work item, so we only need remove the first.
+        work_items.item_ids.remove(attachment_id)
+        work_items.put()
+
+    def remove_work_item(self, attachment_id):
+        db.run_in_transaction(self._unguarded_remove, self.key(), attachment_id)
diff --git a/WebKitTools/QueueStatusServer/templates/submittoews.html b/WebKitTools/QueueStatusServer/templates/submittoews.html
new file mode 100644
index 0000000..fb9d8aa
--- /dev/null
+++ b/WebKitTools/QueueStatusServer/templates/submittoews.html
@@ -0,0 +1,3 @@
+<form name="submit_to_ews" enctype="multipart/form-data" method="post">
+Patch to submit: <input name="attachment_id"><input type="submit" value="Submit for EWS Processing"></div>
+</form>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list