Skip to contentSkip to conversation

data_smart: Restrict expansion regexp to not include : characters

PATCH In review Richard Purdie 2 participants 2 messages Apr 8, 2016 – Apr 10, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 data_smart: Restrict expansion regexp to not include : characters

Bitbake variables don't include ":" characters so exclude these from the variable expansion regexp.

This assists when parsing shell code which does A=${B:-C} as we don't want a dependency on a variable called "B:-C".

bitbake/lib/bb/data_smart.py +1 -1
index d61ad53..fa1e794 100644
@@ -40,7 +40,7 @@ logger = logging.getLogger("BitBake.Data")
 
 __setvar_keyword__ = ["_append", "_prepend", "_remove"]
 __setvar_regexp__ = re.compile('(?P<base>.*?)(?P<keyword>_append|_prepend|_remove)(_(?P<add>.*))?$')
-__expand_var_regexp__ = re.compile(r"\${[^{}@\n\t ]+}")
+__expand_var_regexp__ = re.compile(r"\${[^{}@\n\t :]+}")
 __expand_python_regexp__ = re.compile(r"\${@.+?}")
 
 def infer_caller_details(loginfo, parent = False, varval = True):
#1 lore raw
Quoted 10 lines · Richard Purdie

Bitbake variables don't include ":" characters so exclude these from the variable
expansion regexp.

This assists when parsing shell code which does A=${B:-C} as we don't want a
dependency on a variable called "B:-C".

Nice, this one's been bugging me on and off for a while :) Looks good.