Python RPM Module (or another way to do it)

Status
Not open for further replies.

iceburn

Wise, Aged Ars Veteran
195
Subscriptor
Does anybody know of a Python module to read data from RedHat rpm headers? I've found one called rpmfile.py on Google, but its for older rpms. Actually, all I need to do is compare package names and version info between two rpm files, so if anybody knows of a different way to do it I'd like to hear. I couldn't think of a reliable way to compare them by filenames, although if its possible that would be most excellent.

-j
 

Matty

Ars Scholae Palatinae
649
You don't mention which distro you are using but the RedHat 7.x series come with an rpm called rpm-python that includes python bindings for the RPM libs. Anaconda the RedHat installer makes heavy use of it.

Code:
thunderball matty ~ > rpm -qa|grep rpm
rpm-python-4.0.3-1.03
rpm-build-4.0.3-1.03
rpm-4.0.3-1.03
rpm-devel-4.0.3-1.03
thunderball matty ~ > cat /etc/redhat-release 
Red Hat Linux release 7.2 (Enigma)
thunderball matty ~ > rpm -ql rpm-python
/usr/lib/python1.5/site-packages/poptmodule.so
/usr/lib/python1.5/site-packages/rpmmodule.so
thunderball matty ~ >

Little bit of doco on the module http://rpmforge.net/rpmforge/doc/python.html

Matty
 
Status
Not open for further replies.