All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] patch.bbclass: don't repr() the exception, use str()
@ 2021-11-02 12:26 Ross Burton
  2021-11-02 12:36 ` [OE-core] " Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Ross Burton @ 2021-11-02 12:26 UTC (permalink / raw)
  To: openembedded-core

repr() results in formatting characters such as extra quotation marks
which are pointless.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes/patch.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 8de7025491..079ee33e3c 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -155,7 +155,7 @@ python patch_do_patch() {
             resolver.Resolve()
         except bb.BBHandledException as e:
             bb.utils.remove(process_tmpdir, True)
-            bb.fatal("Applying patch '%s' on target directory '%s'\n%s" % (parm['patchname'], patchdir, repr(e).replace("\\n", "\n")))
+            bb.fatal("Applying patch '%s' on target directory '%s'\n%s" % (parm['patchname'], patchdir, str(e).replace("\\n", "\n")))
 
     bb.utils.remove(process_tmpdir, True)
     del os.environ['TMPDIR']
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] patch.bbclass: don't repr() the exception, use str()
  2021-11-02 12:26 [PATCH] patch.bbclass: don't repr() the exception, use str() Ross Burton
@ 2021-11-02 12:36 ` Richard Purdie
  2021-11-04 20:04   ` Jose Quaresma
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2021-11-02 12:36 UTC (permalink / raw)
  To: Ross Burton, openembedded-core

On Tue, 2021-11-02 at 12:26 +0000, Ross Burton wrote:
> repr() results in formatting characters such as extra quotation marks
> which are pointless.
> 
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
>  meta/classes/patch.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
> index 8de7025491..079ee33e3c 100644
> --- a/meta/classes/patch.bbclass
> +++ b/meta/classes/patch.bbclass
> @@ -155,7 +155,7 @@ python patch_do_patch() {
>              resolver.Resolve()
>          except bb.BBHandledException as e:
>              bb.utils.remove(process_tmpdir, True)
> -            bb.fatal("Applying patch '%s' on target directory '%s'\n%s" % (parm['patchname'], patchdir, repr(e).replace("\\n", "\n")))
> +            bb.fatal("Applying patch '%s' on target directory '%s'\n%s" % (parm['patchname'], patchdir, str(e).replace("\\n", "\n")))
>  
>      bb.utils.remove(process_tmpdir, True)
>      del os.environ['TMPDIR']

Full circle:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=ec6edfc27f2cfa990dd0f8b2bbc6f9472a50a839

:(

(the original issue being that str(e) on exceptions can hide a lot of useful
info)

Cheers,

Richard



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] patch.bbclass: don't repr() the exception, use str()
  2021-11-02 12:36 ` [OE-core] " Richard Purdie
@ 2021-11-04 20:04   ` Jose Quaresma
  0 siblings, 0 replies; 3+ messages in thread
From: Jose Quaresma @ 2021-11-04 20:04 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Ross Burton, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 2071 bytes --]

Richard Purdie <richard.purdie@linuxfoundation.org> escreveu no dia terça,
2/11/2021 à(s) 12:36:

> On Tue, 2021-11-02 at 12:26 +0000, Ross Burton wrote:
> > repr() results in formatting characters such as extra quotation marks
> > which are pointless.
> >
> > Signed-off-by: Ross Burton <ross.burton@arm.com>
> > ---
> >  meta/classes/patch.bbclass | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
> > index 8de7025491..079ee33e3c 100644
> > --- a/meta/classes/patch.bbclass
> > +++ b/meta/classes/patch.bbclass
> > @@ -155,7 +155,7 @@ python patch_do_patch() {
> >              resolver.Resolve()
> >          except bb.BBHandledException as e:
> >              bb.utils.remove(process_tmpdir, True)
> > -            bb.fatal("Applying patch '%s' on target directory '%s'\n%s"
> % (parm['patchname'], patchdir, repr(e).replace("\\n", "\n")))
>

Replace the "str(e)" with "repr(e).replace("\\n", "\n")" is a bit ugly, can
this be moved to bb.utils or something like that?

> +            bb.fatal("Applying patch '%s' on target directory '%s'\n%s"
> % (parm['patchname'], patchdir, str(e).replace("\\n", "\n")))
> >
> >      bb.utils.remove(process_tmpdir, True)
> >      del os.environ['TMPDIR']
>
> Full circle:
>
>
> http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=ec6edfc27f2cfa990dd0f8b2bbc6f9472a50a839
>
> :(
>
> (the original issue being that str(e) on exceptions can hide a lot of
> useful
> info)
>
> Cheers,
>
> Richard
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#157776):
> https://lists.openembedded.org/g/openembedded-core/message/157776
> Mute This Topic: https://lists.openembedded.org/mt/86764324/5052612
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> quaresma.jose@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

-- 
Best regards,

José Quaresma

[-- Attachment #2: Type: text/html, Size: 3668 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-04 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 12:26 [PATCH] patch.bbclass: don't repr() the exception, use str() Ross Burton
2021-11-02 12:36 ` [OE-core] " Richard Purdie
2021-11-04 20:04   ` Jose Quaresma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.