[Piuparts-commits] rev 390 - piatti/org/piuparts.debian.org/htdocs trunk trunk/debian trunk/piupartslib

Holger Levsen holger at alioth.debian.org
Mon May 4 23:21:06 UTC 2009


Author: holger
Date: 2009-05-04 23:21:06 +0000 (Mon, 04 May 2009)
New Revision: 390

Modified:
   piatti/org/piuparts.debian.org/htdocs/style.css
   trunk/TODO
   trunk/debian/changelog
   trunk/piuparts-report.py
   trunk/piupartslib/packagesdb.py
Log:
   - create maintainer centric pages for each email address found in 
     Maintainers or Uploaders



Modified: piatti/org/piuparts.debian.org/htdocs/style.css
===================================================================
--- piatti/org/piuparts.debian.org/htdocs/style.css	2009-05-04 14:38:28 UTC (rev 389)
+++ piatti/org/piuparts.debian.org/htdocs/style.css	2009-05-04 23:21:06 UTC (rev 390)
@@ -253,6 +253,13 @@
     border-bottom: 1px solid #999;
 }
 td.labelcell {
+    vertical-align: top;
+    text-align: left;
+    padding: 0.2em 0.3em 0.2em 0.3em;
+    border-bottom: 1px dotted #999;
+    font-weight: bold;
+}
+td.labelcell2 {
     padding: 0.2em 0.2em 0.1em 0.2em;
     border-top: 1px solid black;
     border-right: 1px dotted black;
@@ -271,6 +278,7 @@
 }
 td.contentcell2 {
     text-align: left;
+    vertical-align: top;
     padding: 0.2em 0.3em 0.2em 0.3em;
     border-bottom: 1px dotted #999;
     border-right: 1px dotted #999;

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2009-05-04 14:38:28 UTC (rev 389)
+++ trunk/TODO	2009-05-04 23:21:06 UTC (rev 390)
@@ -5,16 +5,17 @@
 
 - report:
  - refactor code, search for FIXME
+  - esp. these new maintainer packages...
+ - maintainer-pages: 
+  - if uploaders if empty, dont display it
+  - different background color for links to failed logs 
+  - assemble maintainer pages differently, to be able to sort them alphabetically + by section
  - sources.txt should not be calculated where it currently is (or maybe yes..)
  - packages.txt for binary packages
  - get rid of old log pages and put stats in the index page
  - do fancy R graphs with the data from $distro/counts.txt
   - also per state
- - create maintainer centric pages.
-  - also create pages for uploaders
 
-- udebs turn up as a state - see http://piuparts.debian.org/source/u/udev.html
-
 - take care of old conf files on upgrades
 	/etc/piuparts/piuparts-master.conf
 	/etc/piuparts/piuparts-slave.conf
@@ -86,6 +87,8 @@
 
 - publish FAI classes to setup piuparts.$fqdn automatically 
 
+- a redirect of http://piuparts.d.o/foo to http://p.d.o/source/f/foo.html would be nice
+
 - release 0.37 before debconf9
 
 for 0.38 and on:

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2009-05-04 14:38:28 UTC (rev 389)
+++ trunk/debian/changelog	2009-05-04 23:21:06 UTC (rev 390)
@@ -53,6 +53,8 @@
       as links to the dependencies state.
     - draw graphs of package states over time (if pypthon-rpy and gs are 
       installed).
+    - create maintainer centric pages for each email address found in 
+      Maintainers or Uploaders
     - improve layout, generate navigation for all pages.
   * Break backwards compatibility of the configuration files for master-slave-
     mode. Merge those three into one: /etc/piuparts/piuparts/piuparts.conf.

Modified: trunk/piuparts-report.py
===================================================================
--- trunk/piuparts-report.py	2009-05-04 14:38:28 UTC (rev 389)
+++ trunk/piuparts-report.py	2009-05-04 23:21:06 UTC (rev 390)
@@ -31,6 +31,7 @@
 import urllib
 import shutil
 import string
+import re
 
 # if python-rpy ain't installed, we don't draw fancy graphs
 try:
@@ -127,6 +128,11 @@
     </tr>     
     <tr>
      <td class="contentcell">
+      <a href="/maintainer/">by maintainer</a> 
+     </td>
+    </tr>     
+    <tr>
+     <td class="contentcell">
       <a href="http://bugs.debian.org/cgi-bin/pkgreport.cgi?tag=piuparts;users=debian-qa@lists.debian.org&archive=both" target="_blank">Bugs filed</a> 
      </td>
     </tr>     
@@ -273,11 +279,6 @@
 
 SOURCE_PACKAGE_BODY_TEMPLATE = """
    <table class="righttable">
-    <tr class="titlerow">
-     <td class="titlecell" colspan="3">
-      Source package
-     </td>
-    </tr>
     $rows
    </table>
 """
@@ -445,6 +446,8 @@
     else:
       return source[:1]
 
+def maintainer_subdir(maintainer):
+    return maintainer.lower()[:1]
 
 def find_files_with_suffix(dir,suffix):
     name=[name for name in os.listdir(dir) if name.endswith(suffix)]
@@ -507,7 +510,7 @@
                           (html_protect(section), html_protect(section))
     return tablerows;
 
-def merge_templates(templates, section_names, source_pages_output_dir):
+def merge_source_templates(templates, section_names, source_pages_output_dir):
     logging.debug("Merging package templates from %s" % section_names)
     for src_tpl in templates:
         source_tpl = os.path.join(source_pages_output_dir,source_subdir(src_tpl),src_tpl)
@@ -518,7 +521,7 @@
         template_path = source_tpl[:-len(".tpl_src")]
 
         for section in section_names:
-            section_tpl = os.path.join(template_path+".tpl_"+section)
+            section_tpl = os.path.join(template_path+".tpl_src"+section)
             if os.path.isfile(section_tpl):
                  f = file(section_tpl, "r")
                  rows += file.read(f)
@@ -536,11 +539,54 @@
          }))
         f.close()
 
