[Tutor] How to Compare rpm version using Python Script

Asad asad.hasan2004 at gmail.com
Fri Nov 29 07:32:37 EST 2019


Hi All ,

           I am thinking to write a script to compare the rpm version
installed in a Linux system with a defined list of the rpm's . It the
elements matches or the system has a higher version show success or else
show failed .

I was planning to use the rpm command :

/bin/rpm -q --queryformat '%{name}-%{ARCH}-%{version}-%{release}\n'

to get the list of rpm's installed in the system . How to do the comparison
for example :

Expected Value:compat-libcap1-1.10
INFO: Actual Value:compat-libcap1-1.10-7.el7

This should show success .

Please share some knowledge and logic to code this .

Thanks,
-- 
Asad Hasan
+91 9582111698


More information about the Tutor mailing list