All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] patch.bbclass: check if patchdir exist
@ 2021-08-19  8:29 Jose Quaresma
  2021-08-19  9:53 ` [OE-core] " Quentin Schulz
  0 siblings, 1 reply; 3+ messages in thread
From: Jose Quaresma @ 2021-08-19  8:29 UTC (permalink / raw)
  To: openembedded-core; +Cc: Jose Quaresma

if the user specifies path on 'patchdir' that don't exist,
the patch will fail and there are no message that indicates the real cause.

Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
---
 meta/classes/patch.bbclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 559c6f45bd..1e9a024bf9 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -131,6 +131,8 @@ python patch_do_patch() {
             patchdir = parm["patchdir"]
             if not os.path.isabs(patchdir):
                 patchdir = os.path.join(s, patchdir)
+            if not os.path.isdir(patchdir):
+                bb.fatal("Patch source directory don't found '%s'" % patchdir)
         else:
             patchdir = s
 
-- 
2.33.0


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

* Re: [OE-core] [PATCH v3] patch.bbclass: check if patchdir exist
  2021-08-19  8:29 [PATCH v3] patch.bbclass: check if patchdir exist Jose Quaresma
@ 2021-08-19  9:53 ` Quentin Schulz
  2021-08-20  8:29   ` Jose Quaresma
  0 siblings, 1 reply; 3+ messages in thread
From: Quentin Schulz @ 2021-08-19  9:53 UTC (permalink / raw)
  To: openembedded-core, Jose Quaresma

Hi Jose,

On August 19, 2021 10:29:34 AM GMT+02:00, Jose Quaresma <quaresma.jose@gmail.com> wrote:
>if the user specifies path on 'patchdir' that don't exist,
>the patch will fail and there are no message that indicates the real cause.
>
>Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
>---
> meta/classes/patch.bbclass | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
>index 559c6f45bd..1e9a024bf9 100644
>--- a/meta/classes/patch.bbclass
>+++ b/meta/classes/patch.bbclass
>@@ -131,6 +131,8 @@ python patch_do_patch() {
>             patchdir = parm["patchdir"]
>             if not os.path.isabs(patchdir):
>                 patchdir = os.path.join(s, patchdir)
>+            if not os.path.isdir(patchdir):
>+                bb.fatal("Patch source directory don't found '%s'" % patchdir)

In your text, it should be "not" and not "don't".

I could suggest also:

patchdir '%s' not found

Or explicit in the message that "Patch source directory" not found means "patchdir" is incorrect somewhere in SRC_URI.

I think you could even tell which patch file has its patchdir incorrect by printing the "local" variable. Not sure it brings anything, just thinking out loud 😁

Anyway, I like this patch, but it does not have the same purpose as the earlier version of this patch series. I think it is also important to print the patchdir when the patch tool fails to apply the patch. It might be because the path exists but is incorrect.

So it'd be awesome if we can get the patchdir in the fatal message when the patch fails to apply. My understanding of patch.bbclass and lib/oe/patch.py is that resolver.Resolve() is doing the patching so in that except thr patchdir could be printed.

Many thanks!
Quentin

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

* Re: [OE-core] [PATCH v3] patch.bbclass: check if patchdir exist
  2021-08-19  9:53 ` [OE-core] " Quentin Schulz
@ 2021-08-20  8:29   ` Jose Quaresma
  0 siblings, 0 replies; 3+ messages in thread
From: Jose Quaresma @ 2021-08-20  8:29 UTC (permalink / raw)
  To: Quentin Schulz; +Cc: OE-core

Hi Quentin,

Quentin Schulz <foss@0leil.net> escreveu no dia quinta, 19/08/2021 à(s) 10:53:
>
> Hi Jose,
>
> On August 19, 2021 10:29:34 AM GMT+02:00, Jose Quaresma <quaresma.jose@gmail.com> wrote:
> >if the user specifies path on 'patchdir' that don't exist,
> >the patch will fail and there are no message that indicates the real cause.
> >
> >Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
> >---
> > meta/classes/patch.bbclass | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> >diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
> >index 559c6f45bd..1e9a024bf9 100644
> >--- a/meta/classes/patch.bbclass
> >+++ b/meta/classes/patch.bbclass
> >@@ -131,6 +131,8 @@ python patch_do_patch() {
> >             patchdir = parm["patchdir"]
> >             if not os.path.isabs(patchdir):
> >                 patchdir = os.path.join(s, patchdir)
> >+            if not os.path.isdir(patchdir):
> >+                bb.fatal("Patch source directory don't found '%s'" % patchdir)
>
> In your text, it should be "not" and not "don't".
>
> I could suggest also:
>
> patchdir '%s' not found
>
> Or explicit in the message that "Patch source directory" not found means "patchdir" is incorrect somewhere in SRC_URI.
>
> I think you could even tell which patch file has its patchdir incorrect by printing the "local" variable. Not sure it brings anything, just thinking out loud 😁
>
> Anyway, I like this patch, but it does not have the same purpose as the earlier version of this patch series. I think it is also important to print the patchdir when the patch tool fails to apply the patch. It might be because the path exists but is incorrect.
>
> So it'd be awesome if we can get the patchdir in the fatal message when the patch fails to apply. My understanding of patch.bbclass and lib/oe/patch.py is that resolver.Resolve() is doing the patching so in that except thr patchdir could be printed.

This is the right way to go.
I will address your comments in the next version, it will come in September.

>
> Many thanks!
> Quentin



-- 
Best regards,

José Quaresma

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

end of thread, other threads:[~2021-08-20  8:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19  8:29 [PATCH v3] patch.bbclass: check if patchdir exist Jose Quaresma
2021-08-19  9:53 ` [OE-core] " Quentin Schulz
2021-08-20  8:29   ` 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.