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

Holger Levsen holger at alioth.debian.org
Tue May 5 19:07:25 UTC 2009


Author: holger
Date: 2009-05-05 19:07:24 +0000 (Tue, 05 May 2009)
New Revision: 393

Modified:
   piatti/org/piuparts.debian.org/htdocs/style.css
   trunk/TODO
   trunk/debian/changelog
   trunk/piuparts-report.py
   trunk/piupartslib/packagesdb.py
Log:
  - fix get_packages_in_state() to only return unique packages and not also 
    the provided ones as exact copies.
  - emphasize dependencies with problems in package and maintainer overview
    pages


Modified: piatti/org/piuparts.debian.org/htdocs/style.css
===================================================================
--- piatti/org/piuparts.debian.org/htdocs/style.css	2009-05-05 13:44:32 UTC (rev 392)
+++ piatti/org/piuparts.debian.org/htdocs/style.css	2009-05-05 19:07:24 UTC (rev 393)
@@ -268,6 +268,15 @@
     border-bottom: 1px dotted #999;
     font-weight: bold;
 }
+td.lightbluelabelcell {
+    color: white;
+    background-color: #a0a0ff;
+    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;

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2009-05-05 13:44:32 UTC (rev 392)
+++ trunk/TODO	2009-05-05 19:07:24 UTC (rev 393)
@@ -9,6 +9,7 @@
  - maintainer-pages: 
   - assemble maintainer pages differently, to be able to sort them alphabetically + by section
   - http://piuparts.debian.org/source/a/awesome.html should display bugged logs
+  - split per section, do the same for source package, provide link to page in other section if existant
  - http://piuparts.debian.org/sid/state-dependency-does-not-exist.html:
    "dependency unknown package is unknown-package"
  - sources.txt should not be calculated where it currently is (or maybe yes..)
@@ -16,9 +17,8 @@
  - 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
+- PackagesDB: get rid of 50% of unique() :)
 
-- packagesdb.py: get_packages_in_state() returns each provided package too, so there is 3 times bonnie++ in the states 
-
 - take care of old conf files on upgrades
 	/etc/piuparts/piuparts-master.conf
 	/etc/piuparts/piuparts-slave.conf

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2009-05-05 13:44:32 UTC (rev 392)
+++ trunk/debian/changelog	2009-05-05 19:07:24 UTC (rev 393)
@@ -26,6 +26,8 @@
       as important packages can be tested like all the others.
     - handle binNMUs where the Source header in the Packages file includes the 
       Version and the Source package name in one line.
+    - fix get_packages_in_state() to only return unique packages and not also 
+      the provided ones as exact copies.
   * Install scripts for master-slave mode without .py extension.
   * piuparts-master.py: remove code to write statistics, that is done only in 
     piuparts-report.py now.
@@ -72,7 +74,7 @@
     - remove build-dependencies on docbook2x and docbook-xml.
     - suggest python-rpy and gs to improve piuparts-report output.
     - set Homepage: to http://piuparts.debian.org
-    - bump Standards-Version to 3.8.1, no changes neccessary.
+    - bump Standards-Version to 3.8.1, no changes necessary.
   * Rewrite debian/rules from scratch using debhelper.
   * Merge README, how-to-use-piuparts.txt and custom-scripts.txt into 
     README.txt, convert it to asciidoc and build pdf and html versions of it. 

Modified: trunk/piuparts-report.py
===================================================================
--- trunk/piuparts-report.py	2009-05-05 13:44:32 UTC (rev 392)
+++ trunk/piuparts-report.py	2009-05-05 19:07:24 UTC (rev 393)
@@ -333,6 +333,11 @@
     </tr>
     <tr class="normalrow">
      <td class="contentcell2">
+      <b>2009-05-06</b>: Only believe statistics you faked yourself! Up until today piuparts used to include virtual packages (those only exist true the Provides: header) into the calculations of statistics of package states and the total number of packages. Suddenly, sid has 2444 packages less! 
+     </td>
+    </tr>
+    <tr class="normalrow">
+     <td class="contentcell2">
       <b>2009-05-01</b>: All packages in squeeze and sid which can be tested have been tested. So it takes about one month to do a full piuparts run against one suite of the archive on this machine, that's almost 1000 packages tested per day.
      </td>
     </tr>
@@ -711,11 +716,13 @@
         header = "date"
         current_day = "%s" % time.strftime("%Y%m%d")
         counts = current_day
+        total = 0
         for state in self._binary_db.get_states():
             count = len(self._binary_db.get_packages_in_state(state))
             header += ", %s" % state
             counts += ", %s" % count
             logging.debug("%s: %s" % (state, count))
+            total += count
         header += "\n"       
         counts += "\n"       
 
@@ -728,6 +735,7 @@
         if not current_day in last_line:
           append_file(countsfile, counts)
           logging.debug("appending line: %s" % counts) 
+        return total
 
     def prepare_package_summaries(self, logs_by_dir):
         logging.debug("Writing package templates in %s" % self._config.section)    
@@ -757,11 +765,13 @@
               state = self._binary_db.state_by_name(binary)
               current_version = self._source_db.get_control_header(source, "Version")
               # FIXME: labelcell is not a good name here.... 
-              if "fail" in state:
-                labelcell="bluelabelcell"
+              if state != "circular-dependency" and not "waiting" in state and "dependency" in state:
+                state_style="lightbluelabelcell"
+              elif state == "failed-testing":
+                state_style="bluelabelcell"
               else:
