[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

eric at webkit.org eric at webkit.org
Thu Oct 29 20:33:51 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 6494ba47d4ded6fa0f31d103d09c9561fa6b4bb7
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 24 20:40:58 2009 +0000

    2009-09-17  Eric Seidel  <eric at webkit.org>
    
            Reviewed by David Levin.
    
            commit-queue needs web-based status reporting
            https://bugs.webkit.org/show_bug.cgi?id=29307
    
            Add a first-pass web-based status for the commit-queue.
            The bot is currently reachable at:
            http://webkit-commit-queue.appspot.com/
    
            * CommitQueueStatus/app.yaml: Added.
             - Application description file required by App Engine.
            * CommitQueueStatus/filters/__init__.py: Added.
             - Required by python to treat 'filters' as a module.
            * CommitQueueStatus/filters/webkit_extras.py: Added.
             - Support for turning 'bug 123' and 'patch 123' into links.
               This lets us use plain text strings in our logs yet display nice HTML (help prevent XSS attacks on the page).
            * CommitQueueStatus/index.html: Added.
            * CommitQueueStatus/index.yaml: Added.
             - Some auto-generated file from app engine.
            * CommitQueueStatus/queue_status.py: Added.
             - The core logic of this bot.  We could eventually split this file out into pieces.
            * CommitQueueStatus/stylesheets/main.css: Added.
             - Some basic lame-o CSS to make the page look less awful.
            * CommitQueueStatus/update_status.html: Added.
             - The form that the commit-queue (or a human) can use to update the status.
            * Scripts/bugzilla-tool:
             - Add some very basic update_status calls.
            * Scripts/modules/statusbot.py: Added.
             - Knows how to post to the CommitQueueStatus web application.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48730 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 75fec80..d375678 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,35 @@
+2009-09-17  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by David Levin.
+
+        commit-queue needs web-based status reporting
+        https://bugs.webkit.org/show_bug.cgi?id=29307
+
+        Add a first-pass web-based status for the commit-queue.
+        The bot is currently reachable at:
+        http://webkit-commit-queue.appspot.com/
+
+        * CommitQueueStatus/app.yaml: Added.
+         - Application description file required by App Engine.
+        * CommitQueueStatus/filters/__init__.py: Added.
+         - Required by python to treat 'filters' as a module.
+        * CommitQueueStatus/filters/webkit_extras.py: Added.
+         - Support for turning 'bug 123' and 'patch 123' into links.
+           This lets us use plain text strings in our logs yet display nice HTML (help prevent XSS attacks on the page).
+        * CommitQueueStatus/index.html: Added.
+        * CommitQueueStatus/index.yaml: Added.
+         - Some auto-generated file from app engine.
+        * CommitQueueStatus/queue_status.py: Added.
+         - The core logic of this bot.  We could eventually split this file out into pieces.
+        * CommitQueueStatus/stylesheets/main.css: Added.
+         - Some basic lame-o CSS to make the page look less awful.
+        * CommitQueueStatus/update_status.html: Added.
+         - The form that the commit-queue (or a human) can use to update the status.
+        * Scripts/bugzilla-tool:
+         - Add some very basic update_status calls.
+        * Scripts/modules/statusbot.py: Added.
+         - Knows how to post to the CommitQueueStatus web application.
+
 2009-09-24  David Kilzer  <ddkilzer at apple.com>
 
         <http://webkit.org/b/29712> mark-bug-fixed: add -m|--comment switch
diff --git a/WebKitTools/CommitQueueStatus/app.yaml b/WebKitTools/CommitQueueStatus/app.yaml
new file mode 100644
index 0000000..2756112
--- /dev/null
+++ b/WebKitTools/CommitQueueStatus/app.yaml
@@ -0,0 +1,11 @@
+application: webkit-commit-queue
+version: 1
+runtime: python
+api_version: 1
+
+handlers:
+- url: /stylesheets
+  static_dir: stylesheets
+
+- url: /.*
+  script: queue_status.py
diff --git a/WebKitTools/Scripts/modules/__init__.py b/WebKitTools/CommitQueueStatus/filters/__init__.py
similarity index 100%
copy from WebKitTools/Scripts/modules/__init__.py
copy to WebKitTools/CommitQueueStatus/filters/__init__.py
diff --git a/WebKitTools/CommitQueueStatus/filters/webkit_extras.py b/WebKitTools/CommitQueueStatus/filters/webkit_extras.py
new file mode 100644
index 0000000..6a08727
--- /dev/null
+++ b/WebKitTools/CommitQueueStatus/filters/webkit_extras.py
@@ -0,0 +1,44 @@
+# Copyright (C) 2009 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 django.template.defaultfilters import stringfilter
+from google.appengine.ext import webapp
+
+import re
+
+bug_regexp = re.compile(r"bug (?P<bug_id>\d+)")
+patch_regexp = re.compile(r"patch (?P<patch_id>\d+)")
+
+ at stringfilter
+def webkit_linkify(value):
+    value = bug_regexp.sub(r'<a href="http://webkit.org/b/\g<bug_id>">bug \g<bug_id></a>', value)
+    value = patch_regexp.sub(r'<a href="https://bugs.webkit.org/attachment.cgi?id=\g<patch_id>&action=prettypatch">patch \g<patch_id></a>', value)
+    return value
+
+register = webapp.template.create_template_register()
+register.filter(webkit_linkify)
diff --git a/WebKitTools/CommitQueueStatus/index.html b/WebKitTools/CommitQueueStatus/index.html
new file mode 100644
index 0000000..2b5aced
--- /dev/null
+++ b/WebKitTools/CommitQueueStatus/index.html
@@ -0,0 +1,28 @@
+<html>
+<head>
+    <title>WebKit Commit Queue Status</title>
+    <link type="text/css" rel="stylesheet" href="/stylesheets/main.css" />
+</head>
+<body>
+    <center>
+    <div id="current_status">
+        {{ last_status.message|force_escape|urlize|webkit_linkify|safe }}
+        <div id="last_status_date">As of {{ last_status.date|timesince }} ago</div>
+    </div>
+
+    <table id="recent_status_table">
+        <tr>
+            <th colspan=2>Recent Status</th>
+        </tr>
+        {% for recent_status in recent_statuses %}
+        <tr>
+            <td class='status_date'>{{ recent_status.date|timesince }} ago</td>
+            <td class="recent_status">{{ recent_status.message|force_escape|urlize|webkit_linkify|safe }}</td>
+        </tr>
+        {% endfor %}
+    </table>
+
+    <div id="footer"><a href="https://bugs.webkit.org/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=commit-queue%2B">queued bugs</a> | <a href="http://trac.webkit.org/wiki/CommitQueue">documentation</a> | <a href="http://webkit.org/">webkit.org</a></div>
+    </center>
+</body>
+</html>
diff --git a/WebKitTools/CommitQueueStatus/index.yaml b/WebKitTools/CommitQueueStatus/index.yaml
new file mode 100644
index 0000000..a3b9e05
--- /dev/null
+++ b/WebKitTools/CommitQueueStatus/index.yaml
@@ -0,0 +1,11 @@
+indexes:
+
+# AUTOGENERATED
+
+# This index.yaml is automatically updated whenever the dev_appserver
+# detects that a new type of query is run.  If you want to manage the
+# index.yaml file manually, remove the above marker line (the line
+# saying "# AUTOGENERATED").  If you want to manage some 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.
diff --git a/WebKitTools/CommitQueueStatus/queue_status.py b/WebKitTools/CommitQueueStatus/queue_status.py
new file mode 100644
index 0000000..30d2494
--- /dev/null
+++ b/WebKitTools/CommitQueueStatus/queue_status.py
@@ -0,0 +1,96 @@
+# Copyright (C) 2009 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.
+
+import cgi
+import os
+
+# Request a modern Django
+from google.appengine.dist import use_library
+use_library('django', '1.1')
+
+from google.appengine.ext.webapp import template
+from google.appengine.api import users
+from google.appengine.ext import webapp
+from google.appengine.ext.webapp.util import run_wsgi_app
+from google.appengine.ext import db
+
+webapp.template.register_template_library('filters.webkit_extras')
+
+class QueueStatus(db.Model):
+    author = db.UserProperty()
+    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 = statuses_query.fetch(6)
+        template_values = {
+            'last_status' : statuses[0],
+            'recent_statuses' : statuses[1:],
+        }
+        self.response.out.write(template.render('index.html', template_values))
+
+class UpdateStatus(webapp.RequestHandler):
+    def get(self):
+        self.response.out.write(template.render('update_status.html', None))
+
+    def _int_from_request(self, name):
+        string_value = self.request.get(name)
+        try:
+            int_value = int(string_value)
+        except ValueError, TypeError:
+            pass
+        return None
+
+    def post(self):
+        queue_status = QueueStatus()
+
+        if users.get_current_user():
+            queue_status.author = users.get_current_user()
+
+        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)
+]
+
+application = webapp.WSGIApplication(routes, debug=True)
+
+def main():
+    run_wsgi_app(application)
+
+if __name__ == "__main__":
+    main()
diff --git a/WebKitTools/CommitQueueStatus/stylesheets/main.css b/WebKitTools/CommitQueueStatus/stylesheets/main.css
new file mode 100644
index 0000000..55d3694
--- /dev/null
+++ b/WebKitTools/CommitQueueStatus/stylesheets/main.css
@@ -0,0 +1,26 @@
+body {
+  font-family: Verdana, Helvetica, sans-serif;
+}
+
+#current_status {
+    padding: 5px;
+    font-size: larger;
+}
+
+#last_status_date {
+    font-size: small;
+}
+
+.recent_status {
+    padding-left: 10px;
+}
+
+#recent_status_table {
+    font-size: small;
+    margin: 10px;
+}
+
+#footer {
+    font-size: small;
+    padding-top: 10px;
+}
diff --git a/WebKitTools/CommitQueueStatus/update_status.html b/WebKitTools/CommitQueueStatus/update_status.html
new file mode 100644
index 0000000..edafba4
--- /dev/null
+++ b/WebKitTools/CommitQueueStatus/update_status.html
@@ -0,0 +1,19 @@
+Update the current status of the commit-queue:
+<form name="update_status" method="post">
+ <div>
+     Active Bug Id:
+    <input name="bug_id">
+ </div>
+ <div>
+     Active Patch Id:
+    <input name="patch_id">
+ </div>
+ <div>
+     Space separated list of other bugs in queue:
+    <input name="bugs_in_queue">
+ </div>
+  <div>
+      <textarea name="status" rows="3" cols="60"></textarea>
+  </div>
+  <div><input type="submit" value="Add Status"></div>
+</form>
diff --git a/WebKitTools/Scripts/bugzilla-tool b/WebKitTools/Scripts/bugzilla-tool
index b965030..6b7e179 100755
--- a/WebKitTools/Scripts/bugzilla-tool
+++ b/WebKitTools/Scripts/bugzilla-tool
@@ -37,7 +37,7 @@ import subprocess
 import sys
 import time
 
