I'm trying to script some sysadmin stuff, that requires rpm
manipulation (querying installed packages, removing packages,
installing packages).
Rather than manually parsing rpm's output, I noticed that someone had
written python-bindings for the rpmlib library (called rpm-python).
This seems much cleaner, but the documentation is sparse, and I
haven't been able to get uninstalling to work.
As root, I run the following:
I get no error messages/exceptions, but lynx is not removed.>>import rpm
ts=rpm.ts()
ts.addErase("lynx")
I've also tried things along the lines of:
.... instance = mi.instance()>>mi = ts.dbMatch(rpm.RPMTAG_NAME, "lynx")
for idx in mi:
.... ts.addErase(instance)
and
.... ts.addErase(idx)>>mi = ts.dbMatch(rpm.RPMTAG_NAME, "lynx")
for idx in mi:
I've further confirmed that ts.dbMatch(rpm.RPMTAG_NAME, "lynx") does
in fact find the header for the lynx package via something like:
.... print hdr['name'], hdr['version']>>mi = ts.dbMatch(rpm.RPMTAG_NAME, "lynx")
for hdr in mi:
....
lynx 2.8.5
The only real documentation I've been able to find is
http://people.redhat.com/pnasrat/rpm...es/frames.html
Is there some other module I should be using for rpm manipulation? Or,
if not, does anyone know what I'm doing wrong with this one?