[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.50-103-gfe8fd87

David Steele dsteele at gmail.com
Mon Apr 22 09:31:54 UTC 2013


The following commit has been merged in the develop branch:
commit eb90ec2adc98f6a6a2b034d87e8020f68b17b74a
Author: David Steele <dsteele at gmail.com>
Date:   Wed Apr 17 18:59:54 2013 -0400

    detect_well_known_errors - Sort by bugged status first.

diff --git a/debian/changelog b/debian/changelog
index f011d25..19c3f68 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -59,7 +59,8 @@ piuparts (0.51) UNRELEASED; urgency=low
   [ David Steele ]
   * detect_well_known_errors:
     - Replace the bash script with an equivalent Python script.
-    - Sort known error and issue packages by reverse dependency count.
+    - Sort known error and issue packages by reverse dependency count,
+      separating bugged from everything else.
       (Closes: #698526)
     - Add a PTS link to issue and error summary entries.
     - Replace the known_problem COMMAND with INCLUDE and EXCLUDE, and replace
diff --git a/master-bin/detect_well_known_errors b/master-bin/detect_well_known_errors
index 5cf0577..82ac205 100755
--- a/master-bin/detect_well_known_errors
+++ b/master-bin/detect_well_known_errors
@@ -202,16 +202,19 @@ class FailureManager():
     def sort_by_path( self ):
         self.failures.sort(key=lambda x: self.logdict[x.pkgspec])
 
-    def sort_by_rdeps( self, pkgsdb ):
+    def sort_by_bugged_and_rdeps( self, pkgsdb ):
         self.pkgsdb = pkgsdb
 
         def keyfunc( x, pkgsdb=self.pkgsdb, logdict=self.logdict):
             try:
-                rdeps = pkgsdb.get_package(get_pkg(x.pkgspec)).rrdep_count()
+                pkg_name = get_pkg(x.pkgspec)
+                rdeps = pkgsdb.get_package(pkg_name).rrdep_count()
             except KeyError:
                 rdeps = 0
 
-            return( (-rdeps, logdict[x.pkgspec]) )
+            is_failed = get_where(logdict[x.pkgspec]) == "fail"
+
+            return( (not is_failed, -rdeps, logdict[x.pkgspec]) )
 
         self.failures.sort( key=keyfunc )
 
@@ -347,6 +350,7 @@ def populate_tpl( tmpl, vals ):
 def update_tpl( basedir, section, problem, failures, logdict, ftpl, ptpl, pkgsdb ):
 
     pkg_text = ""
+    bugged_section = False
     for failure in failures:
 
         pkgspec = failure.pkgspec
@@ -358,6 +362,10 @@ def update_tpl( basedir, section, problem, failures, logdict, ftpl, ptpl, pkgsdb
             src_pkg = bin_pkg
             rdep_cnt = 0
 
+        if (not bugged_section) and "bugged" in logdict[pkgspec]:
+            bugged_section = True
+            pkg_text += "<br>\n"
+
         pkg_text += populate_tpl(ftpl, {
                                 'LOG': section_path(logdict[pkgspec]),
                                 'PACKAGE': bin_pkg,
@@ -402,11 +410,14 @@ def update_html( section, logdict, problem_list, failures, config, pkgsdb ):
 
     def keyfunc( x, pkgsdb=pkgsdb, logdict=logdict):
         try:
-            rdeps = pkgsdb.get_package(get_pkg(x.pkgspec)).rrdep_count()
+            pkg_name = get_pkg(x.pkgspec)
+            rdeps = pkgsdb.get_package(pkg_name).rrdep_count()
         except KeyError:
             rdeps = 0
 
-        return( (-rdeps, logdict[x.pkgspec]) )
+        is_failed = get_where(logdict[x.pkgspec]) == "fail"
+
+        return( (not is_failed, -rdeps, logdict[x.pkgspec]) )
 
     unknownsasfailures.sort( key=keyfunc )
 
@@ -462,7 +473,7 @@ def process_section( section, config, problem_list,
         os.chdir(oldcwd)
 
     failures = FailureManager( logdict )
-    failures.sort_by_rdeps(pkgsdb)
+    failures.sort_by_bugged_and_rdeps(pkgsdb)
 
     update_html( section, logdict, problem_list, failures, config, pkgsdb )
 

-- 
piuparts git repository



More information about the Piuparts-commits mailing list