+def merge_maintainer_templates(templates, section_names, source_pages_output_dir):
+    logging.debug("Merging maintainer templates from %s" % section_names)
+    for src_tpl in templates:
+        source_tpl = os.path.join(source_pages_output_dir,maintainer_subdir(src_tpl),src_tpl)
+        f = file(source_tpl, "r")
+        rows = file.read(f)
+        f.close()
+        os.unlink(source_tpl)
+        template_path = source_tpl[:-len(".tpl_maint")]
+
+        for section in section_names:
+            section_tpl = os.path.join(template_path+".tpl_maint"+section)
+            if os.path.isfile(section_tpl):
+                 f = file(section_tpl, "r")
+                 rows += file.read(f)
+                 f.close()
+                 os.unlink(section_tpl)
+ 
+        htmlpage = string.Template(HTML_HEADER + SOURCE_PACKAGE_BODY_TEMPLATE + HTML_FOOTER)
+        package = os.path.basename(src_tpl)[:-len(".tpl_maint")]
+        filename = os.path.join(source_pages_output_dir,maintainer_subdir(package),package+".html")
+        f = file(filename, "w")
+        f.write(htmlpage.safe_substitute( {
+           "section_navigation": create_section_navigation(section_names),
+           "time": time.strftime("%Y-%m-%d %H:%M %Z"),
+           "rows": rows,
+         }))
+        f.close()
+
+def get_email_address(maintainer):
+    email = "INVALID maintainer address: %s" % (maintainer)
+    try:
+      m = re.match(r"(.+)(<)(.+ at .+)(>)", maintainer)
+      email = m.group(3)
+    except:
+      pass
+    return email
+
 def assemble_source_pages(output_directory,section_names):
     logging.debug("Assembling all source package summaries in %s" % output_directory)    
     templates = find_files_with_suffix(output_directory, ".tpl_src")
-    merge_templates(templates, section_names, output_directory)
+    merge_source_templates(templates, section_names, output_directory)
 
+def assemble_maintainer_pages(output_directory,section_names):
+    logging.debug("Assembling all maintainer summaries in %s" % output_directory)    
+    templates = find_files_with_suffix(output_directory, ".tpl_maint")
+    merge_maintainer_templates(templates, section_names, output_directory)
+
 class Section:
 
     def __init__(self, section):
@@ -621,7 +667,7 @@
         return links
 
     def link_to_source_summary(self, package_name):
-        source_name = self._binary_db.get_source_package(package_name)
+        source_name = self._binary_db.get_control_header(package_name, "Source")
         link = "<a href=\"/source/%s\">%s</a>" % (
                 source_subdir(source_name)+"/"+source_name+".html",
                 html_protect(package_name))
