* [PATCH] lib/bb/data.py: improve output for expansion errors
@ 2012-09-25 14:17 Paul Eggleton
2012-09-27 15:42 ` Richard Purdie
0 siblings, 1 reply; 2+ messages in thread
From: Paul Eggleton @ 2012-09-25 14:17 UTC (permalink / raw)
To: bitbake-devel
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].
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
bitbake/lib/bb/data.py | 5 ++---
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 5b7a092..9a32353 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):
deps |= set((vardeps or "").split())
deps -= set((d.getVarFlag(key, "vardepsexclude", True) or "").split())
- except:
- bb.note("Error expanding variable %s" % key)
- raise
+ except Exception as e:
+ raise bb.data_smart.ExpansionError(key, None, e)
return deps, value
#bb.note("Variable %s references %s and calls %s" % (key, str(deps), str(execs)))
#d.setVarFlag(key, "vardeps", deps)
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index f5f3b13..ec3c04e 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -103,7 +103,10 @@ class ExpansionError(Exception):
self.variablename = varname
self.exception = exception
if varname:
- self.msg = "Failure expanding variable %s, expression was %s which triggered exception %s: %s" % (varname, expression, type(exception).__name__, exception)
+ if expression:
+ self.msg = "Failure expanding variable %s, expression was %s which triggered exception %s: %s" % (varname, expression, type(exception).__name__, exception)
+ else:
+ self.msg = "Failure expanding variable %s: %s: %s" % (varname, type(exception).__name__, exception)
else:
self.msg = "Failure expanding expression %s which triggered exception %s: %s" % (expression, type(exception).__name__, exception)
Exception.__init__(self, self.msg)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] lib/bb/data.py: improve output for expansion errors
2012-09-25 14:17 [PATCH] lib/bb/data.py: improve output for expansion errors Paul Eggleton
@ 2012-09-27 15:42 ` Richard Purdie
0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2012-09-27 15:42 UTC (permalink / raw)
To: Paul Eggleton; +Cc: bitbake-devel
On Tue, 2012-09-25 at 15:17 +0100, Paul Eggleton wrote:
> 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].
>
> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
> ---
> bitbake/lib/bb/data.py | 5 ++---
> bitbake/lib/bb/data_smart.py | 5 ++++-
> 2 files changed, 6 insertions(+), 4 deletions(-)
Merged to master, thanks.
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-27 15:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-25 14:17 [PATCH] lib/bb/data.py: improve output for expansion errors Paul Eggleton
2012-09-27 15:42 ` Richard Purdie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.