List installed pkgs (smaller than the "[YumCodeSnippet/YumList yum list]" snippet). {{{ #!python # This uses rpm directly: import rpm ts = rpm.TransactionSet() ts.setVSFlags((rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NODIGESTS)) for hdr in ts.dbMatch(): # No sorting if hdr['name'] == 'gpg-pubkey': continue else: print '%s-%s:%s-%s.%s' % (hdr['name'], hdr['epochnum'],hdr['version'],hdr['release'], hdr['arch']) # Via. yum import yum yb = yum.YumBase() yb.conf.cache = 1 for pkg in sorted(yb.rpmdb.returnPackages()): print pkg, pkg.repo }}}