@@ -688,44 +734,64 @@
 
         sources = ""
         for source in self._source_db.get_all_packages():
+            # FIXME: ie those six next lines yell it (the whole logic below... :()
+            source_summary_page_path = os.path.join(self._output_directory, "../source", source_subdir(source))
+            if not os.path.exists(source_summary_page_path):
+               os.makedirs(source_summary_page_path)
 
-            summary_page_path = os.path.join(self._output_directory, "../source", source_subdir(source))
-            if not os.path.exists(summary_page_path):
-               os.makedirs(summary_page_path)
-
+            source_version = self._source_db.get_control_header(source, "Version")
             binaries = self._source_db.get_control_header(source, "Binary")
-            current_source_version = self._source_db.get_control_header(source, "Version")
             maintainer = self._source_db.get_control_header(source, "Maintainer")
+            uploaders = self._source_db.get_control_header(source, "Uploaders")
 
-            sourcerows = "<tr class=\"normalrow\"><td class=\"contentcell2\"><a href=\"http://packages.qa.debian.org/%s\" target=\"_blank\">%s</a></td><td class=\"contentcell2\" colspan=\"2\">%s</td></tr>" % (source, html_protect(source), html_protect(maintainer))
+            maintainer_pages = [] 
+            maintainer_pages.append(get_email_address(maintainer))
+            for uploader in uploaders.split(", "):
+              if uploader:
+                maintainer_pages.append(get_email_address(uploader))
 
-            filename = os.path.join(summary_page_path, (source + ".tpl_src"))
-            # don't write header if it already exists (=it was created in an previous section)
-            if not os.path.isfile(filename):
-                f = file(filename, "w")
-                f.write(sourcerows)
-                f.close()
-
             success = True
             failed = False
-            binaryrows = "<tr class=\"titlerow\"><td class=\"bluetitlecell\" colspan=\"3\">Binary package(s) in "+self._config.section+"</td></tr>"
+            binaryrows = ""
             for binary in binaries.split(", "):
               state = self._binary_db.state_by_name(binary)
-              binaryrows += "<tr class=\"normalrow\"><td class=\"contentcell2\">%s</td><td class=\"contentcell2\">%s: %s</td><td class=\"contentcell2\">current: %s</td></tr>" % (binary, self.link_to_state_page(self._config.section,binary,state), self.links_to_logs(binary, state, logs_by_dir), current_source_version)
+              current_version = self._source_db.get_control_header(source, "Version")
+              binaryrows += "<tr class=\"normalrow\"><td class=\"labelcell\">Binary:</td><td class=\"contentcell2\">%s</td><td class=\"labelcell\">Version:</td><td class=\"contentcell2\">%s</td><td class=\"labelcell\">piuparts result:</td><td class=\"contentcell2\">%s %s</td><td class=\"labelcell\">Uploaders:</td><td class=\"contentcell2\">%s</td></tr>" %  (binary, current_version, self.link_to_state_page(self._config.section,binary,state), self.links_to_logs(binary, state, logs_by_dir),html_protect(uploaders))
               if state != "successfully-tested":
                 success = False
               if state == "failed-testing":
                 failed = True
-            filename = os.path.join(summary_page_path, (source + ".tpl_"+self._config.section))
-            f = file(filename, "w")
-            f.write(binaryrows)
-            f.close()
 
             source_state="unknown"
             if success: source_state="success"
             if failed:  source_state="failed"
             sources += "%s: %s\n" % (source, source_state)
 
