summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
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 09:22:43 +0100
commit4f3d48653aecd0bcb5cf3db2bdd7770235947206 (patch)
treeb0968f93344d5414b29ad997eab9dad8156c979c /bitbake/lib
parent999ee044b92ea08ee86460b7c1a217ad26e0af2b (diff)
downloadpoky-4f3d48653aecd0bcb5cf3db2bdd7770235947206.tar.gz
bitbake: 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. (Bitbake rev: 22756e9c0f1da33ba2c6e881b214577a610b7986) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/cooker.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index a6b848ec9d..cecbed9c21 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1206,9 +1206,10 @@ class BBCooker:
1206 1206
1207 if not self.parser.parse_next(): 1207 if not self.parser.parse_next():
1208 collectlog.debug(1, "parsing complete") 1208 collectlog.debug(1, "parsing complete")
1209 if not self.parser.error: 1209 if self.parser.error:
1210 self.show_appends_with_no_recipes() 1210 sys.exit(1)
1211 self.buildDepgraph() 1211 self.show_appends_with_no_recipes()
1212 self.buildDepgraph()
1212 self.state = state.running 1213 self.state = state.running
1213 return None 1214 return None
1214 1215
@@ -1665,25 +1666,30 @@ class CookerParser(object):
1665 logger.error('Unable to parse %s: %s' % 1666 logger.error('Unable to parse %s: %s' %
1666 (exc.recipe, bb.exceptions.to_string(exc.realexception))) 1667 (exc.recipe, bb.exceptions.to_string(exc.realexception)))
1667 self.shutdown(clean=False) 1668 self.shutdown(clean=False)
1669 return False
1668 except bb.parse.ParseError as exc: 1670 except bb.parse.ParseError as exc:
1669 self.error += 1 1671 self.error += 1
1670 logger.error(str(exc)) 1672 logger.error(str(exc))
1671 self.shutdown(clean=False) 1673 self.shutdown(clean=False)
1674 return False
1672 except bb.data_smart.ExpansionError as exc: 1675 except bb.data_smart.ExpansionError as exc:
1673 self.error += 1 1676 self.error += 1
1674 _, value, _ = sys.exc_info() 1677 _, value, _ = sys.exc_info()
1675 logger.error('ExpansionError during parsing %s: %s', value.recipe, str(exc)) 1678 logger.error('ExpansionError during parsing %s: %s', value.recipe, str(exc))
1676 self.shutdown(clean=False) 1679 self.shutdown(clean=False)
1680 return False
1677 except SyntaxError as exc: 1681 except SyntaxError as exc:
1678 self.error += 1 1682 self.error += 1
1679 logger.error('Unable to parse %s', exc.recipe) 1683 logger.error('Unable to parse %s', exc.recipe)
1680 self.shutdown(clean=False) 1684 self.shutdown(clean=False)
1685 return False
1681 except Exception as exc: 1686 except Exception as exc:
1682 self.error += 1 1687 self.error += 1
1683 etype, value, tb = sys.exc_info() 1688 etype, value, tb = sys.exc_info()
1684 logger.error('Unable to parse %s', value.recipe, 1689 logger.error('Unable to parse %s', value.recipe,
1685 exc_info=(etype, value, exc.traceback)) 1690 exc_info=(etype, value, exc.traceback))
1686 self.shutdown(clean=False) 1691 self.shutdown(clean=False)
1692 return False
1687 1693
1688 self.current += 1 1694 self.current += 1
1689 self.virtuals += len(result) 1695 self.virtuals += len(result)