[Piuparts-commits] rev 300 - / piatti piatti/home/piupartsm/bin piatti/org/piuparts.debian.org/htdocs trunk

Holger Levsen holger at alioth.debian.org
Sun Mar 22 15:22:54 UTC 2009


Author: holger
Date: 2009-03-22 15:22:54 +0000 (Sun, 22 Mar 2009)
New Revision: 300

Added:
   piatti/home/piupartsm/bin/detect_stale_mounts
Modified:
   /
   piatti/README.txt
   piatti/org/piuparts.debian.org/htdocs/style.css
   trunk/TODO
   trunk/piuparts-report.py
Log:
dynamically create navigation, some more polishing


Property changes on: 
___________________________________________________________________
Name: svn:ignore
   + *.udeb
*.deb
*.gz
*.dsc
*.build
*.upload
*.changes


Modified: piatti/README.txt
===================================================================
--- piatti/README.txt	2009-03-22 12:43:22 UTC (rev 299)
+++ piatti/README.txt	2009-03-22 15:22:54 UTC (rev 300)
@@ -27,7 +27,7 @@
 
 piuparts installation from svn source
 -------------------------------------
-* sudo apt-get install apt python debootstrap lsof lsb-release python-debian make dpkg-dev docbook2x python-support docbook-xml asciidoc 
+* sudo apt-get install apt python debootstrap lsof lsb-release python-debian make dpkg-dev docbook2x python-support docbook-xml asciidoc dblatex
 * you need a webserver too, if you run the master
 * Copy 'svn://svn.debian.org/svn/piuparts/piatti/home/piupartss/bin/update-piuparts-setup' on the host and run it. It assumes you want to set it up in '/org/piuparts.debian.org' and does all further svn checkouts as well as source code installation. It needs the piupartss and piupartsm user set up as described below, though.
 * sudo ln -s /org/piuparts.debian.org/etc/ /etc/piuparts

Added: piatti/home/piupartsm/bin/detect_stale_mounts
===================================================================
--- piatti/home/piupartsm/bin/detect_stale_mounts	                        (rev 0)
+++ piatti/home/piupartsm/bin/detect_stale_mounts	2009-03-22 15:22:54 UTC (rev 300)
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# Copyright 2009 Holger Levsen (holger at layer-acht.org)
+# 
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+FILE=`mktemp`
+cp /proc/mounts $FILE
+
+if [ "$(grep -c /org/piuparts.debian.org/tmp $FILE)" -gt 1 ] ; then 
+	echo "More than one mountpoint below /org/piuparts.debian.org/tmp detected!"
+	echo
+	grep /org/piuparts.debian.org/tmp $FILE
+	echo
+	echo "Zero or one mountpoint is normal for piuparts operation, more is not."
+	echo "Please investigate and cleanup."
+fi
+rm $FILE


Property changes on: piatti/home/piupartsm/bin/detect_stale_mounts
___________________________________________________________________
Name: svn:executable
   + *

Modified: piatti/org/piuparts.debian.org/htdocs/style.css
===================================================================
--- piatti/org/piuparts.debian.org/htdocs/style.css	2009-03-22 12:43:22 UTC (rev 299)
+++ piatti/org/piuparts.debian.org/htdocs/style.css	2009-03-22 15:22:54 UTC (rev 300)
@@ -17,6 +17,10 @@
   padding: 0px;
 }
 
