[bitbake-devel] bb.utils.vercmp() not consistent with debian rules

Lu, Lianhao lianhao.lu at intel.com
Fri Apr 6 03:00:43 UTC 2012


Lu, Lianhao wrote on 2012-04-05:
> 
> Richard Purdie wrote on 2012-04-05:
>> On Thu, 2012-04-05 at 13:18 +0100, Richard Purdie wrote:
>> 
>> So just to be clear, we have various version sorting algorithms:
>> 
>> * opkg
>> * opkg-compare-versions (which has a C version and a shell version!)
>> * bb.utils.vercmp()
>> * bb.utils.vercmp_string()
>> 
>> and all these functions *need* to be consistent. Consistent is defined
>> in this case as following the Debian version policy. This is ignoring
>> the other package backends. dpkg should "just work", rpm can be
>> programmed to use any algorithm and is probably not consistent with this
>> at this point but we should probably ignore that in the equation at this
>> point.
>> 
>> So the question is, which of the above are consistent or inconsistent
>> with each other (and dpkg), and how they are inconsistent. We can then
>> consider what to do about it.
>> 
> 
> The difference between those is how to treat "separators" in version compare.
> Take 2 examples, v1="3.2-r2-oe0", v1'="3.2-r2"; v2="4.4-r8-oe0", v2'="4.4-r8a"
> 
> The Debian version policy says, "...so that all the letters sort earlier than all
> the non-letters and so that a tilde sorts before anything, even the end of a part."
> So v1>v1', v2>v2'.
> 
> The opkg follows the Debian rules, and reports v1>v1', v2>v2'. dpkg reports the same.
> 
> The C version of opkg-compare-versions reports v1>v1', v2<v2'. (The shell version do
> NOT have the function of comparison).
It turns out the opkg-compare-version is still using the source code from a very opkg
implementation. The opkg upstream has changed that in svn revision r40, 
http://code.google.com/p/opkg/source/detail?r=40&path=/trunk/libopkg/pkg.c. 

> 
> The bb.utils.vercmp() reports v1<v1', v2<v2'. It treats all separators(i.e. "." and "-") as tilde
> in Debian rules. The bb.utils.vercmp is used both by bitbake internally and bbclass.
> 
> The bb.utils.vercmp_string() does NOT accept version string containing segments starting with
> non-digital character. bb.utils.vercmp_string seems never being actually called.
> 
> Seems we have nothing consistent here. :-(
> 
> - Lianhao
> 
> 





More information about the bitbake-devel mailing list