[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.53-11-g891122c

Holger Levsen holger at layer-acht.org
Mon Jun 17 15:56:00 UTC 2013


The following commit has been merged in the develop branch:
commit 121c26712fbc92eafa5621a26990e8432a0c1281
Author: David Steele <dsteele at gmail.com>
Date:   Mon Mar 4 11:24:10 2013 -0500

    piuparts-report.py - Avoid sorting passed files by block count.
    
    And refactor passed vs. failed sort handling.
    
    There was still a case where a full accounting of rdep metrics was
    called for - the sort of successfully-tested in piuparts-report.
    Avoid the sort call to block_count if we know it is not going to
    affect the sort.
    
    With this change, piuparts-reports now runs at 35 seconds per section.

diff --git a/piuparts-report.py b/piuparts-report.py
index 43790da..1b465db 100644
--- a/piuparts-report.py
+++ b/piuparts-report.py
@@ -1249,17 +1249,19 @@ 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 self._binary_db.get_error_states():
                 with_counts = True
                 aside = " (reverse deps, blocked pkgs)"
+                sort_key = lambda x: (-self._binary_db.block_count(x),x["Package"])
+            else:
+                with_counts = False
+                aside = ""
+                sort_key = lambda x: x["Package"]
 
             names = self._binary_db.get_pkg_names_in_state(state)
             packages = [self._binary_db.get_package(name) for name in names]
-            packages.sort( key =
-                           lambda x: (-self._binary_db.block_count(x),x["Package"]))
+            packages.sort( key = sort_key )
 
             for package in packages:
                 vlist += "<li id=\"%s\">%s" % (

-- 
piuparts git repository



More information about the Piuparts-commits mailing list