extras-repoclosure rc-report.py,1.2,1.3

Michael Schwendt (mschwendt) fedora-extras-commits at redhat.com
Wed Jun 14 10:57:52 UTC 2006


Author: mschwendt

Update of /cvs/fedora/extras-repoclosure
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv3470

Modified Files:
	rc-report.py 
Log Message:
try a different report format


Index: rc-report.py
===================================================================
RCS file: /cvs/fedora/extras-repoclosure/rc-report.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- rc-report.py	16 May 2006 00:23:15 -0000	1.2
+++ rc-report.py	14 Jun 2006 10:57:49 -0000	1.3
@@ -224,10 +224,9 @@
 
 owners = OwnersList()
 history = History()
-report = {}  # Map, report[email], mail message body to be sent to somebody.
-summary = []  # list of "package version.arch" lines
-oldproblems = []
-repoids = {}  # affected repository ids
+report = {}  # map, report[email], mail message body to be sent to somebody
+pkgbyowner = {}  # map, pkgbyowner[email], list of pkgids for all owner's broken packages
+summary = {}  # map of maps, summary[repoid][pkgid], unresolved deps line by line
 
 pkgre = re.compile('(?P<name>.*)-[^-]+-[^-]+$')
 inbody = False
@@ -271,9 +270,20 @@
             ownedby = 'UNKNOWN OWNER'
             x = 'ERROR: %s not in owners.list\nERROR: source rpm is %s' % ( name, srcrpm )
             summail += x + '\n\n'
-        # name  EVR.arch
-        summary.append ( ' '.join( ['\t', w[1], '  ', w[3], repoid] ) )
-        repoids[repoid] = 1
+        # name-EVR.arch
+        pkgid = w[1]+'-'+w[3]
+        pkgid2 = w[1]+' - '+w[3]
+
+        if not pkgbyowner.has_key(ownedby):
+            pkgbyowner[ownedby] = [pkgid2]
+        else:
+            pkgbyowner[ownedby].append(pkgid2)
+
+        if not summary.has_key(repoid):
+            summary[repoid] = {}
+        if not summary[repoid].has_key(pkgid):
+            summary[repoid][pkgid] = []
+
     if inbody:
         # Construct report for package owner.
         if createreport:
@@ -281,24 +291,40 @@
                 report[ownedby] += line
             except KeyError:
                 report[ownedby] = line
-        else:
-            oldproblems.append(line)
+        # Add to summary.
+        if not line.isspace() and not line.startswith('package: ') and line.find('unresolved deps:') < 0:
+            summary[repoid][pkgid].append( line.rstrip().lstrip() )
 
 if savehistory:
     history.Save()
 
-summary.sort()
-repos = repoids.keys()
+summail += ('Summary of broken packages (by owner):\n') + '-'*70+'\n'
+owners = pkgbyowner.keys()
+owners.sort()
+count = 0
+for owner in owners:
+    summail += '    '+owner.replace('@',' AT ')+'\n'
+    pkgs = pkgbyowner[owner]
+    pkgs.sort()
+    for pkg in pkgs:
+        summail += '        '+pkg+'\n'
+    summail += '\n'
+    count += 1
+if not count:
+    summail += 'None\n'
+summail += '\n'
+
+repos = summary.keys()
 repos.sort()
 for repoid in repos:
     count = 0
     summail += ('Summary of broken packages in %s:\n' % repoid) + '-'*70+'\n'
-    for name in summary:
-        p = name.find(repoid)
-        if p >= 0:
-            summail += name[:p]
-            summail += '\n'
-            count += 1
+    pkgs = summary[repoid].keys()
+    pkgs.sort()
+    for pkg in pkgs:
+        for dep in summary[repoid][pkg]:
+            summail += ( '    %s  requires  %s\n' % (pkg,dep) )
+        count += 1
     if not count:
         summail += 'None\n'
     summail += '\n'
@@ -325,10 +351,6 @@
     if domail and toaddr != 'UNKNOWN OWNER':
         mailsplit( srv, fromaddr, toaddr, replytoaddr, subject, mailtext )
 
-if len(oldproblems):
-    summail += '\n'+'='*70+'\n'
-    for line in oldproblems:
-        summail += line
 if domail and mailsummary:
     toaddr = replytoaddr  # mail summary to list
     mailsplit( srv, fromaddr, toaddr, '', ('Summary - %s' % subject), summail )




More information about the fedora-extras-commits mailing list