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

 


_______________________________________________
Yum mailing list
Yum@xxxxxxxxxxxxxxxxx
http://lists.baseurl.org/mailman/listinfo/yum

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux