From: <mingli.yu@eng.windriver.com>
To: <bitbake-devel@lists.openembedded.org>,
<richard.purdie@linuxfoundation.org>,
<frederic.martinsons@gmail.com>
Subject: [PATCH v2] event: add bb.event.ParseError
Date: Wed, 12 Apr 2023 15:32:42 +0800 [thread overview]
Message-ID: <20230412073242.3735050-1-mingli.yu@eng.windriver.com> (raw)
From: Mingli Yu <mingli.yu@windriver.com>
Add bb.event.ParseError to let error-report can catch this kind of error.
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
lib/bb/cooker.py | 5 +++--
lib/bb/event.py | 8 ++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 1797a1d4..c8ff3ce0 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -2223,7 +2223,7 @@ class CookerParser(object):
self.results = itertools.chain(self.results, self.parse_generator())
- def shutdown(self, clean=True):
+ def shutdown(self, clean=True, eventmsg="Parsing halted due to errors"):
if not self.toparse:
return
if self.haveshutdown:
@@ -2238,6 +2238,7 @@ class CookerParser(object):
bb.event.fire(event, self.cfgdata)
else:
+ bb.event.fire(bb.event.ParseError(eventmsg), self.cfgdata)
bb.error("Parsing halted due to errors, see error messages above")
# Cleanup the queue before call process.join(), otherwise there might be
@@ -2355,7 +2356,7 @@ class CookerParser(object):
except bb.parse.ParseError as exc:
self.error += 1
logger.error(str(exc))
- self.shutdown(clean=False)
+ self.shutdown(clean=False, eventmsg=str(exc))
return False
except bb.data_smart.ExpansionError as exc:
self.error += 1
diff --git a/lib/bb/event.py b/lib/bb/event.py
index 37cc630c..0d0e0a68 100644
--- a/lib/bb/event.py
+++ b/lib/bb/event.py
@@ -856,3 +856,11 @@ class FindSigInfoResult(Event):
def __init__(self, result):
Event.__init__(self)
self.result = result
+
+class ParseError(Event):
+ """
+ Event to indicate parse failed
+ """
+ def __init__(self, msg):
+ super().__init__()
+ self._msg = msg
--
2.25.1
reply other threads:[~2023-04-12 7:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230412073242.3735050-1-mingli.yu@eng.windriver.com \
--to=mingli.yu@eng.windriver.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=frederic.martinsons@gmail.com \
--cc=richard.purdie@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).