-from datetime import datetime
+from datetime import datetime, timedelta
 from optparse import OptionParser, IndentedHelpFormatter, SUPPRESS_USAGE, make_option
 
 # Import WebKit-specific modules.
@@ -47,6 +47,7 @@ from modules.comments import bug_comment_from_commit_text
 from modules.logging import error, log, tee
 from modules.scm import CommitMessage, detect_scm_system, ScriptError
 from modules.buildbot import BuildBot
+from modules.statusbot import StatusBot
 
 def plural(noun):
     # This is a dumb plural() implementation which was just enough for our uses.
@@ -625,6 +626,7 @@ class LandPatchesFromCommitQueue(Command):
     def __init__(self):
         options = [
             make_option("--no-confirm", action="store_false", dest="confirm", default=True, help="Do not ask the user for confirmation before running the queue.  Dangerous!"),
+            make_option("--status-host", action="store", type="string", dest="status_host", default=StatusBot.default_host, help="Do not ask the user for confirmation before running the queue.  Dangerous!"),
         ]
         Command.__init__(self, 'Run the commit queue.', options=options)
         self._original_stdout = None
@@ -634,6 +636,10 @@ class LandPatchesFromCommitQueue(Command):
     queue_log_path = 'commit_queue.log'
     bug_logs_directory = 'commit_queue_logs'
 
