summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2018-11-14 17:46:38 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-19 17:03:25 +0000
commit4a5062302bcdc6292ecbb4deadf1494082c73d97 (patch)
tree4d252d9efd0c8e2490681157231117f4d34c5f88
parentc1f46c5064460707500a76a01ec3dc95e3d26667 (diff)
downloadpoky-4a5062302bcdc6292ecbb4deadf1494082c73d97.tar.gz
bitbake: data_smart: Add original traceback to ExpansionError
This can make it print clearer errors, for exmaple: Add Runtime_error to 'def oe_import(d)" 16 def oe_import(d): 17 import sys 18 Runtime_error [snip] * Before the patch: $ bitbake -p ERROR: Unable to parse /buildarea1/lyang1/poky/bitbake/lib/bb/data_smart.py Traceback (most recent call last): File "/buildarea1/lyang1/poky/bitbake/lib/bb/data_smart.py", line 430, in DataSmart.expandWithRefs(s='${@oe_import(d)}', varname='OE_IMPORTED[:=]'): except Exception as exc: > raise ExpansionError(varname, s, exc) from exc bb.data_smart.ExpansionError: Failure expanding variable OE_IMPORTED[:=], expression was ${@oe_import(d)} which triggered exception NameError: name 'Runtime_error' is not defined This error message has two problems: - "Unable to parse data_smart.py": This isn't the real cause. - It pionts to "raise ExpansionError(varname, s, exc) from exc" which isn't clear enough. * After the patch: $ bitbake -p ERROR: Unable to parse OE_IMPORTED[:=] Traceback (most recent call last): File "OE_IMPORTED[:=]", line 1, in <module> File "/buildarea1/lyang1/poky/meta/classes/base.bbclass", line 18, in oe_import(d=<bb.data_smart.DataSmart object at 0x7f9257e7a0b8>): import sys > Runtime_error bb.data_smart.ExpansionError: Failure expanding variable OE_IMPORTED[:=], expression was ${@oe_import(d)} which triggered exception NameError: name 'Runtime_error' is not defined This one is more clearer than before. (Bitbake rev: c0fe524c1aeccb24ddd2e1f7bf235c00fdbf79a7) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/data_smart.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 6b94fc4b42..efa5a79f78 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -427,7 +427,8 @@ class DataSmart(MutableMapping):
427 except bb.parse.SkipRecipe: 427 except bb.parse.SkipRecipe:
428 raise 428 raise
429 except Exception as exc: 429 except Exception as exc:
430 raise ExpansionError(varname, s, exc) from exc 430 tb = sys.exc_info()[2]
431 raise ExpansionError(varname, s, exc).with_traceback(tb) from exc
431 432
432 varparse.value = s 433 varparse.value = s
433 434