public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: "Yu, Mingli" <mingli.yu@eng.windriver.com>
Cc: <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH] report-error: make it catch ParseError error
Date: Fri, 14 Apr 2023 11:31:29 +0200	[thread overview]
Message-ID: <20230414113129.12a7b652@booty> (raw)
In-Reply-To: <20230414020838.2696639-1-mingli.yu@eng.windriver.com>

Hi Mingli,

I'm taking this patch for AB testing, however I have a couple remarks
that might turn into a new version of your patch or in a follow-up
cleanup patch, see below.

On Fri, 14 Apr 2023 10:08:38 +0800
"Yu, Mingli" <mingli.yu@eng.windriver.com> wrote:

> From: Mingli Yu <mingli.yu@windriver.com>
> 
> Make the report-error catch ParseError error as below and then
> we can check it directly via error report web.
> 
> ParseError at /build/layers/oe-core/meta/recipes-support/curl/curl_7.88.1.bb:32: unparsed line: 'PACKAGECONFIG[ares] = "--enable-ares,--disable-ares,c-ares,,,threaded-resolver'
> 
> Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
> ---
>  meta/classes/report-error.bbclass | 26 +++++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
> index 2b2ad56514..041db44941 100644
> --- a/meta/classes/report-error.bbclass
> +++ b/meta/classes/report-error.bbclass
> @@ -132,6 +132,30 @@ python errorreport_handler () {
>              errorreport_savedata(e, data, "error-report.txt")
>              bb.utils.unlockfile(lock)
>  
> +        elif isinstance(e, bb.event.ParseError):
> +            bb.utils.mkdirhier(logpath)
> +            data = {}
> +            machine = e.data.getVar("MACHINE")
> +            data['machine'] = machine

These two lines could become one line, removing the 'machine' variable:

  data['machine'] = e.data.getVar("MACHINE")

I see you used the same pattern as other if/elif branches in the
surrounding code, so they could also be simplified.

> +            data['build_sys'] = e.data.getVar("BUILD_SYS")
> +            data['nativelsb'] = nativelsb()
> +            data['distro'] = e.data.getVar("DISTRO")
> +            data['target_sys'] = e.data.getVar("TARGET_SYS")
> +            data['failures'] = []
> +            data['component'] = "parse"
> +            data['branch_commit'] = str(oe.buildcfg.detect_branch(e.data)) + ": " + str(oe.buildcfg.detect_revision(e.data))
> +            data['bitbake_version'] = e.data.getVar("BB_VERSION")
> +            data['layer_version'] = get_layers_branch_rev(e.data)
> +            data['local_conf'] = get_conf_data(e, 'local.conf')
> +            data['auto_conf'] = get_conf_data(e, 'auto.conf')
> +            taskdata={}
> +            taskdata['log'] = str(e._msg)
> +            taskdata['task'] = str(e._msg)
> +            data['failures'].append(taskdata)
> +            lock = bb.utils.lockfile(datafile + '.lock')
> +            errorreport_savedata(e, data, "error-report.txt")
> +            bb.utils.unlockfile(lock)

Most of this code is already duplicated in two branches already, and
with your patch there will be three copies. Can the common lines be
moved to a helper function?

Best regards,
Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  reply	other threads:[~2023-04-14  9:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-14  2:08 [PATCH] report-error: make it catch ParseError error mingli.yu
2023-04-14  9:31 ` Luca Ceresoli [this message]
2023-04-19  5:30   ` [PATCH v2] " mingli.yu

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=20230414113129.12a7b652@booty \
    --to=luca.ceresoli@bootlin.com \
    --cc=mingli.yu@eng.windriver.com \
    --cc=openembedded-core@lists.openembedded.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