On Mon, 2004-12-20 at 03:41 -0500, Michael Jennings wrote:
On Monday, 20 December 2004, at 02:21:56 (-0500), seth vidal wrote:
How can it do it better than rpm? Either it's the same as rpm or it's wrong.
any other version comparison result is incorrect.
For rpm, sure. But for general comparison of version strings, it gets some right that rpm gets wrong. (For example, it knows 2.5.4p1 > 2.5.4 while 2.5.4beta7 < 2.5.4.)
except that it's not accurate.
a < 1 z < 0
any number is ALWAYS greater than any letter when doing token comparison.
so saying that 2.5.4p1 > 2.5.4 while 2.5.4beta7 < 2.5.4 is just not accurate.
it depends entirely on the program.
I can think of many situations where 2.5.4beta7 may well be > 2.5.4
It just depends on what kind of special crack the person choosing the versioning is on.
just use the python modules. They link in directly to the rpmlib and use its version comparison functions.
Using the appropriate rpmlib bindings for whatever language one is using is always the most accurate approach. But if one chooses to not do so, it's good to understand the principles behind how the comparison works.
Sure - it's useful to understand the principles. Unfortunately the principles break down to be something like this: - rpm is right - if it's not the same as what rpm claims it is for version comparison, it's wrong. - if rpm gets changed to reflect the behavior you want, then that behavior becomes right. Up until that point it is wrong.
rpm is canonical and definitive in this situation. If you do otherwise you'll end up zigging when you should have zagged.
-sv