As Seth points out, you can use the update APIs to find out if anything is available as an update. For something close to yum list, you probably want to use doPackageLists (). For example.
import os, sys import yum yb = yum.YumBase() yb.conf.cache = os.geteuid() != 1 pl = yb.doPackageLists(patterns=sys.argv[1:]) if pl.installed: print "Installed Packages" for pkg in sorted(pl.installed): print pkg if pl.available: print "Available Packages" for pkg in sorted(pl.available): print pkg, pkg.repo if pl.reinstall_available: print "Re-install Available Packages" for pkg in sorted(pl.reinstall_available): print pkg, pkg.repo
James antill
source share