From a9aa1d24c7c4518173f622a1fab55a98a16150f9 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 16 Oct 2018 14:16:27 +0100 Subject: bitbake: data: Fix whitespace on _remove operations We have some slightly odd behaviours with the current implementation of _remove operations. For example: TEST = " A B" TEST_remove = "C" would trigger TEST to become "A B" even thought it doesn't contain "C". In particular, this means that an inactive remove operator added in a bbappend could change the task checksum which is not desireable. Fix the operation to preserve whitespace, adding new tests to make this explict and test further corner cases. Also update the manual to match. (Bitbake rev: c0a23dd9155c50a6b7df796980bc7b612cac7994) Signed-off-by: Richard Purdie --- bitbake/lib/bb/data_smart.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bitbake/lib/bb/data_smart.py') diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 4434142a02..0a8488ca1b 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -42,6 +42,7 @@ __setvar_keyword__ = ["_append", "_prepend", "_remove"] __setvar_regexp__ = re.compile('(?P.*?)(?P_append|_prepend|_remove)(_(?P[^A-Z]*))?$') __expand_var_regexp__ = re.compile(r"\${[^{}@\n\t :]+}") __expand_python_regexp__ = re.compile(r"\${@.+?}") +__whitespace_split__ = re.compile('(\s)') def infer_caller_details(loginfo, parent = False, varval = True): """Save the caller the trouble of specifying everything.""" @@ -818,8 +819,8 @@ class DataSmart(MutableMapping): if removes: filtered = filter(lambda v: v not in removes, - value.split()) - value = " ".join(filtered) + __whitespace_split__.split(value)) + value = "".join(filtered) if expand and var in self.expand_cache: # We need to ensure the expand cache has the correct value # flag == "_content" here -- cgit v1.2.3-54-g00ecf