summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-10 14:20:07 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-11 22:39:19 +0100
commit3a737a783cedd128ae8c8b1c4f55642b9a5691ae (patch)
treeae5c00216c64f8b30163ba29ab8afd5078b4ad4c /bitbake/lib/bb
parentf49854c1f7b7ab72c803864ab7f4c782fc503ca0 (diff)
downloadpoky-3a737a783cedd128ae8c8b1c4f55642b9a5691ae.tar.gz
bitbake: data_smart: Make ExpansionErrors more readable
This adds context to ExpansionError messages which show the variable chain for which expansion is being attempted. This should allow users to debug the issues more easily than the current message (the first line alone below). Example output from a SRC_URI which references ${S}: bb.data_smart.ExpansionError: Failure expanding variable PV, expression was 0.1+git${SRCPV} which triggered exception RecursionError: maximum recursion depth exceeded while calling a Python object The variable dependency chain for the failure is: PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> WORKDIR -> S -> SRC_URI -> SRCPV -> PV -> BP -> FILESPATH which is more useful that no output. We could truncate at repetition but I suspect this makes this clearer as it stands so there is little value in complicating the code. (Bitbake rev: 699634bec47964fa7ab18689dc23db6f0bc22fb3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/data_smart.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 65528c6ae6..515d195fe8 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -151,6 +151,7 @@ class ExpansionError(Exception):
151 self.expression = expression 151 self.expression = expression
152 self.variablename = varname 152 self.variablename = varname
153 self.exception = exception 153 self.exception = exception
154 self.varlist = [varname or expression]
154 if varname: 155 if varname:
155 if expression: 156 if expression:
156 self.msg = "Failure expanding variable %s, expression was %s which triggered exception %s: %s" % (varname, expression, type(exception).__name__, exception) 157 self.msg = "Failure expanding variable %s, expression was %s which triggered exception %s: %s" % (varname, expression, type(exception).__name__, exception)
@@ -160,8 +161,13 @@ class ExpansionError(Exception):
160 self.msg = "Failure expanding expression %s which triggered exception %s: %s" % (expression, type(exception).__name__, exception) 161 self.msg = "Failure expanding expression %s which triggered exception %s: %s" % (expression, type(exception).__name__, exception)
161 Exception.__init__(self, self.msg) 162 Exception.__init__(self, self.msg)
162 self.args = (varname, expression, exception) 163 self.args = (varname, expression, exception)
164
165 def addVar(self, varname):
166 self.varlist.append(varname)
167
163 def __str__(self): 168 def __str__(self):
164 return self.msg 169 chain = "\nThe variable dependency chain for the failure is: " + " -> ".join(self.varlist)
170 return self.msg + chain
165 171
166class IncludeHistory(object): 172class IncludeHistory(object):
167 def __init__(self, parent = None, filename = '[TOP LEVEL]'): 173 def __init__(self, parent = None, filename = '[TOP LEVEL]'):
@@ -407,7 +413,8 @@ class DataSmart(MutableMapping):
407 raise 413 raise
408 if s == olds: 414 if s == olds:
409 break 415 break
410 except ExpansionError: 416 except ExpansionError as e:
417 e.addVar(varname)
411 raise 418 raise
412 except bb.parse.SkipRecipe: 419 except bb.parse.SkipRecipe:
413 raise 420 raise