-                labelcell="labelcell"
-              binaryrows += "<tr class=\"normalrow\"><td class=\"labelcell\">Binary:</td><td class=\"contentcell2\">%s</td><td class=\"%s\">piuparts-result:</td><td class=\"contentcell2\">%s %s</td><td class=\"labelcell\">Version:</td><td class=\"contentcell2\">%s</td></tr>" %  (binary, labelcell, self.link_to_state_page(self._config.section,binary,state), self.links_to_logs(binary, state, logs_by_dir), html_protect(current_version))
+                state_style="labelcell"
+              binaryrows += "<tr class=\"normalrow\"><td class=\"labelcell\">Binary:</td><td class=\"contentcell2\">%s</td><td class=\"%s\">piuparts-result:</td><td class=\"contentcell2\">%s %s</td><td class=\"labelcell\">Version:</td><td class=\"contentcell2\">%s</td></tr>" %  (binary, state_style, self.link_to_state_page(self._config.section,binary,state), self.links_to_logs(binary, state, logs_by_dir), html_protect(current_version))
               if state != "successfully-tested":
                 success = False
               if state == "failed-testing":
@@ -819,6 +829,11 @@
         logging.debug("Writing per-dir HTML pages")
         self.print_by_dir(self._output_directory, logs_by_dir)
 
+        total_packages = self.write_counts_summary()
+
+        if self._config["sources-url"]:
+            self.prepare_package_summaries(logs_by_dir)
+
         logging.debug("Writing section statistics page")    
         tablerows = ""
         for state in self._binary_db.get_states():
@@ -845,12 +860,11 @@
           r('bitmap(file="'+pngfile+'",type="png16m",width=12,height=9,pointsize=10,res=100)')
           r('barplot(t(v),col = 1:13, main="Packages per state in '+self._config.section+' (past 4 weeks)", xlab="", ylab="Number of packages",space=0.1,border=0)')
           r('legend(x="bottom",legend=colnames(t), ncol=2,fill=1:13,xjust=0.5,yjust=0,bty="n")')
-          tablerows += "<tr class=\"normalrow\"> <td class=\"contentcell\" colspan=\"3\"><a href=\"%s\"><img src=\"/%s/%s\" height=\"450\" width=\"600\" alt=\"Package states in the 4 weeks\"></a></td></tr>\n" % ("monthly-states.png", self._config.section, "monthly-states.png")
+          tablerows += "<tr class=\"normalrow\"> <td class=\"contentcell\" colspan=\"3\"><a href=\"%s\"><img src=\"/%s/%s\" height=\"450\" width=\"600\" alt=\"Package states in the last 4 weeks\"></a></td></tr>\n" % ("monthly-states.png", self._config.section, "monthly-states.png")
         except:
           logging.debug("python-rpy not installed, disabled graphs.")
 
-        tablerows += "<tr class=\"normalrow\"> <td class=\"labelcell2\">Total</td> <td class=\"labelcell\" colspan=\"2\">%d</td></tr>\n" % \
-                          self._binary_db.get_total_packages()
+        tablerows += "<tr class=\"normalrow\"> <td class=\"labelcell2\">Total</td> <td class=\"labelcell2\" colspan=\"2\">%d</td></tr>\n" % 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),
@@ -887,11 +901,7 @@
                                         "list": list
                                        }))
 
-        self.write_counts_summary()
-        if self._config["sources-url"]:
-            self.prepare_package_summaries(logs_by_dir)
 
-
     def generate_output(self, master_directory, output_directory, section_names):
         self._section_names = section_names
         self._master_directory = os.path.abspath(os.path.join(master_directory, self._config.section))

Modified: trunk/piupartslib/packagesdb.py
===================================================================
--- trunk/piupartslib/packagesdb.py	2009-05-05 13:44:32 UTC (rev 392)
+++ trunk/piupartslib/packagesdb.py	2009-05-05 19:07:24 UTC (rev 393)
@@ -45,8 +45,45 @@
         else:
             headers.append(line)
     return headers
+ 
+def unique (s):
+    # taken from http://code.activestate.com/recipes/52560/
+    n = len(s)
+    if n == 0:
+      return []  
 
+    u = {}
+    try:
+      for x in s:
+          u[x] = 1
+    except TypeError:
+      del u  # move on to the next method
+    else:
+      return u.keys()   
 
+    try:
+      t = list(s)
+      t.sort()
+    except TypeError:
+      del t  # move on to the next method
+    else:
+      assert n > 0
+      last = t[0]
+      lasti = i = 1
+      while i < n:
+          if t[i] != last:
+              t[lasti] = last = t[i]
+              lasti += 1
+          i += 1
+      return t[:lasti]
+
+    # Brute force is all that's left.
+    u = []
+    for x in s:
+      if x not in u:
+          u.append(x)
+    return u
+
 class Package(UserDict.UserDict):
 
     def __init__(self, headers):
@@ -361,17 +398,13 @@
         for state in self._states:
             self._in_state[state].sort()
 
-    def get_total_packages(self):
-        self._find_all_packages()
-        return len(self._packages)
-
     def get_states(self):
         return self._states
 
     def get_packages_in_state(self, state):
-        self._compute_package_states()
-        return [self._packages[name] for name in self._in_state[state]]
-
+      self._compute_package_states()
+      return unique([self._packages[name] for name in self._in_state[state]])
+    
     def get_all_packages(self):
         self._find_all_packages()
         return self._packages




More information about the Piuparts-commits mailing list