[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Wed Apr 7 23:52:51 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 665705bb7fbf013a1df367aa3cd73664969cf27a
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Nov 21 01:02:41 2009 +0000

    2009-11-20  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Adam Barth.
    
            Teach the StatusBot how to support more than just the commit-queue
            https://bugs.webkit.org/show_bug.cgi?id=31754
    
            * CommitQueueStatus/index.yaml:
             - Add indices required for the new queries.
            * CommitQueueStatus/queue_status.py:
             - Add a patch-status page and move update_status to update-status.
             - Only display "commit-queue" status records for the commit-queue.
             - Add support for a queue_name property on status records.
             - Fix _int_from_request to actually work.
            * CommitQueueStatus/update_status.html:
             - Add support for a queue_name on status records.
             - Remove unused list of bug ids.
             * Scripts/modules/commands/queues.py
              - Make the queues pass the patch instead of the bug_id to StatusBot.
            * Scripts/modules/statusbot.py:
             - Support passing the queue_name to the status updates.
             - Support fetching patch status with patch_status().
            * Scripts/modules/workqueue.py:
             - Pass the patch to the StatusBot instead of the bug_id.
             - Let WorkQueues have a name.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51264 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 271532d..3b6fe44 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,29 @@
+2009-11-20  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Adam Barth.
+
+        Teach the StatusBot how to support more than just the commit-queue
+        https://bugs.webkit.org/show_bug.cgi?id=31754
+
+        * CommitQueueStatus/index.yaml:
+         - Add indices required for the new queries.
+        * CommitQueueStatus/queue_status.py:
+         - Add a patch-status page and move update_status to update-status.
+         - Only display "commit-queue" status records for the commit-queue.
+         - Add support for a queue_name property on status records.
+         - Fix _int_from_request to actually work.
+        * CommitQueueStatus/update_status.html:
+         - Add support for a queue_name on status records.
+         - Remove unused list of bug ids.
+         * Scripts/modules/commands/queues.py
+          - Make the queues pass the patch instead of the bug_id to StatusBot.
+        * Scripts/modules/statusbot.py:
+         - Support passing the queue_name to the status updates.
+         - Support fetching patch status with patch_status().
+        * Scripts/modules/workqueue.py:
+         - Pass the patch to the StatusBot instead of the bug_id.
+         - Let WorkQueues have a name.
+
 2009-11-20  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebKitTools/CommitQueueStatus/index.yaml b/WebKitTools/CommitQueueStatus/index.yaml
index a3b9e05..bf11262 100644
--- a/WebKitTools/CommitQueueStatus/index.yaml
+++ b/WebKitTools/CommitQueueStatus/index.yaml
@@ -9,3 +9,16 @@ indexes:
 # manually, move them above the marker line.  The index.yaml file is
 # automatically uploaded to the admin console when you next deploy
 # your application using appcfg.py.
+
+- kind: QueueStatus
+  properties:
+  - name: active_patch_id
+  - name: queue_name
+  - name: date
+    direction: desc
+
+- kind: QueueStatus
+  properties:
+  - name: queue_name
+  - name: date
+    direction: desc
diff --git a/WebKitTools/CommitQueueStatus/queue_status.py b/WebKitTools/CommitQueueStatus/queue_status.py
index 30d2494..f48e83d 100644
--- a/WebKitTools/CommitQueueStatus/queue_status.py
+++ b/WebKitTools/CommitQueueStatus/queue_status.py
@@ -41,23 +41,37 @@ from google.appengine.ext import db
 
 webapp.template.register_template_library('filters.webkit_extras')
 
+
 class QueueStatus(db.Model):
     author = db.UserProperty()
+    queue_name = db.StringProperty()
     active_bug_id = db.IntegerProperty()
     active_patch_id = db.IntegerProperty()
     message = db.StringProperty(multiline=True)
     date = db.DateTimeProperty(auto_now_add=True)
 
+
 class MainPage(webapp.RequestHandler):
     def get(self):
-        statuses_query = QueueStatus.all().order('-date')
+        statuses_query = QueueStatus.all().filter('queue_name =', 'commit-queue').order('-date')
         statuses = statuses_query.fetch(6)
+        if not statuses:
+            return self.response.out.write("No status to report.")
         template_values = {
             'last_status' : statuses[0],
             'recent_statuses' : statuses[1:],
         }
         self.response.out.write(template.render('index.html', template_values))
 
+
+class PatchStatus(webapp.RequestHandler):
+    def get(self, queue_name, attachment_id):
+        statuses = QueueStatus.all().filter('queue_name =', queue_name).filter('active_patch_id =', attachment_id).order('-date')
+        if not statuses:
+            self.error(404)
+        self.response.out.write(statuses[0].message)
+
+
 class UpdateStatus(webapp.RequestHandler):
     def get(self):
         self.response.out.write(template.render('update_status.html', None))
@@ -66,6 +80,7 @@ class UpdateStatus(webapp.RequestHandler):
         string_value = self.request.get(name)
         try:
             int_value = int(string_value)
+            return int_value
         except ValueError, TypeError:
             pass
         return None
@@ -76,15 +91,19 @@ class UpdateStatus(webapp.RequestHandler):
         if users.get_current_user():
             queue_status.author = users.get_current_user()
 
+        queue_name = self.request.get('queue_name')
+        queue_status.queue_name = queue_name
         queue_status.active_bug_id = self._int_from_request('bug_id')
         queue_status.active_patch_id = self._int_from_request('patch_id')
         queue_status.message = self.request.get('status')
         queue_status.put()
         self.redirect('/')
 
+
 routes = [
     ('/', MainPage),
-    ('/update_status', UpdateStatus)
+    ('/update-status', UpdateStatus),
+    (r'/patch-status/(.*)/(.*)', PatchStatus),
 ]
 
 application = webapp.WSGIApplication(routes, debug=True)
diff --git a/WebKitTools/CommitQueueStatus/update_status.html b/WebKitTools/CommitQueueStatus/update_status.html
index edafba4..31e2615 100644
--- a/WebKitTools/CommitQueueStatus/update_status.html
+++ b/WebKitTools/CommitQueueStatus/update_status.html
@@ -1,5 +1,5 @@
-Update the current status of the commit-queue:
 <form name="update_status" method="post">
+Update status for a queue: <input name="queue_name">
  <div>
      Active Bug Id:
     <input name="bug_id">
@@ -8,11 +8,8 @@ Update the current status of the commit-queue:
      Active Patch Id:
     <input name="patch_id">
  </div>
- <div>
-     Space separated list of other bugs in queue:
-    <input name="bugs_in_queue">
- </div>
   <div>
+      Status Text:<br>
       <textarea name="status" rows="3" cols="60"></textarea>
   </div>
   <div><input type="submit" value="Add Status"></div>
diff --git a/WebKitTools/Scripts/modules/commands/queues.py b/WebKitTools/Scripts/modules/commands/queues.py
index cbd4f8f..7edd70d 100644
--- a/WebKitTools/Scripts/modules/commands/queues.py
+++ b/WebKitTools/Scripts/modules/commands/queues.py
@@ -106,7 +106,7 @@ class AbstractQueue(Command, WorkQueueDelegate):
     def execute(self, options, args, tool):
         self.options = options
         self.tool = tool
-        work_queue = WorkQueue(self)
+        work_queue = WorkQueue(self, self.name)
         work_queue.run()
 
 
@@ -131,7 +131,7 @@ class CommitQueue(AbstractQueue):
         if red_builders_names:
             red_builders_names = map(lambda name: "\"%s\"" % name, red_builders_names) # Add quotes around the names.
             return (False, "Builders [%s] are red. See http://build.webkit.org." % ", ".join(red_builders_names), None)
-        return (True, "Landing patch %s from bug %s." % (patch["id"], patch["bug_id"]), patch["bug_id"])
+        return (True, "Landing patch %s from bug %s." % (patch["id"], patch["bug_id"]), patch)
 
     def process_work_item(self, patch):
         self.run_bugzilla_tool(["land-attachment", "--force-clean", "--non-interactive", "--quiet", patch["id"]])
@@ -172,7 +172,7 @@ class StyleQueue(AbstractTryQueue):
         AbstractTryQueue.__init__(self)
 
     def should_proceed_with_work_item(self, patch):
-        return (True, "Checking style for patch %s on bug %s." % (patch["id"], patch["bug_id"]), patch["bug_id"])
+        return (True, "Checking style for patch %s on bug %s." % (patch["id"], patch["bug_id"]), patch)
 
     def process_work_item(self, patch):
         self.run_bugzilla_tool(["check-style", "--force-clean", patch["id"]])
@@ -193,7 +193,7 @@ class BuildQueue(AbstractTryQueue):
             self.run_bugzilla_tool(["build", self.port.flag(), "--force-clean", "--quiet"])
         except ScriptError, e:
             return (False, "Unable to perform a build.", None)
-        return (True, "Building patch %s on bug %s." % (patch["id"], patch["bug_id"]), patch["bug_id"])
+        return (True, "Building patch %s on bug %s." % (patch["id"], patch["bug_id"]), patch)
 
     def process_work_item(self, patch):
         self.run_bugzilla_tool(["build-attachment", self.port.flag(), "--force-clean", "--quiet", "--no-update", patch["id"]])
diff --git a/WebKitTools/Scripts/modules/statusbot.py b/WebKitTools/Scripts/modules/statusbot.py
index d9b54b3..048527a 100644
--- a/WebKitTools/Scripts/modules/statusbot.py
+++ b/WebKitTools/Scripts/modules/statusbot.py
@@ -46,24 +46,39 @@ http://wwwsearch.sourceforge.net/mechanize/
 """
     exit(1)
 
+import urllib2
+
+
 class StatusBot:
     default_host = "webkit-commit-queue.appspot.com"
 
     def __init__(self, host=default_host):
         self.statusbot_host = host
         self.statusbot_server_url = "http://%s" % self.statusbot_host
-        self.update_status_url = "%s/update_status" % self.statusbot_server_url
         self.browser = Browser()
 
-    def update_status(self, status, bug_id=None, patch_id=None):
+    def update_status(self, queue_name, status, patch):
         # During unit testing, statusbot_host is None
         if not self.statusbot_host:
             return
-        self.browser.open(self.update_status_url)
+
+        update_status_url = "%s/update-status" % self.statusbot_server_url
+        self.browser.open(update_status_url)
         self.browser.select_form(name="update_status")
-        if bug_id:
-            self.browser['bug_id'] = str(bug_id)
-        if patch_id:
-            self.browser['patch_id'] = str(patch_id)
+        self.browser['queue_name'] = queue_name
+        if patch:
+            if patch.get('bug_id'):
+                self.browser['bug_id'] = str(patch['bug_id'])
+            if patch.get('id'):
+                self.browser['patch_id'] = str(patch['id'])
         self.browser['status'] = status
         self.browser.submit()
+
+    def patch_status(self, queue_name, patch_id):
+        update_status_url = "%s/patch-status/%s/%s" % (self.statusbot_server_url, queue_name, patch_id)
+        try:
+            return urllib2.urlopen(update_status_url).read()
+        except urllib2.HTTPError, e:
+            if e.code == 404:
+                return None
+            raise e
diff --git a/WebKitTools/Scripts/modules/workqueue.py b/WebKitTools/Scripts/modules/workqueue.py
index 8e71481..997c8b7 100644
--- a/WebKitTools/Scripts/modules/workqueue.py
+++ b/WebKitTools/Scripts/modules/workqueue.py
@@ -38,6 +38,9 @@ from modules.scm import ScriptError
 from modules.statusbot import StatusBot
 
 class WorkQueueDelegate:
+    def queue_name(self):
+        raise NotImplementedError, "subclasses must implement"
+
     def queue_log_path(self):
         raise NotImplementedError, "subclasses must implement"
 
@@ -57,7 +60,7 @@ class WorkQueueDelegate:
         raise NotImplementedError, "subclasses must implement"
 
     def should_proceed_with_work_item(self, work_item):
-        # returns (safe_to_proceed, waiting_message, bug_id)
+        # returns (safe_to_proceed, waiting_message, patch)
         raise NotImplementedError, "subclasses must implement"
 
     def process_work_item(self, work_item):
@@ -68,7 +71,8 @@ class WorkQueueDelegate:
 
 
 class WorkQueue:
-    def __init__(self, delegate):
+    def __init__(self, name, delegate):
+        self._name = name
         self._delegate = delegate
         self._output_tee = OutputTee()
 
@@ -95,11 +99,11 @@ class WorkQueue:
                 if not work_item:
                     self._update_status_and_sleep("Empty queue.")
                     continue
-                (safe_to_proceed, waiting_message, bug_id) = self._delegate.should_proceed_with_work_item(work_item)
+                (safe_to_proceed, waiting_message, patch) = self._delegate.should_proceed_with_work_item(work_item)
                 if not safe_to_proceed:
                     self._update_status_and_sleep(waiting_message)
                     continue
-                self.status_bot.update_status(waiting_message, bug_id=bug_id)
+                self.status_bot.update_status(self._name, waiting_message, patch)
             except Exception, e:
                 # Don't try tell the status bot, in case telling it causes an exception.
                 self._sleep("Exception while preparing queue: %s." % e)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list