diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-09-25 15:17:17 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-27 16:45:28 +0100 |
commit | 81602499c911f5523ee304349b23608e1f8ffff6 (patch) | |
tree | 5f999441396f02f9b7f7b6702acbb33dea7ebdec /bitbake | |
parent | 31f0de42fc993034f144d0b3c0e123d83a9be290 (diff) | |
download | poky-81602499c911f5523ee304349b23608e1f8ffff6.tar.gz |
bitbake: lib/bb/data.py: improve output for expansion errors
Instead of logging the function/variable separately as a NOTE when
failing to expand, re-raise ExpansionError with more contextual
information. This means that the full details are reported in Hob as
well as actually reporting the original error message in any UI where
we previously did not. For example, we used to get this with tab/space
indentation issues in a python function:
NOTE: Error expanding variable populate_packages
ERROR: Unable to parse /path/to/recipename.bb
Now, we will get this:
ERROR: ExpansionError during parsing /path/to/recipename.bb: Failure
expanding variable populate_packages: IndentationError: unindent does
not match any outer indentation level (<string>, line 4)
Fixes [YOCTO #3162].
(Bitbake rev: ce5c7a95a359cdaecab7c4a519ad4f9df029da82)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/data.py | 5 | ||||
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index 5b7a092a21..9a32353d68 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py | |||
@@ -323,9 +323,8 @@ def build_dependencies(key, keys, shelldeps, vardepvals, d): | |||
323 | 323 | ||
324 | deps |= set((vardeps or "").split()) | 324 | deps |= set((vardeps or "").split()) |
325 | deps -= set((d.getVarFlag(key, "vardepsexclude", True) or "").split()) | 325 | deps -= set((d.getVarFlag(key, "vardepsexclude", True) or "").split()) |
326 | except: | 326 | except Exception as e: |
327 | bb.note("Error expanding variable %s" % key) | 327 | raise bb.data_smart.ExpansionError(key, None, e) |
328 | raise | ||
329 | return deps, value | 328 | return deps, value |
330 | #bb.note("Variable %s references %s and calls %s" % (key, str(deps), str(execs))) | 329 | #bb.note("Variable %s references %s and calls %s" % (key, str(deps), str(execs))) |
331 | #d.setVarFlag(key, "vardeps", deps) | 330 | #d.setVarFlag(key, "vardeps", deps) |
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index f5f3b13a73..ec3c04e30c 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -103,7 +103,10 @@ class ExpansionError(Exception): | |||
103 | self.variablename = varname | 103 | self.variablename = varname |
104 | self.exception = exception | 104 | self.exception = exception |
105 | if varname: | 105 | if varname: |
106 | self.msg = "Failure expanding variable %s, expression was %s which triggered exception %s: %s" % (varname, expression, type(exception).__name__, exception) | 106 | if expression: |
107 | self.msg = "Failure expanding variable %s, expression was %s which triggered exception %s: %s" % (varname, expression, type(exception).__name__, exception) | ||
108 | else: | ||
109 | self.msg = "Failure expanding variable %s: %s: %s" % (varname, type(exception).__name__, exception) | ||
107 | else: | 110 | else: |
108 | self.msg = "Failure expanding expression %s which triggered exception %s: %s" % (expression, type(exception).__name__, exception) | 111 | self.msg = "Failure expanding expression %s which triggered exception %s: %s" % (expression, type(exception).__name__, exception) |
109 | Exception.__init__(self, self.msg) | 112 | Exception.__init__(self, self.msg) |