diff mbox series

[3/3] kernel-yocto: improve fatal error messages of symbol_why.py

Message ID 20220930175440.2168008-3-jose.quaresma@foundries.io
State Accepted, archived
Commit 54ae08779071f2e97bff0ff6514ede3124312c3b
Headers show
Series [1/3] go: drop patch to make content based hash generation less pedan | expand

Commit Message

Jose Quaresma Sept. 30, 2022, 5:54 p.m. UTC
Improve the fatal error message of the yocto-kernel-tools symbol_why.py
and shows the command that generate the error as it can help understand
the root cause of the error.

Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
---
 meta/classes-recipe/kernel-yocto.bbclass | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Ross Burton Oct. 6, 2022, 10:51 a.m. UTC | #1
> On 30 Sep 2022, at 18:54, Jose Quaresma via lists.openembedded.org <quaresma.jose=gmail.com@lists.openembedded.org> wrote:
> -        bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
> +        bb.fatal( "config analysis failed when running '%s': %s" % (" ".join(cmd), e.output.decode('utf-8')))

Much easier to just use e.cmd.

https://docs.python.org/3/library/subprocess.html#subprocess.CalledProcessError

Ross
Jose Quaresma Oct. 7, 2022, 9:02 a.m. UTC | #2
Ross Burton <Ross.Burton@arm.com> escreveu no dia quinta, 6/10/2022 à(s)
11:51:

>
>
> > On 30 Sep 2022, at 18:54, Jose Quaresma via lists.openembedded.org
> <quaresma.jose=gmail.com@lists.openembedded.org> wrote:
> > -        bb.fatal( "config analysis failed: %s" %
> e.output.decode('utf-8'))
> > +        bb.fatal( "config analysis failed when running '%s': %s" % ("
> ".join(cmd), e.output.decode('utf-8')))
>
> Much easier to just use e.cmd.
>

It's really much simpler. thank you, I will send a v2

Jose


>
>
> https://docs.python.org/3/library/subprocess.html#subprocess.CalledProcessError
>
> Ross
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
index 8eda0dcaf3..46df9b23dc 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -573,9 +573,10 @@  python do_kernel_configcheck() {
 
     # category #1: mismatches
     try:
-        analysis = subprocess.check_output(['symbol_why.py', '--dotconfig',  '{}'.format( d.getVar('B') + '/.config' ), '--mismatches', extra_params], cwd=s, env=env ).decode('utf-8')
+        cmd = ['symbol_why.py', '--dotconfig',  '{}'.format( d.getVar('B') + '/.config' ), '--mismatches', extra_params]
+        analysis = subprocess.check_output(cmd, cwd=s, env=env ).decode('utf-8')
     except subprocess.CalledProcessError as e:
-        bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
+        bb.fatal( "config analysis failed when running '%s': %s" % (" ".join(cmd), e.output.decode('utf-8')))
 
     if analysis:
         outfile = "{}/{}/cfg/mismatch.txt".format( s, kmeta )
@@ -595,9 +596,10 @@  python do_kernel_configcheck() {
     if bsp_check_visibility > 1:
         extra_params = "--strict"
     try:
-        analysis = subprocess.check_output(['symbol_why.py', '--dotconfig',  '{}'.format( d.getVar('B') + '/.config' ), '--invalid', extra_params], cwd=s, env=env ).decode('utf-8')
+        cmd = ['symbol_why.py', '--dotconfig',  '{}'.format( d.getVar('B') + '/.config' ), '--invalid', extra_params]
+        analysis = subprocess.check_output(cmd, cwd=s, env=env ).decode('utf-8')
     except subprocess.CalledProcessError as e:
-        bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
+        bb.fatal( "config analysis failed when running '%s': %s" % (" ".join(cmd), e.output.decode('utf-8')))
 
     if analysis:
         outfile = "{}/{}/cfg/invalid.txt".format(s,kmeta)
@@ -614,9 +616,10 @@  python do_kernel_configcheck() {
 
     # category #3: redefined options (this is pretty verbose and is debug only)
     try:
-        analysis = subprocess.check_output(['symbol_why.py', '--dotconfig',  '{}'.format( d.getVar('B') + '/.config' ), '--sanity'], cwd=s, env=env ).decode('utf-8')
+        cmd = ['symbol_why.py', '--dotconfig',  '{}'.format( d.getVar('B') + '/.config' ), '--sanity']
+        analysis = subprocess.check_output(cmd, cwd=s, env=env ).decode('utf-8')
     except subprocess.CalledProcessError as e:
-        bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8'))
+        bb.fatal( "config analysis failed when running '%s': %s" % (" ".join(cmd), e.output.decode('utf-8')))
 
     if analysis:
         outfile = "{}/{}/cfg/redefinition.txt".format(s,kmeta)