I have to back paddle here a bit:
On 2016-04-19 18:47, Stefan Agner wrote:
Hi Koen,
I think you mentioned that issue already briefly at ELC, but I stumbled upon it independently again:
We have issues with the versioning of the Linaro toolchain in Ångström. While it happens with the Ångström package feed, I think it is actually a problem of how the meta-linaro layer uses PV/PR.
It seems that the change to the 2015.11-2 release added yet another hyphen, which gets interpreted wrong by opkg. When we build a new image, and try to download something which just asks for linaro-5.2, we get the following error: Not downgrading libgcc1 from linaro-5.2-r2015.11-2 to linaro-5.2-r2015.11.0 on root.
Downgrading? The "2015.11-2" release should be an upgrade...
Downgrading is actually correct here, since the 2015.11-2 release is a newer release than 2015.11...
This can be verified when checking the versions using the compare-versions command: $ opkg compare-versions "linaro-5.2-r2015.11-2" '>=' "linaro-5.2-r2015.11"; echo $? 1
Error code is set, hence the comparison is _not_ satisfied. Whether there is another .0 at the end of r2015.11 does not matter (Btw, where is that coming from?)
After further debugging, it turns out that this statement is actually wrong. opkg compare-versions returns 1 if the comparison _is_ satisfied. This does not follow the POSIX standard (0 = good, 1 = error), and has been discussed already: https://groups.google.com/forum/?fromgroups#%21searchin/opkg-devel/compare%2...
But when comparing the same version, e.g. opkg compare-versions 1.0-r1 '>=' 1.0-r1, opkg actually suffers a bug which might lead to the wrong result. I tested same version to figure out how the return value behaves, hence this got me completely confused...
Currently, it seems that the package versions are actually comparing as they should.
Things after the hyphen are interpreted by opkg as package revision... This leads to the following akward situation (added some debug prints into opkg's source): $ ./src/opkg --offline-root . compare-versions linaro-5.2-r2015.11-2 '>=' linaro-5.2-r2015.11 parse_version, version linaro-5.2-r2015.11, revision 2 parse_version, version linaro-5.2, revision r2015.11
This change introduced the additional hyphen: https://git.linaro.org/openembedded/meta-linaro.git/commitdiff/62333718e8f38...
I think everything should work if that additional -2 would be a .2...
However, hyphens in the main version number are actually quite frowned upon, also the debian policy does not allow hyphens: https://www.debian.org/doc/debian-policy/ch-binary.html#s-versions
So maybe even the hyphen in linaro-5.2 should be something else...
Despite the new findings above, the whole hyphen issue remains a dangerous situation, e.g. the following would blow: $ opkg compare-versions linaro-5.2-r2015.11-2 '<=' linaro-5.2-r2015.11-r0; echo $? 1
1 -> satisfied, hence in a upgrade situation, opkg would choose r2015.11-r0 over r2015.11-2
Avoiding hyphens would help avoid such situation:
$ opkg compare-versions 5.2+linaro+r2015.11.2 '<=' 5.2+linaro+r2015.11-r0; echo $? 0
Any thoughts?
-- Stefan