+em {
+  font-weight: bold;
+}
+
 p.note {
  font-family: sans-serif;
  color: #900;

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2009-03-22 12:43:22 UTC (rev 299)
+++ trunk/TODO	2009-03-22 15:22:54 UTC (rev 300)
@@ -4,7 +4,6 @@
 must for 0.36
 
 - document globalised config variables this in README
-- the sections in the nav bar are hardcoded atm..
 - rename packages.txt into $section_done_today.txt and include sections
 - create $section_packages.txt with into about all packages 
 - better header (link to FAQ, point out to read the bottom first..) for piuparts-logs

Modified: trunk/piuparts-report.py
===================================================================
--- trunk/piuparts-report.py	2009-03-22 12:43:22 UTC (rev 299)
+++ trunk/piuparts-report.py	2009-03-22 15:22:54 UTC (rev 300)
@@ -92,12 +92,12 @@
      </td>
     </tr>
       <td class="contentcell">
-      <a href="http://wiki.debian.org/piuparts">About</a>
+      <a href="http://wiki.debian.org/piuparts" target="_blank">About</a>
      </td>
     </tr>
     <tr class="normalrow">
      <td class="contentcell">
-      <a href="http://wiki.debian.org/piuparts/FAQ">FAQ</a> 
+      <a href="http://wiki.debian.org/piuparts/FAQ" target="_blank">FAQ</a> 
      </td>
      </tr>     
     <tr class="titlerow">
@@ -105,18 +105,49 @@
       Available reports
      </td>
     </tr>
+    $section_navigation
+    <tr class="titlerow">
+     <td class="titlecell">
+      Other Debian QA efforts
+     </td>
+    </tr>
     <tr class="normalrow">
      <td class="contentcell">
-      <a href="/sid/">sid</a> 
+      <a href="http://edos.debian.net" target="_blank">EDOS tools</a>
      </td>
     </tr>
     <tr class="normalrow">
      <td class="contentcell">
-      <a href="/squeeze/">squeeze</a> 
+      <a href="http://lintian.debian.org" target="_blank">Lintian</a>
      </td>
     </tr>
+    <tr class="normalrow">
+     <td class="contentcell">
+      <a href="http://packages.qa.debian.org" target="_blank">Package Tracking System</a>
+     </td>
+    <tr class="normalrow">
+     <td class="contentcell">
+      <a href="http://udd.debian.org" target="_blank">Ultimate Debian Database</a>
+     </td>
+    </tr>
+    </tr>
     <tr class="titlerow">
      <td class="titlecell">
+      Documentation
+     </td>
+    </tr>
+    <tr class="normalrow">
+     <td class="contentcell">
+      <a href="http://www.debian.org/doc/debian-policy/" target="_blank">Debian policy</a>
+     </td>
+    </tr>
+    <tr class="normalrow">
+     <td class="contentcell">
+      <a href="/doc" target="_blank">piuparts README</a>
+     </td>
+    </tr>
+    <tr class="titlerow">
+     <td class="titlecell">
       Last update
      </td>
     </tr>
@@ -247,11 +278,17 @@
       piuparts is a tool for testing that .deb packages can be installed, upgraded, and removed without problems. The
       name, a variant of something suggested by Tollef Fog Heen, is short for "<em>p</em>ackage <em>i</em>nstallation, 
       <em>up</em>grading <em>a</em>nd <em>r</em>emoval <em>t</em>esting <em>s</em>uite". 
-      <br>
+     </td>
+    </tr>
+    <tr class="normalrow">
+     <td class="contentcell2">
       It does this by  creating a minimal Debian installation in a chroot, and installing,
       upgrading, and removing packages in that environment, and comparing the state of the directory tree before and after. 
       piuparts reports any files that have been added, removed, or modified during this process.
-      <br>
+     </td>
+    </tr>
+    <tr class="normalrow">
+     <td class="contentcell2">
       piuparts is meant as a quality assurance tool for people who create .deb packages to test them before they upload 
       them to the Debian package archive.
      </td>
@@ -260,7 +297,7 @@
      <td class="contentcell2">
       To make sure piuparts is run on all packages, piuparts.debian.org was set up.
       <br>
-      piuparts.debian.org is a service running on <a href="http://db.debian.org/machines.cgi?host=piatti">piatti.debian.org</a>,
+      piuparts.debian.org is a service running on <a href="http://db.debian.org/machines.cgi?host=piatti" target="_blank">piatti.debian.org</a>,
       generously donated by <a href="http://hp.com/go/debian/" target="_blank">HP</a> and hosted at piuparts.cs.helsinki.fi by 
       the University of Helsinki, at the <a href="http://cs.helsinki.fi/index.en.html" target="_blank">Department of Computer Science</a> in Finland.
      </td>
@@ -369,53 +406,6 @@
     return str
 
 
-def write_log_list_page(filename, title, preface, logs):
-    packages = {}
-    for pathname, package, version in logs:
-        packages[package] = packages.get(package, []) + [(pathname, version)]
-
-    names = packages.keys()
-    names.sort()
-    lines = []
-    version_count = 0
-    for package in names:
-        versions = []
-        for pathname, version in packages[package]:
-            version_count += 1
-            versions.append("<a href='%s'>%s</a>" % 
-                            (html_protect(pathname), 
-                             html_protect(version)))
-        line = "<li>%s %s</li>\n" % (html_protect(package), 
-                                     ", ".join(versions))
-        lines.append(line)
-
-    htmlpage = string.Template(HTML_HEADER + LOG_LIST_BODY_TEMPLATE + HTML_FOOTER)
-    f = file(filename, "w")
-    f.write(htmlpage.safe_substitute( {
-                "time": time.strftime("%Y-%m-%d %H:%M %Z"),
-                "title": html_protect(title),
-                "section": html_protect(self._config.section),
-                "preface": preface,
-                "count": len(packages),
-                "versioncount": version_count,
-                "loglist": "".join(lines)
-            }))
-    f.close()
-
-
-def print_by_dir(output_directory, logs_by_dir):
-    for dir in logs_by_dir:
-        list = []
-        for basename in logs_by_dir[dir]:
-            assert basename.endswith(".log")
-            assert "_" in basename
-            package, version = basename[:-len(".log")].split("_")
-            list.append((os.path.join(dir, basename), package, version))
-        write_log_list_page(os.path.join(output_directory, dir + ".html"),
-                            title_by_dir[dir], 
-                            desc_by_dir[dir], list)
-
-
 def find_log_files(dir):
     return [name for name in os.listdir(dir) if name.endswith(".log")]
 
@@ -455,15 +445,72 @@
     f.close()
 
 
+def create_section_navigation(section_names):
+    tablerows = ""
+    for section in section_names:
+        tablerows += ("<tr class=\"normalrow\"><td class=\"contentcell\"><a href='/%s'>%s</a></td></tr>\n") % \
+                          (html_protect(section), html_protect(section))
+    return tablerows;
+
+
 class Section:
 
     def __init__(self, section):
         self._config = Config(section=section)
         self._config.read(CONFIG_FILE)
 
-    def output(self, master_directory, output_directory):
+    def write_log_list_page(self, filename, title, preface, logs):
+        packages = {}
+        for pathname, package, version in logs:
+            packages[package] = packages.get(package, []) + [(pathname, version)]
+
+        names = packages.keys()
+        names.sort()
+        lines = []
+        version_count = 0
+        for package in names:
+            versions = []
+            for pathname, version in packages[package]:
+                version_count += 1
+                versions.append("<a href='%s'>%s</a>" % 
+                                (html_protect(pathname), 
+                                 html_protect(version)))
+            line = "<li>%s %s</li>\n" % (html_protect(package), 
+                                         ", ".join(versions))
+            lines.append(line)
+
+        htmlpage = string.Template(HTML_HEADER + LOG_LIST_BODY_TEMPLATE + HTML_FOOTER)
+        f = file(filename, "w")
+        f.write(htmlpage.safe_substitute( {
+                    "section_navigation": create_section_navigation(self._section_names),
+                    "time": time.strftime("%Y-%m-%d %H:%M %Z"),
+                    "title": html_protect(title),
+                    "section": html_protect(self._config.section),
+                    "preface": preface,
+                    "count": len(packages),
+                    "versioncount": version_count,
+                    "loglist": "".join(lines)
+                }))
+        f.close()
+
+
+    def print_by_dir(self, output_directory, logs_by_dir):
+        for dir in logs_by_dir:
+            list = []
+            for basename in logs_by_dir[dir]:
+                assert basename.endswith(".log")
+                assert "_" in basename
+                package, version = basename[:-len(".log")].split("_")
+                list.append((os.path.join(dir, basename), package, version))
+            self.write_log_list_page(os.path.join(output_directory, dir + ".html"),
+                                title_by_dir[dir], 
+                                desc_by_dir[dir], list)
+
+
+    def output(self, master_directory, output_directory, section_names):
         logging.debug("-------------------------------------------")
         logging.debug("Running section " + self._config.section)
+        self._section_names = section_names
         self._master_directory = os.path.abspath(os.path.join(master_directory, self._config.section))
         if os.path.exists(self._master_directory):
 
@@ -487,7 +534,7 @@
             remove_old_logs(logs_by_dir, self._output_directory)
 
             logging.debug("Writing per-dir HTML pages")
-            print_by_dir(self._output_directory, logs_by_dir)
+            self.print_by_dir(self._output_directory, logs_by_dir)
     
             logging.debug("Loading and parsing Packages file")
             if 1:
@@ -515,6 +562,7 @@
                          st.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( {
+                "section_navigation": create_section_navigation(self._section_names),
                 "time": time.strftime("%Y-%m-%d %H:%M %Z"),
                 "section": html_protect(self._config.section),
                 "description": html_protect(self._config["description"]),
@@ -539,6 +587,7 @@
                 list += "</ul>\n"
                 htmlpage = string.Template(HTML_HEADER + STATE_BODY_TEMPLATE + HTML_FOOTER)
                 write_file(os.path.join(self._output_directory, "state-%s.html" % state), htmlpage.safe_substitute( {
+                                            "section_navigation": create_section_navigation(self._section_names),
                                             "time": time.strftime("%Y-%m-%d %H:%M %Z"),
                                             "state": html_protect(state),
                                             "section": html_protect(self._config.section),
@@ -564,12 +613,13 @@
     sections = []
     for section_name in section_names:
         section = Section(section_name)
-        section.output(master_directory=global_config["master-directory"],output_directory=global_config["output-directory"])
+        section.output(master_directory=global_config["master-directory"],output_directory=global_config["output-directory"],section_names=section_names)
         sections.append(section)
 
     logging.debug("Writing index page")
     htmlpage = string.Template(HTML_HEADER + INDEX_BODY_TEMPLATE + HTML_FOOTER)
     write_file(os.path.join(global_config["output-directory"],"index.html"), htmlpage.safe_substitute( {
+                                 "section_navigation": create_section_navigation(section_names),
                                  "time": time.strftime("%Y-%m-%d %H:%M %Z"),
                               }))
 




More information about the Piuparts-commits mailing list