From c0a23dd9155c50a6b7df796980bc7b612cac7994 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 16 Oct 2018 14:16:27 +0100 Subject: 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. Signed-off-by: Richard Purdie --- lib/bb/data_smart.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/bb/data_smart.py') diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py index 4434142a0..0a8488ca1 100644 --- a/lib/bb/data_smart.py +++ b/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 1.2.3-korg