[pypy-svn] r40446 - in pypy/branch/guido-buildtool-web/pypy/tool/build: . test web web/templates

guido at codespeak.net guido at codespeak.net
Tue Mar 13 16:40:11 CET 2007


Author: guido
Date: Tue Mar 13 16:40:10 2007
New Revision: 40446

Modified:
   pypy/branch/guido-buildtool-web/pypy/tool/build/metaserver.py
   pypy/branch/guido-buildtool-web/pypy/tool/build/test/test_metaserver.py
   pypy/branch/guido-buildtool-web/pypy/tool/build/web/app.py
   pypy/branch/guido-buildtool-web/pypy/tool/build/web/templates/build.html
   pypy/branch/guido-buildtool-web/pypy/tool/build/web/templates/serverstatus.html
Log:
Removed log from the build page for now because it seems to make browsers
barf ;), changed the return value of MetaServer.compile() from a tuple to
a dict so it can contain more info a bit easier, removed some lost xmlns
declaration from a template.


Modified: pypy/branch/guido-buildtool-web/pypy/tool/build/metaserver.py
==============================================================================
--- pypy/branch/guido-buildtool-web/pypy/tool/build/metaserver.py	(original)
+++ pypy/branch/guido-buildtool-web/pypy/tool/build/metaserver.py	Tue Mar 13 16:40:10 2007
@@ -84,30 +84,36 @@
         """
         # store the request, if there's already a build available the
         # storage will return that path
+        requestid = request.id()
         for bp in self._done:
             if request.has_satisfying_data(bp.request):
                 path = str(bp)
                 self._channel.send('already a build for this info available')
-                return (True, path)
+                return {'path': path, 'id': requestid, 'isbuilding': True,
+                        'message': 'build is already available'}
         for builder in self._builders:
             if builder.busy_on and request.has_satisfying_data(builder.busy_on):
                 self._channel.send(
                     "build for %s currently in progress on '%s'" % (
                         request, builder.hostname))
                 self._waiting.append(request)
-                return (False, "this build is already in progress on '%s'" % (
-                    builder.hostname, ))
+                return {'path': None, 'id': requestid, 'isbuilding': True,
+                        'message': "this build is already in progress "
+                                   "on '%s'" % (builder.hostname,)}
         # we don't have a build for this yet, find a builder to compile it
         hostname = self.run(request)
         if hostname is not None:
-            return (False, "found a suitable server, going to build on '%s'" %
-                    (hostname, ))
+            return {'path': None, 'id': requestid, 'isbuilding': True,
+                    'message': "found a suitable server, going to build "
+                               "on '%s'" % (hostname, )}
         self._queuelock.acquire()
         try:
             self._queued.append(request)
         finally:
             self._queuelock.release()
-        return (False, 'no suitable build server found; your request is queued')
+        return {'path': None, 'id': requestid, 'isbuilding': False,
+                'message': 'no suitable build server found; your request '
+                           'is queued'}
     
     def run(self, request):
         """find a suitable build server and run the job if possible"""

Modified: pypy/branch/guido-buildtool-web/pypy/tool/build/test/test_metaserver.py
==============================================================================
--- pypy/branch/guido-buildtool-web/pypy/tool/build/test/test_metaserver.py	(original)
+++ pypy/branch/guido-buildtool-web/pypy/tool/build/test/test_metaserver.py	Tue Mar 13 16:40:10 2007
@@ -54,9 +54,10 @@
     br = build.BuildRequest('foo at bar.com', {'foo': 1}, {},
                             str(repodir), 'HEAD', 0)
     ret = svr.compile(br)
-    assert not ret[0]
-    assert ret[1].find('found a suitable server') > -1
-    assert "fake" in ret[1] # hostname
+    assert not ret['path']
+    assert ret['isbuilding']
+    assert ret['message'].find('found a suitable server') > -1
+    assert "fake" in ret['message'] # hostname
     ret = svr._channel.receive()
     assert ret.find('going to send compile job') > -1
     acceptedmsg = svr._channel.receive()
@@ -87,8 +88,9 @@
     br4 = build.BuildRequest('foo at spam.com', {'foo': 1}, {},
                              str(repodir), 'HEAD', 0)
     ret = svr.compile(br4)
-    assert not ret[0]
-    assert ret[1].find('this build is already') > -1
+    assert not ret['path']
+    assert ret['message'].find('this build is already') > -1
+    assert ret['isbuilding']
     assert svr._channel.receive().find('currently in progress') > -1
 
     c1.busy_on = None
@@ -99,9 +101,10 @@
     clone = build.BuildRequest.fromstring(bp.request.serialize())
     clone.email = 'test at domain.com'
     ret = svr.compile(clone)
-    assert ret[0]
-    assert isinstance(ret[1], str)
-    assert build.BuildPath(ret[1]) == bp
+    assert ret['path']
+    assert ret['isbuilding']
+    assert isinstance(ret['path'], str)
+    assert build.BuildPath(ret['path']) == bp
     ret = svr._channel.receive()
     assert ret.find('compilation done for') > -1
     for i in range(2):

Modified: pypy/branch/guido-buildtool-web/pypy/tool/build/web/app.py
==============================================================================
--- pypy/branch/guido-buildtool-web/pypy/tool/build/web/app.py	(original)
+++ pypy/branch/guido-buildtool-web/pypy/tool/build/web/app.py	Tue Mar 13 16:40:10 2007
@@ -146,6 +146,8 @@
                                         '"%s"' % (self._buildid,))
                 log = info['log']
                 error = info['error']
+                if error == 'None':
+                    error = None
                 if error:
                     status = 'failed'
                 else:

Modified: pypy/branch/guido-buildtool-web/pypy/tool/build/web/templates/build.html
==============================================================================
--- pypy/branch/guido-buildtool-web/pypy/tool/build/web/templates/build.html	(original)
+++ pypy/branch/guido-buildtool-web/pypy/tool/build/web/templates/build.html	Tue Mar 13 16:40:10 2007
@@ -50,11 +50,13 @@
           <span>%(build_end_time)s</span>
         </div>
       %(build_end_time)]c
-      %(log)[c
+      <!--
+      %%(log)[c
       <div>
-        <pre>%(log)s</pre>
+        <pre>%%(log)s</pre>
       </div>
-      %(log)]c
+      %%(log)]c
+      -->
     </div>
   </body>
 </html>

Modified: pypy/branch/guido-buildtool-web/pypy/tool/build/web/templates/serverstatus.html
==============================================================================
--- pypy/branch/guido-buildtool-web/pypy/tool/build/web/templates/serverstatus.html	(original)
+++ pypy/branch/guido-buildtool-web/pypy/tool/build/web/templates/serverstatus.html	Tue Mar 13 16:40:10 2007
@@ -1,4 +1,4 @@
-<html xmlns:t="http://johnnydebris.net/xmlns/templess">
+<html>
   <head>
     <title>Build meta server status page</title>
   </head>



More information about the Pypy-commit mailing list