[oe] [RFC] Version sorting in BitBake

Denys Dmytriyenko denis at denix.org
Tue Oct 6 03:46:46 UTC 2009


Hi,

While debugging the problem with the wrong kernel recipe being picked up by 
BitBake, based on a complex PV value (there were several instances, once of 
them recently mentioned at [1]), I found a small flaw in BitBake's version 
comparison algorithm, as it relates to -preX and -rcX versions.

For the above cases we use this format: PV = "2.6.29+2.6.30-rc5"

At this point both BitBake and opkg (I haven't tried other package managers) 
sort those PVs properly, as EOL sorts lower than any other character:

2.6.29 < 2.6.29+2.6.30-rc5 < 2.6.30

Since the introduction of MACHINE_KERNEL_PR, we moved modifiers such as 
"+gitr${SRCREV}" (or any distro/local suffixes) from PR to PV, but still 
placing them after PR for proper sorting:

PV1 = "2.6.29-${PR}+gitr${SRCREV}"
PV2 = "2.6.29+2.6.30-rc5-${PR}+gitr${SRCREV}"
PV3 = "2.6.30-${PR}+gitr${SRCREV}"

That still works with opkg, as ipkg-compare-versions sorts above PVs as 
expected - PV1 < PV2 < PV3

But BitBake now has this flaw and sorts like this: PV2 < PV1 < PV3

Looks like ipkg-compare-versions/opkg algorithm has a special handling for '-' 
and '.' characters, making them sort lower than '+', thus producing expected 
results.

I understand that this behavior can be controlled by PREFERRED_VERSION and 
DEFAULT_PREFERENCE variables. But would it make sense to also fix it in 
BitBake? I do have a patch, which I'll send next. Please provide comments.

[1] http://thread.gmane.org/gmane.comp.handhelds.openembedded/26622/focus=26634

-- 
Denys




More information about the Openembedded-devel mailing list