[Rpm-metadata] Finding newst version in a repository

Per Liden perlist1 at malloc.se
Tue Nov 21 20:49:06 UTC 2006


seth vidal wrote:
> On Mon, 2006-11-20 at 18:48 +0100, Per Liden wrote:
>> Hi,
>>
>> I'm parsing a primary.xml and want to find out which version of a 
>> specific RPM is the newest version in the repository. In my case I'm 
>> parsing primary.xml from fedora 6 updates 
>> (ftp://sunsite.mff.cuni.cz/pub/fedora/updates/6/i386/repodata) and at 
>> the moment it has e.g. autofs of version 5.0.1-0.rc2.22 and 
>> 5.0.1-0.rc2.17. What would be the correct way of telling which of these 
>> is the newest version? Comparing metadata/package/version/@rel seems a 
>> bit too error prone as version numbering styles can differ. 
> 
> this is why rpm has certain rules it works under for establishing
> newest/oldest. IF the versioning scheme that the program uses doesn't
> match this then tough luck.

I see, I was under the false impression that the version string could 
formated in pretty much any way. After my initial post I looked into yum 
and noticed that in the end a call to rpmvercmp() in rpmlib.h is made to 
compare two version. That clarifies things.

Thanks.

/Per



More information about the Rpm-metadata mailing list