extras-repoclosure rc-modified,1.26,1.27

Michael Schwendt mschwendt at fedoraproject.org
Tue Jun 9 12:13:49 UTC 2009


Author: mschwendt

Update of /cvs/fedora/extras-repoclosure
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv10315

Modified Files:
	rc-modified 
Log Message:
port mash's spam-o-matic assignBlame/libmunge/conspirators feature and report the related package names


Index: rc-modified
===================================================================
RCS file: /cvs/fedora/extras-repoclosure/rc-modified,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- rc-modified	30 Apr 2009 12:11:29 -0000	1.26
+++ rc-modified	9 Jun 2009 12:13:48 -0000	1.27
@@ -9,7 +9,7 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
@@ -23,6 +23,8 @@
 
 import sys
 import os
+import re
+import string
 
 # For patched "yum" and "rpmUtils" (post 2.6.1 checkForObsolete support).
 # Comment this to use system yum.
@@ -268,6 +270,49 @@
     def log(self, value, msg):
         pass
 
+
+# taken from mash's spam-o-matic
+def libmunge(match):
+    if match.groups()[1].isdigit():
+        return "%s%d" % (match.groups()[0],int(match.groups()[1])+1)
+    else:
+        return "%s%s" % (match.groups()[0],match.groups()[1])
+
+# taken from mash's spam-o-matic
+def getSrcPkg(pkg):
+    if pkg.arch == 'src':
+      return pkg.name
+    srpm = pkg.returnSimple('sourcerpm')
+    if not srpm:
+        return None
+    srcpkg = string.join(srpm.split('-')[:-2],'-')
+    return srcpkg
+
+# adapted from mash's spam-o-matic
+def getRelated(resolver, dep):
+    # Given a dep, find potential responsible parties
+
+    list = []
+
+    def __addpackages(sack):
+        for package in sack.returnPackages():
+            p = getSrcPkg(package)
+            if p not in list:
+                list.append(p)
+    
+    # Something that provides the dep
+    __addpackages(resolver.whatProvides(dep, None, None))
+
+    # Libraries: check for variant in soname
+    if re.match("lib.*\.so\.[0-9]+",dep):
+        new = re.sub("(lib.*\.so\.)([0-9])+",libmunge,dep)
+        __addpackages(resolver.whatProvides(new, None, None))
+        libname = dep.split('.')[0]
+        __addpackages(resolver.whatProvides(libname, None, None))
+
+    return list
+
+
 def main():
     (opts, cruft) = parseArgs()
     my = RepoClosure(arch = opts.arch, config = opts.config)
@@ -321,8 +366,12 @@
     pkgs.sort(sortbyname)
     for pkg in pkgs:
         srcrpm = pkg.returnSimple('sourcerpm')
-        print 'source rpm: %s\npackage: %s from %s\n  unresolved deps: ' % (srcrpm, pkg, pkg.repoid)
+        print 'source rpm: %s' % srcrpm
+        related = []
+        print 'package: %s from %s' % (pkg, pkg.repoid)
+        print '  unresolved deps:'
         for (n, f, v) in baddeps[pkg]:
+            related += getRelated(my,n)
             req = '%s' % n
             if f: 
                 flag = LETTERFLAGS[f]
@@ -331,6 +380,10 @@
                 req = '%s %s' % (req, v)
             
             print '     %s' % req
+        if len(related):
+            print 'related pkgs:'
+            for i in related:
+                print '  %s' % i
         print
 
 if __name__ == "__main__":




More information about the fedora-extras-commits mailing list