Skip to contentSkip to conversation

question about BBVERSIONS OVERRIDES and PREFERRED_VERSION

DISCUSSION 张忠山 2 participants 5 messages Aug 21, 2016 – Aug 25, 2016

lore
Share & tools
lore

张忠山

author
#0 lore raw

I'm using bare bitbake cloned from 'git://git.openembedded.org/bitbake' Revision id is: 309f5907a3661821e041ed14645b5d165007b058

I has a tese.bb, the content is:

        OVERRIDES = ""
        PN = "test"
        PV = ""

        PREFERRED_VERSION_test = 'xxx'

        OVERRIDES .= "${@':' + ':'.join([x for x in 
'${BBVERSIONS}'.split()])}"
        BBVERSIONS = "develop 1.1.7"
        PREFERRED_VERSION_test = '1.1.7'


        NAME_1.1.7   = 'version is 1.1.7'
        NAME_develop = 'version is develop'


        python do_build() {
            bb.plain("==%s==" % d.getVar("NAME", True))
        }

Use 'bitbake test -e | less' to explore var setting. I found:

	# $PV [3 operations]
	#   set /home/zzs/temp/bitbake-hello-world/main/../mylayer/test.bb:4
	#     ""
	#   set ast.py:401 [verfunc]
	#     "1.1.7"
	#   set ast.py:401 [verfunc]
	#     "develop"
	# pre-expansion value:
	#   "develop"
	PV="develop"

I'm already set PREFERRED_VERSION_test = '1.1.7' sure. Why the 'PV' is 'develop' And I try set BBVERSIONS = "develop 1.1.7 xx yy". Then 'PV' becomes 'yy' So my first question is:

How can I select version '1.1.7' for test package through BBVERSIONS and PREFERRED_VERSION

The second question comes from the override of var 'NAME'. In the output of 'bitbake test -e' can found:

	#
	# $NAME
	#   override[develop]:set 

/home/zzs/temp/bitbake-hello-world/main/../mylayer/test.bb:14
# "version is develop"
NAME="version is develop"

I'm already set NAME_1.1.7 why bitbake just found override 'develop' but '1.1.7'

author
#1 lore raw

I answer my first question

The reseaon is that PREFERRED_VERSION_xxx must in a conf file which should put data to global area.

So I edit my bitbake.conf. Now it is:

BB_SIGNATURE_HANDLER = "basichash"

TMPDIR  = "${TOPDIR}/tmp"
CACHE   = "${TMPDIR}/cache"
STAMP   = "${TMPDIR}/stamps"
T       = "${TMPDIR}/work"
B       = "${TMPDIR}"

PREFERRED_VERSION_test = '1.1.7'

And my test.bb Now is:

OVERRIDES = ""
PN = "test"
PV = ""

OVERRIDES .= "${@'test:' + ':'.join([x for x in '${BBVERSIONS}'.split()])}" BBVERSIONS = "develop 1.1.7 pp"

NAME_1.1.7 = 'version is 1.1.7'
NAME_develop = 'version is develop'
NAME_pp = 'version is pp'

python do_build() {
    bb.plain("==%s==" % d.getVar('NAME', True))
}

Use 'bitbake test -e' to examine the overrides of var 'NAME', It is still not contain override for '1.1.7':

#
# $NAME [2 operations]
# override[develop]:set /home/zzs/temp/bitbake-hello-world/main/../mylayer/test.bb:10
# "version is develop"
# override[pp]:set /home/zzs/temp/bitbake-hello-world/main/../mylayer/test.bb:11
# "version is pp"

# pre-expansion value:
#   "version is pp"
NAME="version is pp"

Why ? I expect it should contain override for '1.1.7', like this:

         override[1.1.7]:set 
/home/zzs/temp/bitbake-hello-world/main/../mylayer/test.bb:11
         ....

And I found all NAME_xxx, where xxx is [a-z] all OK? I has no idea about this. Anybody help me?

author
#2 lore raw
Quoted 16 lines

Use 'bitbake test -e' to examine the overrides of var 'NAME', It is still not contain override for '1.1.7':

#
# $NAME [2 operations]
# override[develop]:set
/home/zzs/temp/bitbake-hello-world/main/../mylayer/test.bb:10
# "version is develop"
# override[pp]:set
/home/zzs/temp/bitbake-hello-world/main/../mylayer/test.bb:11
# "version is pp"

# pre-expansion value:
#   "version is pp"
NAME="version is pp"
Quoted 8 lines

Why ? I expect it should contain override for '1.1.7', like this:

         override[1.1.7]:set
/home/zzs/temp/bitbake-hello-world/main/../mylayer/test.bb:11
         ....

And I found all NAME_xxx, where xxx is [a-z] all OK? I has no idea about this.
Anybody help me?

I found using the flowwing patch can solve my problem about override for '1.1.7':

============================================================

bitbake/lib/bb/data_smart.py +1 -1
index 2ab884b..216ba93 100644
@@ -552,7 +552,7 @@ class DataSmart(MutableMapping):
         # aka pay the cookie monster
         override = var[var.rfind('_')+1:]
         shortvar = var[:var.rfind('_')]
-        while override and override.islower():
+        while override and (override + 'a').islower():
             if shortvar not in self.overridedata:
                 self.overridedata[shortvar] = []
             if [var, override] not in self.overridedata[shortvar]:

============================================================

But, I'm not sure this work for other env.

I don't know why just lower case override permited in this function.

Version string just include digit and point is very common, but islower() return False for these strings.

This behavior is intended or a bug?
Or has another way to solve my problem?

#3 lore raw
Quoted 9 lines · 张忠山

But, I'm not sure this work for other env.

I don't know why just lower case override permited in this function.

Version string just include digit and point is very common, but islower() return False for these strings.

This behavior is intended or a bug?
Or has another way to solve my problem?

There was a discussion a while ago and we decided to only have bitbake accept lower case overrides. I believe that the numeric piece isn't an issue but the decimal point character probably is.

The reason for this was to try and avoid some of the performance costs where any variable with a "_" in the name was potentially an override character and this was costly for variable processing.

Cheers,

Richard

author
#4 lore raw
Quoted 10 lines
Quoted 9 lines

But, I'm not sure this work for other env.

I don't know why just lower case override permited in this function.

Version string just include digit and point is very common, but islower() return False for these strings.

This behavior is intended or a bug?
Or has another way to solve my problem?

Quoted 8 lines

There was a discussion a while ago and we decided to only have bitbake accept lower case overrides. I believe that the numeric piece isn't an issue but the decimal point character probably is.

The reason for this was to try and avoid some of the performance costs where any variable with a "_" in the name was potentially an override character and this was costly for variable processing.

So, that's said I can't use override based upon version string just like '1.1.7'

If it is true, Does it means 'BBVERSIONS' has no sense?

I can't believe that widly used version string format can't be used as override!