+    log_date_format = "%Y-%m-%d %H:%M:%S"
+    sleep_duration_text = "5 mins"
+    seconds_to_sleep = 300
+
     def _tee_outputs_to_files(self, files):
         if not self._original_stdout:
             self._original_stdout = sys.stdout
@@ -645,10 +651,21 @@ class LandPatchesFromCommitQueue(Command):
             sys.stdout = self._original_stdout
             sys.stderr = self._original_stderr
 
-    @staticmethod
-    def _sleep(log_message):
-        log("%s  Sleeping 5 minutes... %s" % (log_message, datetime.now()))
-        time.sleep(300) # Wait 5 minutes
+    @classmethod
+    def _sleep_message(cls, message):
+        wake_time = datetime.now() + timedelta(seconds=cls.seconds_to_sleep)
+        return "%s Sleeping until %s (%s)." % (message, wake_time.strftime(cls.log_date_format), cls.sleep_duration_text)
+
+    @classmethod
+    def _sleep(cls, message):
+        log(cls._sleep_message(message))
+        time.sleep(cls.seconds_to_sleep)
+
+    def _update_status_and_sleep(self, message):
+        status_message = self._sleep_message(message)
+        self.status_bot.update_status(status_message)
+        log(status_message)
+        time.sleep(self.seconds_to_sleep)
 
     @staticmethod
     def _open_log_file(log_path):
