[lug] rpm version comparison

John Hernandez John.Hernandez at noaa.gov
Thu Jun 6 11:33:12 MDT 2002


I pasted your subject line into google and look what surfaced ;)

 > On Tue, Nov 13, 2001 at 03:41:38PM -0200, Andreas Hasenack wrote:
 > The algorithm that RPM uses to determine the version ordering of
 > packages is simple and developers are encouraged not to rely on the
 > details of its working.  Developers should keep their numbering scheme
 > simple so any reasonable ordering algorithm would work.  The version
 > comparison algorithm is in the routine rpmvercmp() and it is just a 
segmented
 > strcmp(3).  First, the boundaries of the segments are found using
 > isdigit(3)/isalpha(3).  Each segment is then compared in order with the
 > right most segment being the least significant.  The alphabetical
 > portions are compared using a lexical graphical ascii ordering, the
 > digit segments strip leading zeroes's and compare the strlen before
 > doing a strcmp. If both numerical strings are equal, the longer string
 > is larger.  Notice that the algorithm has no knowledge of decimal 
fractions,
 > and perl-5.6 is "older" than perl-5.00503 because the number 6 si 
less than
 > the number 503.

The way I read it, the answer would be that gdb-5.0rh-5 is newer version.

Hugh Brown wrote:
> How does rpm do version comparison when doing a -F?
> 
> e.g.
> 
> gdb-5.0rh-5
> gdb-5.0-7.71
> 
> 
> Which package would be more recent?
> 
> Hugh
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug


-- 

   - John Hernandez - Network Engineer - 303-497-6392 -
  |  National Oceanic and Atmospheric Administration   |
  |  Mailstop R/OM12. 325 Broadway, Boulder, CO 80305  |
   ----------------------------------------------------




More information about the LUG mailing list