summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorMingli Yu <mingli.yu@windriver.com>2023-04-12 15:32:42 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-04-13 12:01:45 +0100
commit066f44b1617f3d25d66d41340205b3b585086eaa (patch)
tree2628908254a2c5382e749d5e7fe1d09e4f096a38 /bitbake/lib
parent00d9f298b0dc4c80c24435f7c41b3e93805dcd65 (diff)
downloadpoky-066f44b1617f3d25d66d41340205b3b585086eaa.tar.gz
bitbake: event: add bb.event.ParseError
Add bb.event.ParseError to let error-report can catch this kind of error. (Bitbake rev: 316524ab59a5e738c25e062923ee5717d88ae5c7) Signed-off-by: Mingli Yu <mingli.yu@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/cooker.py5
-rw-r--r--bitbake/lib/bb/event.py8
2 files changed, 11 insertions, 2 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 1797a1d4ca..c8ff3ce085 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -2223,7 +2223,7 @@ class CookerParser(object):
2223 2223
2224 self.results = itertools.chain(self.results, self.parse_generator()) 2224 self.results = itertools.chain(self.results, self.parse_generator())
2225 2225
2226 def shutdown(self, clean=True): 2226 def shutdown(self, clean=True, eventmsg="Parsing halted due to errors"):
2227 if not self.toparse: 2227 if not self.toparse:
2228 return 2228 return
2229 if self.haveshutdown: 2229 if self.haveshutdown:
@@ -2238,6 +2238,7 @@ class CookerParser(object):
2238 2238
2239 bb.event.fire(event, self.cfgdata) 2239 bb.event.fire(event, self.cfgdata)
2240 else: 2240 else:
2241 bb.event.fire(bb.event.ParseError(eventmsg), self.cfgdata)
2241 bb.error("Parsing halted due to errors, see error messages above") 2242 bb.error("Parsing halted due to errors, see error messages above")
2242 2243
2243 # Cleanup the queue before call process.join(), otherwise there might be 2244 # Cleanup the queue before call process.join(), otherwise there might be
@@ -2355,7 +2356,7 @@ class CookerParser(object):
2355 except bb.parse.ParseError as exc: 2356 except bb.parse.ParseError as exc:
2356 self.error += 1 2357 self.error += 1
2357 logger.error(str(exc)) 2358 logger.error(str(exc))
2358 self.shutdown(clean=False) 2359 self.shutdown(clean=False, eventmsg=str(exc))
2359 return False 2360 return False
2360 except bb.data_smart.ExpansionError as exc: 2361 except bb.data_smart.ExpansionError as exc:
2361 self.error += 1 2362 self.error += 1
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 37cc630c63..0d0e0a68aa 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -856,3 +856,11 @@ class FindSigInfoResult(Event):
856 def __init__(self, result): 856 def __init__(self, result):
857 Event.__init__(self) 857 Event.__init__(self)
858 self.result = result 858 self.result = result
859
860class ParseError(Event):
861 """
862 Event to indicate parse failed
863 """
864 def __init__(self, msg):
865 super().__init__()
866 self._msg = msg