pld-builder.new: PLD_Builder/request.py, PLD_Builder/request_handler_server...

glen glen at pld-linux.org
Wed Jun 2 19:32:52 CEST 2010


Author: glen                         Date: Wed Jun  2 17:32:52 2010 GMT
Module: pld-builder.new               Tag: HEAD
---- Log message:
- improve html/css to be able to refer specific build in queue.html

---- Files affected:
pld-builder.new/PLD_Builder:
   request.py (1.72 -> 1.73) , request_handler_server.py (1.14 -> 1.15) 

---- Diffs:

================================================================
Index: pld-builder.new/PLD_Builder/request.py
diff -u pld-builder.new/PLD_Builder/request.py:1.72 pld-builder.new/PLD_Builder/request.py:1.73
--- pld-builder.new/PLD_Builder/request.py:1.72	Sun May  9 02:59:51 2010
+++ pld-builder.new/PLD_Builder/request.py	Wed Jun  2 19:32:47 2010
@@ -14,7 +14,7 @@
 from config import config
 
 __all__ = ['parse_request', 'parse_requests']
-    
+
 def text(e):
     res = ""
     for n in e.childNodes:
@@ -36,7 +36,7 @@
 
 def is_blank(e):
     return e.nodeType == Element.TEXT_NODE and string.strip(e.nodeValue) == ""
-    
+
 class Group:
     def __init__(self, e):
         self.batches = []
@@ -92,16 +92,23 @@
         f.write("\n")
 
     def dump_html(self, f):
-        f.write("<p><b>%d</b>. %s from %s <small>%s, prio=%d, jobs=%d, %s</small><br/>\n" % \
-                (self.no,
-                 escape(time.strftime("%Y.%m.%d %H:%M:%S", time.localtime(self.time))),
-                 escape(self.requester),
-                 self.id, self.priority, self.max_jobs, string.join(self.flags)))
+        f.write(
+            "<div id=\"%(id)d\">"
+            "<a href=\"#%(id)d\")>%(id)d</a>. %(time)s from %(requester)s "
+            "<small>%(id)s, prio=%(priority)d, jobs=%(max_jobs)d, %(flags)s</small>\n"
+        % {
+            'id': self.no,
+            'time': escape(time.strftime("%Y.%m.%d %H:%M:%S", time.localtime(self.time))),
+            'requester': escape(self.requester),
+            'priority': self.priority,
+            'max_jobs': self.max_jobs,
+            'flags': string.join(self.flags)
+        })
         f.write("<ul>\n")
         for b in self.batches:
             b.dump_html(f, self.id)
         f.write("</ul>\n")
-        f.write("</p>\n")
+        f.write("</div>\n")
 
     def write_to(self, f):
         f.write("""
@@ -110,7 +117,7 @@
          <time>%d</time>
          <priority>%d</priority>
          <maxjobs>%d</maxjobs>\n""" % (self.id, self.no, string.join(self.flags),
-                    escape(self.requester_email), escape(self.requester), 
+                    escape(self.requester_email), escape(self.requester),
                     self.time, self.priority, self.max_jobs))
         for b in self.batches:
             b.write_to(f)
@@ -177,7 +184,7 @@
                 self.bconds_without.append(text(c))
             else:
                 log.panic("xml: evil batch child (%s)" % c.nodeName)
- 
+
     def is_done(self):
         ok = 1
         for b in self.builders:
@@ -185,7 +192,7 @@
             if not s.startswith("OK") and not s.startswith("SKIP") and not s.startswith("UNSUPP") and not s.startswith("FAIL"):
                 ok = 0
         return ok
-            
+
     def dump(self, f):
         f.write("  batch: %s/%s\n" % (self.src_rpm, self.spec))
         f.write("    info: %s\n" % self.info)
@@ -264,7 +271,7 @@
         for b in self.bconds_without:
             r = r + " --without " + b
         return r
-        
+
     def write_to(self, f):
         f.write("""
          <batch id='%s' depends-on='%s'>
@@ -272,9 +279,9 @@
            <command flags="%s">%s</command>
            <spec>%s</spec>
            <branch>%s</branch>
-           <info>%s</info>\n""" % (self.b_id, 
+           <info>%s</info>\n""" % (self.b_id,
                  string.join(map(lambda (b): b.b_id, self.depends_on)),
-                 escape(self.src_rpm), 
+                 escape(self.src_rpm),
                  escape(' '.join(self.command_flags)), escape(self.command),
                  escape(self.spec), escape(self.branch), escape(self.info)))
         if self.kernel != "":
@@ -289,7 +296,7 @@
             f.write("           <builder status='%s' time='%s'>%s</builder>\n" % \
                     (escape(self.builders_status[b]), self.builders_status_time[b], escape(b)))
         f.write("         </batch>\n")
-        
+
     def log_line(self, l):
         log.notice(l)
         if self.logfile != None:
@@ -352,7 +359,7 @@
 def parse_request(f):
     d = parseString(f)
     return build_request(d.documentElement)
-    
+
 def parse_requests(f):
     d = parseString(f)
     res = []

================================================================
Index: pld-builder.new/PLD_Builder/request_handler_server.py
diff -u pld-builder.new/PLD_Builder/request_handler_server.py:1.14 pld-builder.new/PLD_Builder/request_handler_server.py:1.15
--- pld-builder.new/PLD_Builder/request_handler_server.py:1.14	Sat May  8 20:23:00 2010
+++ pld-builder.new/PLD_Builder/request_handler_server.py	Wed Jun  2 19:32:47 2010
@@ -54,7 +54,8 @@
 
 def write_css():
 	css_file = path.www_dir + "/style.css"
-	if os.path.exists(css_file):
+	# skip if file exists and code is not newer
+	if os.path.exists(css_file) and os.stat(__file__).st_mtime < os.stat(css_file).st_mtime:
 		return
 
 	# css from www.pld-linux.org wiki theme, using css usage firebug plugin to cleanup
@@ -83,6 +84,23 @@
 
 	body {
 		position: relative;
+	}
+
+	div {
+		background-color: white;
+		margin: 10px 0px;
+		padding: 10px;
+	}
+	div > a {
+		font-weight: bold;
+		color: #5e5e5e;
+	}
+	div > a:hover {
+		color: #5e5e5e;
+	}
+	div:target {
+		background-color: #ffffcc;
+		color: black;
 	}
 }
 @media print {
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-builder.new/PLD_Builder/request.py?r1=1.72&r2=1.73&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-builder.new/PLD_Builder/request_handler_server.py?r1=1.14&r2=1.15&f=u



More information about the pld-cvs-commit mailing list