From 24a4fa5bad7f9b59347035a99087e5503a9388b4 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 25 Jun 2020 12:58:57 +0100 Subject: bitbake: 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] (Bitbake rev: 3d72e23109990970fbb1086923277af752168b4a) Signed-off-by: Richard Purdie --- bitbake/lib/bb/taskdata.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py index d13a124983..ffbaf362e8 100644 --- a/bitbake/lib/bb/taskdata.py +++ b/bitbake/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): -- cgit v1.2.3-54-g00ecf