@@ -686,7 +703,9 @@ class LandPatchesFromCommitQueue(Command):
                 error("User declined.")
 
         queue_log = self._add_log_to_output_tee(self.queue_log_path)
-        log("Running WebKit Commit Queue. %s" % datetime.now())
+        log("Running WebKit Commit Queue. %s" % datetime.now().strftime(self.log_date_format))
+
+        self.status_bot = StatusBot(host=options.status_host)
 
         while (True):
             # Either of these calls could throw URLError which shouldn't stop the queue.
@@ -695,16 +714,19 @@ class LandPatchesFromCommitQueue(Command):
                 # Fetch patches instead of just bug ids to that we validate reviewer/committer flags on every patch.
                 patches = tool.bugs.fetch_patches_from_commit_queue(reject_invalid_patches=True)
                 if not len(patches):
-                    self._sleep("Empty queue.")
+                    self._update_status_and_sleep("Empty queue.")
                     continue
                 patch_ids = map(lambda patch: patch['id'], patches)
                 first_bug_id = patches[0]['bug_id']
                 log("%s in commit queue [%s]" % (pluralize('patch', len(patches)), ", ".join(patch_ids)))
 
                 if not tool.buildbot.core_builders_are_green():
-                    self._sleep("Builders are red.")
+                    self._update_status_and_sleep("Builders (http://build.webkit.org) are red.")
                     continue
+
+                self.status_bot.update_status("Landing patches from bug %s." % first_bug_id, bug_id=first_bug_id)
             except Exception, e:
+                # Don't try tell the status bot, in case telling it causes an exception.
                 self._sleep("Exception while checking queue and bots: %s." % e)
                 continue
 
@@ -715,7 +737,7 @@ class LandPatchesFromCommitQueue(Command):
             self._run_command([bugzilla_tool_path, 'land-patches', '--force-clean', '--commit-queue', '--quiet', first_bug_id])
             self._remove_log_from_output_tee(bug_log)
 
-        log("Finished WebKit Commit Queue. %s" % datetime.now())
+        log("Finished WebKit Commit Queue. %s" % datetime.now().strftime(self.log_date_format))
         self._remove_log_from_output_tee(queue_log)
 
 
diff --git a/WebKitTools/Scripts/modules/statusbot.py b/WebKitTools/Scripts/modules/statusbot.py
new file mode 100644
index 0000000..9c9ba04
--- /dev/null
+++ b/WebKitTools/Scripts/modules/statusbot.py
@@ -0,0 +1,66 @@
+# Copyright (C) 2009 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.
+#
+# WebKit's Python module for interacting with the Commit Queue status page.
+
+# WebKit includes a built copy of BeautifulSoup in Scripts/modules
+# so this import should always succeed.
+from .BeautifulSoup import BeautifulSoup
+
+try:
+    from mechanize import Browser
+except ImportError, e:
+    print """
+mechanize is required.
+
+To install:
+sudo easy_install mechanize
+
+Or from the web:
+http://wwwsearch.sourceforge.net/mechanize/
+"""
+    exit(1)
+
+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):
+        self.browser.open(self.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['status'] = status
+        self.browser.submit()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list