RPM python subroutine for (epoch, version, release) comparation?
Robinson Tiemuqinke <[email protected]>
| Newsgroups | gmane.linux.rpm.yum |
|---|---|
| Message-ID | <312298.98815.qm__27689.7594718777$1245977383$gmane$org@web36704.mail.mud.yahoo.com> |
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 [email protected] http://lists.baseurl.org/mailman/listinfo/yum