Re: RPM python subroutine for (epoch, version, release) comparation?
Seth Vidal <[email protected]>
| Newsgroups | gmane.linux.rpm.yum |
|---|---|
| Message-ID | <alpine.LFD.2.00.0906252248060.8255__27450.6679772914$1245984750$gmane$org@localhost.localdomain> |
On Thu, 25 Jun 2009, Robinson Tiemuqinke wrote: > > 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: > 1. EVR() is not going to give you something which is usefully comparable for sorting by e-v-r of the pkg. It's just going to give you something useful for doing string comparisons on. 2. You can use rpm.versionCompare() or rpm.labelCompare() - labelCompare takes the e,v,r as strings. 3. you could look at how rpmUtils (comes in yum) or yum itself handles a bunch of these items. -sv _______________________________________________ Yum mailing list [email protected] http://lists.baseurl.org/mailman/listinfo/yum