Skip to contentSkip to conversation

enable override for suffix just include digit and dot

PATCH In review [email protected] 3 participants 6 messages Aug 26, 2016 – Aug 29, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 enable override for suffix just include digit and dot

From: 张忠山 <[email protected]>

Without this patch, if we write these in recipe test.bb:

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

Use 'bitbake test -e' to observe 'NAME':
#
# $NAME [2 operations]
# override[develop]:set .../test.bb:10
# "version is develop"
# pre-expansion value:
# "version is develop"
NAME="version is develop"

Obviously, override for '1.1.7' missing.

---
 lib/bb/data_smart.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/bb/data_smart.py +2 -2
index 59621b7..ea4ff80 100644
@@ -559,7 +559,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]:
@@ -637,7 +637,7 @@ class DataSmart(MutableMapping):
         if '_' in var:
             override = var[var.rfind('_')+1:]
             shortvar = var[:var.rfind('_')]
-            while override and override.islower():
+            while override and (override + 'a').islower():
                 try:
                     if shortvar in self.overridedata:
                         # Force CoW by recreating the list first
Signature · 1 line
1.9.1
#1 lore raw
Quoted 17 lines · On Aug 25, 2016 10:35 PM, <[email protected]> wrote:

From: 张忠山 <[email protected]>

Without this patch, if we write these in recipe test.bb:

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

Use 'bitbake test -e' to observe 'NAME':
#
# $NAME [2 operations]
# override[develop]:set .../test.bb:10
# "version is develop"
# pre-expansion value:
# "version is develop"
NAME="version is develop"

Quoted 1 line

Obviously, override for '1.1.7' missing.

Dot is not allowed in variable names intentionally since its file extension separator. I am not sure if its a good idea to allow it in variable names

Quoted 37 lines
---
 lib/bb/data_smart.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/bb/data_smart.py +2 -3
index 59621b7..ea4ff80 100644
@@ -559,7 +559,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]:
@@ -637,7 +637,7 @@ class DataSmart(MutableMapping):
         if '_' in var:
             override = var[var.rfind('_')+1:]
             shortvar = var[:var.rfind('_')]
-            while override and override.islower():
+            while override and (override + 'a').islower():
                 try:
                     if shortvar in self.overridedata:
                         # Force CoW by recreating the list first
--

1.9.1

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel

author
#2 lore raw
Quoted 15 lines
Quoted 15 lines

Without this patch, if we write these in recipe test.bb <http://test.bb>:

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

Use 'bitbake test -e' to observe 'NAME':
#
# $NAME [2 operations]
# override[develop]:set .../test.bb:10 <http://test.bb:10>
# "version is develop"
# pre-expansion value:
# "version is develop"
NAME="version is develop"

Quoted 5 lines
Quoted 1 line

Obviously, override for '1.1.7' missing.

Dot is not allowed in variable names intentionally since its file extension separator. I am not sure if its a good idea to allow it in variable names

Since we can use the path delimeter '/' in override like 'virtual/kernel'. Why we can't use dot in override.

And bitbkae would add 'PV'(which default to '1.0' in OE) to 'OVERRIDES'. So using dot in override may not be an issue.

In bitbake manual, It said we can use BBVERSIONS and override to let sigle recipe support multiple package version

If we can't use dot in override, Howto use BBVERSIONS? Use embedded python code to set var according version? But it is ugly tahn using override!

#3 lore raw
Quoted 25 lines · 张忠山

Without this patch, if we write these in recipe test.bb <http://test.bb>:

Quoted 13 lines
Quoted 13 lines

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

Use 'bitbake test -e' to observe 'NAME':
#
# $NAME [2 operations]
# override[develop]:set .../test.bb:10 <http://test.bb:10>
# "version is develop"
# pre-expansion value:
# "version is develop"
NAME="version is develop"

Quoted 7 lines
Quoted 2 lines

Obviously, override for '1.1.7' missing.

Dot is not allowed in variable names intentionally since its file extension separator. I am not sure if its a good idea to allow it in variable names

Since we can use the path delimeter '/' in override like 'virtual/kernel'. Why we can't use dot in override.

Quoted 8 lines

And bitbkae would add 'PV'(which default to '1.0' in OE) to 'OVERRIDES'. So using dot in override may not be an issue.

In bitbake manual, It said we can use BBVERSIONS and override to let sigle recipe support multiple package version

If we can't use dot in override, Howto use BBVERSIONS? Use embedded python code to set var according version? But it is ugly tahn using override!

OVERRIDES .= ":pv-${@'${PV}'.replace('.', '_')}"
FOO_pv-1_1_7 = "bar"

It's worth noting that you're likely the first person to try using it since I added the feature. oe-core moved to a policy where only one version of a given recipe is kept in most cases, making it less useful.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
author
#4 lore raw
Quoted 37 lines · Christopher Larson

On Sat, Aug 27, 2016 at 12:32 AM, 张忠山 <[email protected] <mailto:[email protected]>> wrote:

Without this patch, if we write these in recipe test.bb
<http://test.bb> <http://test.bb>:

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

Use 'bitbake test -e' to observe 'NAME':
#
# $NAME [2 operations]
# override[develop]:set .../test.bb:10
<http://test.bb:10> <http://test.bb:10>
# "version is develop"
# pre-expansion value:
# "version is develop"
NAME="version is develop"

Obviously, override for '1.1.7' missing.

Dot is not allowed in variable names intentionally since its file extension separator. I am not sure if its a good idea to allow it in variable names

Since we can use the path delimeter '/' in override like 'virtual/kernel'. Why we can't use dot in override.

And bitbkae would add 'PV'(which default to '1.0' in OE) to 'OVERRIDES'. So using dot in override may not be an issue.

In bitbake manual, It said we can use BBVERSIONS and override to let sigle recipe support multiple package version

Quoted 8 lines

If we can't use dot in override, Howto use BBVERSIONS? Use embedded python code to set var according version? But it is ugly tahn using override!

OVERRIDES .= ":pv-${@'${PV}'.replace('.', '_')}"
FOO_pv-1_1_7 = "bar"

Thanks for your suggestion.
But I found just the folowwing enough:

	OVERRIDES .= ":pv-${PV}"
	FOO_pv-1.1.7 = 'bar'

So I wonder why we must avoid dot in override. Is it mandatory or a convention.

And is there some taboos with 'override'. If any it should appear in manual I think.

Quoted 3 lines

It's worth noting that you're likely the first person to try using it since I added the feature. oe-core moved to a policy where only one version of a given recipe is kept in most cases, making it less useful.

Does this means 'BBVERSIONS' would disappeared in th future?

author
#5 lore raw
In reply to Christopher Larson
Quoted 4 lines

OVERRIDES .= ":pv-${@'${PV}'.replace('.', '_')}"
FOO_pv-1_1_7 = "bar"

Now I test my project fully, Found can't use ${PV} to generate OVERRIDES.

Because of BBVERSIONS, When generage OVERRIDES, the PV not setted according PREFFERED_VERSION_xxx. It use the setting in bitbake.conf which default to 1.0

So maybe this worked:

OVERRIDES .= ":pv-${PREFERRED_VERSION_${PN}}"
FOO_pv-1_1_7 = "bar"