#!/usr/bin/python -tt import yum my = yum.YumBase() my.conf.showdupesfromrepos = 1 for ipkg in my.rpmdb: apkgs = my.pkgSack.searchPkgTuple(ipkg.pkgtup) if len(apkgs) < 1: print "could not find package %s in any repository" % ipkg else: apkg = apkgs[0] print '%s from repo %s' % (ipkg, apkg.repoid)