#!/usr/bin/python -tt import yum import sys from operator import attrgetter my = yum.YumBase() my.setCacheDir() my.repos.disableRepo('*') my.add_enable_repo('epel', baseurls=['http://download.fedoraproject.org/pub/epel/5/i386']) my.add_enable_repo('el5', baseurls=['http://mirror.centos.org/centos/5/os/i386/']) len(my.pkgSack) # just to frob the sack # take all the pkgs in epel # sort by most recent pkgs and check the most recent 10% of the total # run the provides from the most recent 20% to see if anything in el5 matches epel = my.repos.findRepos('epel')[0] el = my.repos.findRepos('el5')[0] epel_pkgs = epel.sack.returnPackages() sample = (len(epel_pkgs)/5)*-1 most_recent_built = sorted(epel_pkgs, key=attrgetter('buildtime'))[:sample] print "checking most recently built pkgs: %s" % (sample*-1) for pkg in most_recent_built: for prov in pkg.provides: pot = el.sack.searchProvides(prov) if len(pot) > 0: print 'Provides: %s' % str(prov) print ' Provided by: %s (epel)' % pkg.name for i in pot: print ' Provided by: %s (el)' % i.name