aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2020-06-25 12:58:57 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-06-25 13:50:05 +0100
commit3d72e23109990970fbb1086923277af752168b4a (patch)
treedafc7baf344eecfd7c13a2d595a2c0a8a7fa1674 /lib
parent44b57216548fa96a5ecab02cfed517e0d631dc44 (diff)
downloadbitbake-3d72e23109990970fbb1086923277af752168b4a.tar.gz
taskdata: Improve handling of regex in ASSUME_PROVIDED
ASSUME_PROVIDED can take regexs however the current way of handling this in code is suboptimal. It means that you can add something like: DEPENDS += "texinfo-nativejunk-that-does-not-exist" and if texinfo-native is in ASSUME_PROVIDED, no error will occur. Update the code to only treat something as a regex if a start or end anchor character is present (which wouldn't be valid in a recipe name). [YOCTO #13893] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/bb/taskdata.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/bb/taskdata.py b/lib/bb/taskdata.py
index d13a12498..ffbaf362e 100644
--- a/lib/bb/taskdata.py
+++ b/lib/bb/taskdata.py
@@ -21,8 +21,13 @@ def re_match_strings(target, strings):
Whether or not the string 'target' matches
any one string of the strings which can be regular expression string
"""
- return any(name == target or re.match(name, target)
- for name in strings)
+ for name in strings:
+ if name.startswith("^") or name.endswith("$"):
+ if re.match(name, target):
+ return True
+ elif name == target:
+ return True
+ return False
class TaskEntry:
def __init__(self):