[bitbake-devel] PREFERRED_VERSION with % wildcard picking unexpected version

Andre McCurdy armccurdy at gmail.com
Thu Dec 10 19:07:35 UTC 2015


Hi Nicolas,

On Thu, Dec 10, 2015 at 1:16 AM, Martin Jansa <martin.jansa at gmail.com> wrote:
> On Thu, Dec 10, 2015 at 12:27:36AM +0100, Nicolas Dechesne wrote:
>> On Tue, Dec 1, 2015 at 6:13 AM, Andre McCurdy <armccurdy at gmail.com> wrote:
>> > I have two recipes within a single layer:
>> >
>> >   stblinux_3.14-1.7.bb
>> >   stblinux_3.14-1.8.bb
>> >
>> > If PREFERRED_VERSION_stblinux is set to "3.14%", then I would expect
>> > the version 3.14-1.8 recipe to be selected, however 3.14-1.7 gets
>> > selected instead.
>> >
>> > Reversing the order of files stored in pkg_pn[pn] seems to help. Is it
>> > a reasonable solution?
>>
>> I have a somewhat similar issue..
>>
>> in oe-core we have GCCVERSION set to 5.%, if I add meta-linaro layer
>> which has gcc_5.1.bb (while OE has gcc_5.2.bb), I am seeing this:
>>
>> $ bitbake -e gcc | grep ^PV
>> PV="5.1.0"
>>
>> While I would expect 5.2.0 to be picked up.
>>
>> This patch does not fix this issue, btw.
>>
>> If I remove gcc_5.1.bb from my layers, then I can see:
>>
>> $ bitbake -e gcc | grep ^PV
>> PV="5.2.0"

I think we've been seeing related but not identical issues.

Behaviour of PREFERRED_VERSION with a wildcard seems to be to take the
first possible match when testing the preferred version against a list
of available versions which are sorted first by layer priority (which
explains the behaviour you saw) and second by lexical order (ie
3.14-1.7 comes before 3.14-1.8, which explains the behaviour I have
seen).

My patch effectively reversed the order of the lexical sort, so only
affects the case where the wildcard pattern matches multiple versions
within the same layer priority - so it would not change the behaviour
you saw.

> PREFERRED_VERSION was always meant to identify only 1 provider, the wildcard
> is used only to say that you cannot specify the exact value - e.g. for
> floating versions from SCM.
>
> So if you have a layer with another recipe with version matching "5.%"
> you're supposed to set PREFERRED_VERSION to more specific version.
>
> See longer explanation in:
> http://comments.gmane.org/gmane.comp.sysutils.bitbake.devel/1038

Thanks for digging out the history. I've sent a patch to the oe-core
list to try to document that the wildcard should be avoided in cases
where it might match more than one available version.

> --
> Martin 'JaMa' Jansa     jabber: Martin.Jansa at gmail.com



More information about the bitbake-devel mailing list