Michael, > Clearly, 1 < 2, so the latter is the newer package. Thanks, I am clear on that. My code was sometimes not working right. I simplified and clarified it, and it is working right now -- at least on the httpd versions, and I hope on everything else. > It's not a straight string compare; if it > were, 2.0.46 would > seem to be a higher version than 2.0.127. Thanks for the heads up on this point. My code is not this sophisticated. I am not sure I need to even worry about comparisons on this level. My program is most concerned about when a *different* version appears on the public mirrors. So 2.0.46 would be different than 2.0.127, and my logic presumes the one that appears after supercedes the one that appeared before. At this point, I have not yet tackled removing obsolete versions. I leave it up to yum to decide which is "newer" for its purposes. Basically, my plan was to remove a version after it disappears from the public mirrors, and after it has been superceded by something that appeared later. Thanks for bringing up the point about 2.0.46 vs. 2.0.127; I will want to keep this in mind going foward. Rick --- Michael Jennings <mej at caosity.org> wrote: > 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 > > -- > Michael Jennings (a.k.a. KainX) > http://www.kainx.org/ <mej at kainx.org> > n + 1, Inc., http://www.nplus1.net/ Author, > Eterm (www.eterm.org) > ----------------------------------------------------------------------- > "She'd still say, 'I love you' if I asked, but she > never volunteers. > Somehow what she never says means more than all > the other words I > hear." -- BlackHawk, "I Sure > Can Smell the Rain" >