On Saturday, 18 December 2004, at 06:26:26 (-0800), Rick Graves wrote:
Compare:
httpd-2.0.46-44.ent.centos.1.i386.rpm httpd-2.0.46-44.ent.centos.2.i386.rpm
By "non-contiguous", I meant that the "1" and "2" digits are separated from the main version number, 2.0.46-44.
The version number is actually "2.0.46," and the release is "44.ent.centos.1". If your code isn't catching that, it's not doing the comparison right.
I have some perl code and some C code that does pretty reliable version comparisons, in some cases better than rpm does. Let me know if you're interested. But the basic idea is to split the version and release into numeric and non-numeric portions and compare each one in turn. It's not a straight string compare; if it were, 2.0.46 would seem to be a higher version than 2.0.127. Numbers are compared numerically for that reason. So the comparison becomes this:
2 . 0 . 46 44 .ent.centos. 1 2 . 0 . 46 44 .ent.centos. 2
Clearly, 1 < 2, so the latter is the newer package.
HTH, Michael