bitbake-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: "Yu, Mingli" <mingli.yu@windriver.com>,
	"Yu, Mingli" <mingli.yu@eng.windriver.com>,
	bitbake-devel@lists.openembedded.org
Subject: Re: [bitbake-devel] [PATCH] event: add bb.event.ParseError
Date: Wed, 12 Apr 2023 07:58:43 +0100	[thread overview]
Message-ID: <58f0488487ba8c85b28472ed28895bb4c3404317.camel@linuxfoundation.org> (raw)
In-Reply-To: <08ac7a35-db3d-430f-5d10-f96a90862f1e@windriver.com>

On Wed, 2023-04-12 at 10:42 +0800, Yu, Mingli wrote:
> Hi Richard,
> 
> On 4/12/23 00:50, Richard Purdie wrote:
> > CAUTION: This email comes from a non Wind River email account!
> > Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > 
> > On Mon, 2023-04-10 at 17:19 +0800, Yu, Mingli wrote:
> > > 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 | 6 ++++--
> > >   lib/bb/event.py  | 8 ++++++++
> > >   2 files changed, 12 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
> > > index 1797a1d4..206f8ffb 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=""):
> > >           if not self.toparse:
> > >               return
> > >           if self.haveshutdown:
> > > @@ -2238,6 +2238,8 @@ class CookerParser(object):
> > > 
> > >               bb.event.fire(event, self.cfgdata)
> > >           else:
> > > +            if eventmsg:
> > > +                bb.event.fire(bb.event.ParseError(eventmsg), self.cfgdata)
> > >               bb.error("Parsing halted due to errors, see error messages above")
> > 
> > Shouldn't this always fire the event even if there is no specific error
> > message?
> 
> There are many kinds of exception here and each exception will call 
> shudown function, but we only catch bb.parse.ParseError exception and 
> pass eventmsg to shudown function when it is bb.parse.ParseError. So 
> checking eventmsg in shutdown function should be okay.
> 
> except bb.parse.ParseError as exc:
>              self.error += 1
>              logger.error(str(exc))
>              self.shutdown(clean=False, eventmsg=str(exc))
>              return False

I don't mean to call it totally unconditionally, only in the same cases
as we show the bb.error()

Cheers,

Richard


      reply	other threads:[~2023-04-12  6:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-10  9:19 [PATCH] event: add bb.event.ParseError mingli.yu
2023-04-10  9:43 ` [bitbake-devel] " Frédéric Martinsons
2023-04-11 16:50 ` Richard Purdie
2023-04-12  2:42   ` Yu, Mingli
2023-04-12  6:58     ` Richard Purdie [this message]

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=58f0488487ba8c85b28472ed28895bb4c3404317.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=mingli.yu@eng.windriver.com \
    --cc=mingli.yu@windriver.com \
    /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).