summaryrefslogtreecommitdiffstats
path: root/lib/bb/cooker.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-22 20:33:39 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-23 08:48:45 +0100
commit22756e9c0f1da33ba2c6e881b214577a610b7986 (patch)
treeb7f6f3ef7d92d2e4ceff0be840caf2284bd76a16 /lib/bb/cooker.py
parentb3d97130e1e70fe969399277dcd7cccd888103d6 (diff)
downloadbitbake-22756e9c0f1da33ba2c6e881b214577a610b7986.tar.gz
cooker: Ensure parsing failures stop the build
Currently parsing failures still allow bitbake to continue on and try and execute a build. This is clearly a bad idea and this patch adds in more correct error handling and stops the build. The use of sys.exit is nasty but this patches other usage in this function so is at least consisent and its better than the current situation of trying to execure a half parsed set of recipes. There are probably better ways this could be improved to use to stop the build. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/cooker.py')
-rw-r--r--lib/bb/cooker.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index a6b848ec9..cecbed9c2 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1206,9 +1206,10 @@ class BBCooker:
if not self.parser.parse_next():
collectlog.debug(1, "parsing complete")
- if not self.parser.error:
- self.show_appends_with_no_recipes()
- self.buildDepgraph()
+ if self.parser.error:
+ sys.exit(1)
+ self.show_appends_with_no_recipes()
+ self.buildDepgraph()
self.state = state.running
return None
@@ -1665,25 +1666,30 @@ class CookerParser(object):
logger.error('Unable to parse %s: %s' %
(exc.recipe, bb.exceptions.to_string(exc.realexception)))
self.shutdown(clean=False)
+ return False
except bb.parse.ParseError as exc:
self.error += 1
logger.error(str(exc))
self.shutdown(clean=False)
+ return False
except bb.data_smart.ExpansionError as exc:
self.error += 1
_, value, _ = sys.exc_info()
logger.error('ExpansionError during parsing %s: %s', value.recipe, str(exc))
self.shutdown(clean=False)
+ return False
except SyntaxError as exc:
self.error += 1
logger.error('Unable to parse %s', exc.recipe)
self.shutdown(clean=False)
+ return False
except Exception as exc:
self.error += 1
etype, value, tb = sys.exc_info()
logger.error('Unable to parse %s', value.recipe,
exc_info=(etype, value, exc.traceback))
self.shutdown(clean=False)
+ return False
self.current += 1
self.virtuals += len(result)