diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-05-30 15:56:11 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-06-01 14:29:32 +0100 |
commit | 8a43a6a32bafc654046250f5362509fd92dd4d10 (patch) | |
tree | c074c7cb1bec33de902e32d11abec2c2e252471d /bitbake/lib | |
parent | 4a78f52d87d5bba57e24f550a84d99e045777b30 (diff) | |
download | poky-8a43a6a32bafc654046250f5362509fd92dd4d10.tar.gz |
bitbake: build/utils: Fix broken exception handling
Checking for explicit exception names is bad, we also want to be able top
rely on inheritance. Fix these checks to be part of the real except clauses
so SkipPackage is recognised as being inherited from SkipRecipe.
(Bitbake rev: b131229145e1f2c372d6230a7b554e436c13c3f9)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/build.py | 5 | ||||
-rw-r--r-- | bitbake/lib/bb/utils.py | 9 |
2 files changed, 4 insertions, 10 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 98ee36ce58..32022d8085 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
@@ -242,10 +242,9 @@ def exec_func_python(func, d, runfile, cwd=None): | |||
242 | try: | 242 | try: |
243 | comp = utils.better_compile(code, func, bbfile) | 243 | comp = utils.better_compile(code, func, bbfile) |
244 | utils.better_exec(comp, {"d": d}, code, bbfile) | 244 | utils.better_exec(comp, {"d": d}, code, bbfile) |
245 | except (bb.parse.SkipRecipe, bb.build.FuncFailed): | ||
246 | raise | ||
245 | except: | 247 | except: |
246 | if sys.exc_info()[0] in (bb.parse.SkipRecipe, bb.build.FuncFailed): | ||
247 | raise | ||
248 | |||
249 | raise FuncFailed(func, None) | 248 | raise FuncFailed(func, None) |
250 | finally: | 249 | finally: |
251 | bb.debug(2, "Python function %s finished" % func) | 250 | bb.debug(2, "Python function %s finished" % func) |
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index c179394dc9..96d8218812 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -354,16 +354,11 @@ def better_exec(code, context, text = None, realfile = "<code>"): | |||
354 | code = better_compile(code, realfile, realfile) | 354 | code = better_compile(code, realfile, realfile) |
355 | try: | 355 | try: |
356 | exec(code, get_context(), context) | 356 | exec(code, get_context(), context) |
357 | except bb.BBHandledException: | 357 | except (bb.BBHandledException, bb.parse.SkipRecipe, bb.build.FuncFailed, bb.data_smart.ExpansionError): |
358 | # Error already shown so passthrough | 358 | # Error already shown so passthrough, no need for traceback |
359 | raise | ||
360 | except bb.data_smart.ExpansionError: | ||
361 | raise | 359 | raise |
362 | except Exception as e: | 360 | except Exception as e: |
363 | (t, value, tb) = sys.exc_info() | 361 | (t, value, tb) = sys.exc_info() |
364 | |||
365 | if t in [bb.parse.SkipRecipe, bb.build.FuncFailed]: | ||
366 | raise | ||
367 | try: | 362 | try: |
368 | _print_exception(t, value, tb, realfile, text, context) | 363 | _print_exception(t, value, tb, realfile, text, context) |
369 | except Exception as e: | 364 | except Exception as e: |