On poky master (6204a3f5f4), either of these lines: DISTRO_FEATURES_append_machine = " ${@bb.utils.contains('DISTRO_FEATURES', 'feature', ' another_feature', '', d)}" DISTRO_FEATURES_machine += "${@bb.utils.contains('DISTRO_FEATURES', 'feature', 'another_feature', '', d)}" Results in a parse error where it infinitely parses the conditional code: $ bitbake feature-image-minimal ERROR: Unable to parse <expansion> Traceback (most recent call last): File "/home/<user>/project/poky/bitbake/lib/bb/data_smart.py", line 416, in DataSmart.expandWithRefs(s=" feature ${@bb.utils.contains('DISTRO_FEATURES', 'feature', ' another_feature', '', d)}", varname='DISTRO_FEATURES'): tb = sys.exc_info()[2] > raise ExpansionError(varname, s, exc).with_traceback(tb) from exc File "/home/<user>/project/poky/bitbake/lib/bb/data_smart.py", line 403, in DataSmart.expandWithRefs(s=" feature ${@bb.utils.contains('DISTRO_FEATURES', 'feature', ' another_feature', '', d)}", varname='DISTRO_FEATURES'): try: > s = __expand_python_regexp__.sub(varparse.python_sub, s) except SyntaxError as e: File "/home/<user>/project/poky/bitbake/lib/bb/data_smart.py", line 116, in VariableParse.python_sub(match=<re.Match object; span=(20, 96), match="${@bb.utils.contains('DISTRO_FEATURES', 'feature>): > parser = bb.codeparser.PythonParser(self.varname, logger) parser.parse_python(code) File "/home/<user>/project/poky/bitbake/lib/bb/codeparser.py", line 279, in PythonParser.__init__(name='DISTRO_FEATURES', log=<BBLogger BitBake.Data (Level 8)>): self.references = set() > self.log = BufferedLogger('BitBake.Data.PythonParser', logging.DEBUG, log) File "/home/<user>/project/poky/bitbake/lib/bb/codeparser.py", line 184, in BufferedLogger.__init__(name='BitBake.Data.PythonParser', level=10, target=<BBLogger BitBake.Data (Level 8)>): def __init__(self, name, level=0, target=None): > Logger.__init__(self, name) self.setLevel(level) bb.data_smart.ExpansionError: Failure expanding variable DISTRO_FEATURES, expression was feature ${@bb.utils.contains('DISTRO_FEATURES', 'feature', ' another_feature', '', d)} which triggered exception RecursionError: maximum recursion depth exceeded This also occurs if I use a temporary variable to store the result of the conditional, and append the value of that temporary variable to DISTRO_FEATURES for the machine. My rationale for doing this is that we have some dependent layers, and we need 'another_feature' known by the parser (for a particular machine) even if the layer implementing 'feature' (which has a dependency on 'another_feature') is optionally later in bblayers.conf. Regardless of the rationale, provided the inclusion isn't breaking any rules then I would expect it to either succeed or fail gracefully?
This is an edge with a stack that explains what's going wrong but maybe we can improve how it's handled.
Build move to 5.0 -- ../Randy
Bulk move of 5.0 medium importance issues to 5.99. Move to 5.1 if you want to actively work on an issue.
Move to 5.99 since no one is actively working on this issue. Move to 5.x if you start on a task, please.
We don't support circular references and realistically, I don't think we can unfortunately so this is something we can't fix.