bitbake: data_smart: Expand overrides cache recursively

If the values that make up OVERRIDES are themselves overridden,
we end up into some horrible circular logic. Unfortunately some
metadata does depend on this functionality.

e.g:
DEFAULTTUNE_virtclass-multilib-xxx = Y
which changes TUNE_ARCH
which changes TARGET_ARCH
which changes OVERRIDES

As a solution, we iterate override expansion until the values don't
change. If we iterate more than 5 times we abort and tell the user to
report the issue.

(Bitbake rev: 10279697c701e01bf6fdd5e9f92792ef5134807b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2015-09-16 21:57:55 +01:00
parent 3a5e46b6ed
commit 4325f6f03d
1 changed files with 12 additions and 3 deletions

View File

@ -413,9 +413,11 @@ class DataSmart(MutableMapping):
self.overrides = None
def need_overrides(self):
if self.overrides is None:
if self.inoverride:
return
if self.overrides is not None:
return
if self.inoverride:
return
for count in range(5):
self.inoverride = True
# Can end up here recursively so setup dummy values
self.overrides = []
@ -424,6 +426,13 @@ class DataSmart(MutableMapping):
self.overridesset = set(self.overrides)
self.inoverride = False
self.expand_cache = {}
newoverrides = (self.getVar("OVERRIDES", True) or "").split(":") or []
if newoverrides == self.overrides:
break
self.overrides = newoverrides
self.overridesset = set(self.overrides)
else:
bb.fatal("Overrides could not be expanded into a stable state after 5 iterations, overrides must be being referenced by other overridden variables in some recursive fashion. Please provide your configuration to bitbake-devel so we can laugh, er, I mean try and understand how to make it work.")
def initVar(self, var):
self.expand_cache = {}