Currently koji-shadows prints out the top 5 brokendep packages, which is kind of useless as they don't need fixing. With this patchit prints out the top 10 broken packages, sorted by the number of packages they are blocking from being built. Secondary arch maintainers will know immediately which packages they should probably fix first without having to trace them down in the output.

    Karsten

>From 05ee21f0defa08dd128e609926672b2cec96e53a Mon Sep 17 00:00:00 2001
From: Karsten Hopp <[email protected]>
Date: Thu, 28 Feb 2013 17:54:22 +0100
Subject: [PATCH] report top broken packages instead of top brokendeps

---
 util/koji-shadow | 44 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 35 insertions(+), 9 deletions(-)

diff --git a/util/koji-shadow b/util/koji-shadow
index 25492d5..e4da04c 100755
--- a/util/koji-shadow
+++ b/util/koji-shadow
@@ -1084,17 +1084,21 @@ class BuildTracker(object):
         return task_id
 
     def report(self):
+        brokenpackage = {}
+        thispackageblocks = {}
         print "-- %s --" % time.asctime()
         self.report_brief()
         for state in ('broken', 'noroot', 'blocked'):
             builds = self.state_idx[state].values()
             not_replaced = [b for b in builds if not b.substitute]
             n_replaced = len(builds) - len(not_replaced)
-            print "%s: %i (+%i replaced)" % (state, len(not_replaced), n_replaced)
             if not_replaced and len(not_replaced) < 8:
                 print '', ' '.join([b.nvr for b in not_replaced])
-        #generate a report of the most frequent problem deps
-        problem_counts = {}
+            for b in not_replaced:
+                if not b.nvr in brokenpackage:
+                    brokenpackage.update({b.nvr:[b.nvr]})
+                else:
+                    brokenpackage[b.nvr].append(b.nvr)
         for build in self.state_idx['brokendeps'].values():
             for dep_id in build.deps:
                 dep = self.builds.get(dep_id)
@@ -1115,15 +1119,37 @@ class BuildTracker(object):
                         continue
                     #otherwise the substitution is the problem
                     nvr = dep.substitute
-                problem_counts.setdefault(nvr, 0)
-                problem_counts[nvr] += 1
-        order = [(c, nvr) for (nvr, c) in problem_counts.iteritems()]
+                if dep.state == 'broken':
+                    brokenpackage[dep.nvr].append(build.nvr)
+                elif dep.state == 'brokendeps':
+                    found = 0;
+                    for i in brokenpackage:
+                        if dep.nvr in brokenpackage[i]:
+                           brokenpackage[i] += [build.nvr]
+                           found = 1
+                    if found == 0:
+                        if not dep.nvr in thispackageblocks:
+                            thispackageblocks.update({dep.nvr:[build.nvr]})
+                        else:
+                            thispackageblocks[dep.nvr].append(build.nvr)
+        # group all brokendeps
+        for package in thispackageblocks:
+            for blockedpackage in thispackageblocks:
+                if package in thispackageblocks[blockedpackage]:
+                   thispackageblocks[blockedpackage] += thispackageblocks[package]
+        for package in thispackageblocks:
+            for blockedpackage in brokenpackage:
+                if package in brokenpackage[blockedpackage]:
+                    brokenpackage[blockedpackage] += thispackageblocks[package]
+        for package in brokenpackage:
+# Remove duplicates, use 'set' as order isn't important:
+            brokenpackage[package] = set(brokenpackage[package])
+        order = [(len(c), nvr) for (nvr, c) in brokenpackage.iteritems()]
         if order:
             order.sort()
             order.reverse()
-            #print top 5 problems
-            print "-- top problems --"
-            for (c, nvr) in order[:5]:
+            print "-- top broken packages --"
+            for (c, nvr) in order[:10]:
                 print " %s (%i)" % (nvr, c)
 
     def report_brief(self):
-- 
1.8.1.2

--
buildsys mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/buildsys

Reply via email to