parse/ast: Show errors for append/prepend/remove operators combined with +=/.=
PATCH 1/1 parse/ast: Show errors for append/prepend/remove operators combined with +=/.=
Operations like XXX:append += "YYY" are almost always wrong and this is a common mistake made in the metadata. Show warnings for these usages with a view to making it a fatal error eventually.
--- lib/bb/parse/ast.py | 4 ++++ 1 file changed, 4 insertions(+)
lib/bb/parse/ast.py +4 -0
@@ -130,6 +130,10 @@ class DataNode(AstNode): else: val = groupd["value"] + if ":append" in key or ":remove" in key or ":prepend" in key: + if op in ["append", "prepend", "postdot", "predot"]: + bb.warn(key + " " + groupd[op] + " is not a recommended operator combination, please replace it.") + flag = None if 'flag' in groupd and groupd['flag'] is not None: flag = groupd['flag']
Signature · 1 line
2.32.0
Quoted 14 lines · Richard Purdie
Operations like XXX:append += "YYY" are almost always wrong and this is a common mistake made in the metadata. Show warnings for these usages with a view to making it a fatal error eventually.
Signed-off-by Richard Purdie <[email protected]>--- lib/bb/parse/ast.py | 4 ++++ 1 file changed, 4 insertions(+)lib/bb/parse/ast.py +0
-0
lib/bb/parse/ast.py class DataNode(AstNode): · line 136
Quoted 7 lines
lib/bb/parse/ast.py +4
-0@@ -130,6 +130,10 @@ class DataNode(AstNode): else: val = groupd["value"] + if ":append" in key or ":remove" in key or ":prepend" in key: + if op in ["append", "prepend", "postdot", "predot"]: + bb.warn(key + " " + groupd[op] + " is not a recommended operator combination, please replace it.") +
I've seen also weird combinations like
append:remove
with multiple contradicting override operations out in the wild, might be worth to warn about them as well in a follow-up
Quoted 14 lines
lib/bb/parse/ast.py +0
-1flag = None if 'flag' in groupd and groupd['flag'] is not None: flag = groupd['flag'] -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#12877): https://lists.openembedded.org/g/bitbake-devel/message/12877
Mute This Topic: https://lists.openembedded.org/mt/86816155/3647476
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Hi all,
Quoted 26 lines · Konrad Weihmann
Quoted 14 lines · Richard Purdie
Operations like XXX:append += "YYY" are almost always wrong and this is a common mistake made in the metadata. Show warnings for these usages with a view to making it a fatal error eventually.
Signed-off-by Richard Purdie <[email protected]>--- lib/bb/parse/ast.py | 4 ++++ 1 file changed, 4 insertions(+)lib/bb/parse/ast.py +0
-0lib/bb/parse/ast.py class DataNode(AstNode): · line 135
Quoted 6 lines
lib/bb/parse/ast.py +4
-0@@ -130,6 +130,10 @@ class DataNode(AstNode): else: val = groupd["value"] + if ":append" in key or ":remove" in key or ":prepend" in key: + if op in ["append", "prepend", "postdot", "predot"]: + bb.warn(key + " " + groupd[op] + " is not a recommended operator combination, please replace it.") +I've seen also weird combinations like
Quoted 5 lines
append:remove
with multiple contradicting override operations out in the wild, might be worth to warn about them as well in a follow-up
I assume :append:.*:append is also something that should be avoided.
And I think we can even go as far as saying that you cannot have any two of append/prepend/remove ?
So...
:append:.*:append
:append:.*:prepend
:append:.*:remove
:prepend:.*:append
:prepend:.*:prepend
:prepend:.*:remove
:remove:.*:remove
:remove:.*:append
:remove:.*:prepend
are no-nos.
Cheers,
Quentin
Hi,
this seems to be merged in 1.52 branch now and not in master, was that intentional?
I think this should go only into master branch, right?
Quoted 40 lines · Richard Purdie
Operations like XXX:append += "YYY" are almost always wrong and this is a common mistake made in the metadata. Show warnings for these usages with a view to making it a fatal error eventually.
Signed-off-by Richard Purdie <[email protected]>--- lib/bb/parse/ast.py | 4 ++++ 1 file changed, 4 insertions(+)lib/bb/parse/ast.py +4
-0@@ -130,6 +130,10 @@ class DataNode(AstNode): else: val = groupd["value"] + if ":append" in key or ":remove" in key or ":prepend" in key: + if op in ["append", "prepend", "postdot", "predot"]: + bb.warn(key + " " + groupd[op] + " is not a recommended operator combination, please replace it.") + flag = None if 'flag' in groupd and groupd['flag'] is not None:flag = groupd['flag']
--
2.32.0-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#12877):
https://lists.openembedded.org/g/bitbake-devel/message/12877
Mute This Topic: https://lists.openembedded.org/mt/86816155/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 6 lines · Martin Jansa
Hi,
this seems to be merged in 1.52 branch now and not in master, was that intentional?
I think this should go only into master branch, right?
Correct, not sure what I did there. I've reverted it as that was not intended and I shouldn't force push now.
Cheers,
Richard