+            sourcerows = "<tr class=\"titlerow\"><td class=\"titlecell\" colspan=\"8\">%s in %s</td></tr>" % (source, self._config.section)
+            sourcerows += "<tr class=\"normalrow\"><td class=\"labelcell\">Source:</td><td class=\"contentcell2\"><a href=\"http://packages.qa.debian.org/%s\" target=\"_blank\">%s</a></td><td class=\"labelcell\">Version:</td><td class=\"contentcell2\">%s</td><td class=\"labelcell\">piuparts summary:</td><td class=\"contentcell2\">%s</td><td class=\"labelcell\">Maintainer:</td><td class=\"contentcell2\">%s</td></tr>" % (source, html_protect(source), html_protect(source_version),source_state,html_protect(maintainer))
+            
+            filename = os.path.join(source_summary_page_path, (source + ".tpl_src"))
+            if not os.path.isfile(filename):
+              write_file(filename, "")
+            for maintainer_page in maintainer_pages:
+              maintainer_summary_page_path = os.path.join(self._output_directory, "../maintainer", maintainer_subdir(maintainer_page))
+              if not os.path.exists(maintainer_summary_page_path):
+                os.makedirs(maintainer_summary_page_path)
+              filename = os.path.join(maintainer_summary_page_path, (maintainer_page + ".tpl_maint"))
+              # don't write header if it already exists (=it was created in an previous section)
+              if not os.path.isfile(filename):
+                write_file(filename, "")
+
+            for maintainer_page in maintainer_pages:
+              maintainer_summary_page_path = os.path.join(self._output_directory, "../maintainer", maintainer_subdir(maintainer_page))
+              append_file(os.path.join(maintainer_summary_page_path, (maintainer_page + ".tpl_maint"+self._config.section)), sourcerows)
+            append_file(os.path.join(source_summary_page_path, (source + ".tpl_src"+self._config.section)), sourcerows)
+
+            for maintainer_page in maintainer_pages:
+              maintainer_summary_page_path = os.path.join(self._output_directory, "../maintainer", maintainer_subdir(maintainer_page))
+              append_file(os.path.join(maintainer_summary_page_path, (maintainer_page + ".tpl_maint"+self._config.section)),binaryrows)
+            append_file(os.path.join(source_summary_page_path, (source + ".tpl_src"+self._config.section)), binaryrows)
+ 
         write_file(os.path.join(self._output_directory, "sources.txt"), sources)
 
 
@@ -775,7 +841,7 @@
         except:
           logging.debug("python-rpy not installed, disabled graphs.")
 
-        tablerows += "<tr class=\"normalrow\"> <td class=\"labelcell\">Total</td> <td class=\"labelcell\" colspan=\"2\">%d</td></tr>\n" % \
+        tablerows += "<tr class=\"normalrow\"> <td class=\"labelcell2\">Total</td> <td class=\"labelcell\" colspan=\"2\">%d</td></tr>\n" % \
                           self._binary_db.get_total_packages()
         htmlpage = string.Template(HTML_HEADER + SECTION_STATS_BODY_TEMPLATE + HTML_FOOTER)
         write_file(os.path.join(self._output_directory, "index.html"), htmlpage.safe_substitute( {
@@ -857,6 +923,7 @@
         sections.append(section)
 
     assemble_source_pages(os.path.join(global_config["output-directory"],"source"),section_names)
+    assemble_maintainer_pages(os.path.join(global_config["output-directory"],"maintainer"),section_names)
 
     logging.debug("Writing index page")
     htmlpage = string.Template(HTML_HEADER + INDEX_BODY_TEMPLATE + HTML_FOOTER)

Modified: trunk/piupartslib/packagesdb.py
===================================================================
--- trunk/piupartslib/packagesdb.py	2009-05-04 14:38:28 UTC (rev 389)
+++ trunk/piupartslib/packagesdb.py	2009-05-04 23:21:06 UTC (rev 390)
@@ -377,22 +377,31 @@
         return self._packages
 
     def get_control_header(self, package_name, header):
-        return self._packages[package_name][header]
+        if header == "Source":
+          # binary packages build from the source package with the same name
+          # don't have a Source header, so let's try:
+          try:
+            _source = self._packages[package_name][header]
+            # for binNMU the Source header in Packages files holds the version 
+            # too, so we need to chop it of:
+            if " " in _source:
+              source, version = _source.split(" ")
+            else:
+              source = _source
+          except:
+            source = self._packages[package_name]["Package"]
+          return source
+        elif header == "Uploaders":
+          # not all (source) packages have an Uploaders header
+          uploaders = ""
+          try:
+            uploaders = self._packages[package_name][header]
+          except:
+            pass
+          return uploaders
+        else:
+          return self._packages[package_name][header]
 
-    def get_source_package(self, package_name):
-        version = self._packages[package_name]["Version"]
-        try:
-          _source = self._packages[package_name]["Source"]
-          # for binNMU the Source header in Packages files hold the version too
-          if " " in _source:
-            source, version = _source.split(" ")
-          else:
-            source = _source
-        except:
-          source = self._packages[package_name]["Package"]
-        # we could return version here too, but it wont be used atm
-        return source
-
     def get_package_state(self, package_name):
         return self._package_state[package_name]
 




More information about the Piuparts-commits mailing list