RPM python subroutine for (epoch, version, release) comparation?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi, all,

 

 On Centos 5 I am programming RPM with python recently.  When I read the online RPM python programming guide at http://docs.fedoraproject.org/drafts/rpm-guide-en/ch16s05.html, I got confused at the EVR() function as the function returns the (epoch, version, release) as a string “%epoch-%version-%release”, and so the RPM  comparing process is simplified as string comparing – which doesn’t look correct, am I wrong? See the code from the page:

 

--------------------------------------------------------------------------------------

file_h = ts.hdrFromFdno(fd)

file_ds = file_h.dsOfHeader()

inst_ds = inst_h.dsOfHeader()

if file_ds.EVR() >= inst_ds.EVR():

print "Package file is same or newer, OK to upgrade."

else:

print "Package file is older than installed version."

--------------------------------------------------------------------------------------

 

I’ve see another function in rpm object: rpm.versionCompare(h1,h2) which compare two rpm headers, Am I supposed to use this function or the EVR as documented? The former one is not well documented, though.

 

Thanks.

 

-- Robinson

 


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux