[Piuparts-commits] [SCM] piuparts git repository branch, piatti, updated. 0.44-627-g9f46e19

Holger Levsen holger at layer-acht.org
Fri Jun 1 17:37:31 UTC 2012


The following commit has been merged in the piatti branch:
commit c902ad94db0e54cdb7b65f60814a059cc4531eab
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Fri Jun 1 10:24:00 2012 +0200

    p-r: simplify write_state_pages()
    
    avoid code duplication
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/piuparts-report.py b/piuparts-report.py
index f9d269b..975703a 100644
--- a/piuparts-report.py
+++ b/piuparts-report.py
@@ -1032,7 +1032,12 @@ class Section:
     def write_state_pages(self):
         for state in self._binary_db.get_active_states():
             logging.debug("Writing page for %s" % state)
+            with_counts = False
+            aside = ""
             vlist = ""
+            if state in ['failed-testing', 'cannot-be-tested']:
+                with_counts = True
+                aside = " (reverse deps, blocked pkgs)"
 
             def cmp_func(a, b):
                 """Sort by block count first"""
@@ -1047,20 +1052,12 @@ class Section:
             packages.sort( cmp_func )
 
             for package in packages:
-                if state not in ['failed-testing', 'cannot-be-tested' ]:
-                    vlist += "<li id=\"%s\">%s (%s)" % (
+                vlist += "<li id=\"%s\">%s" % (
                                          package["Package"],
-                                         self.link_to_source_summary(package["Package"]),
-                                         html_protect(package["Maintainer"]))
-                    aside = ""
-                else:
-                    vlist += "<li id=\"%s\">%s (%d,%d) (%s)" % (
-                                         package["Package"],
-                                         self.link_to_source_summary(package["Package"]),
-                                         package.rrdep_count(),
-                                         package.block_count(),
-                                         html_protect(package["Maintainer"]))
-                    aside = "(reverse deps, blocked pkgs)"
+                                         self.link_to_source_summary(package["Package"]))
+                if with_counts:
+                    vlist += " (%d, %d)" % (package.rrdep_count(), package.block_count())
+                vlist += " (%s)" % html_protect(package["Maintainer"])
                 all_deps = package.all_dependencies()
                 if all_deps:
                     vlist += "\n<ul>\n"

-- 
piuparts git repository



More information about the Piuparts-commits mailing list