]> code.ossystems Code Review - openembedded-core.git/commitdiff
kernel-yocto.bbclass: fix "referenced before assignment" error
authorMax Kellermann <max.kellermann@gmail.com>
Mon, 24 Sep 2018 08:05:55 +0000 (10:05 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 27 Sep 2018 22:39:28 +0000 (23:39 +0100)
If "scc --configs" fails, do_kernel_configcheck() crashes like this:

      0338:    try:
      0339:        configs = subprocess.check_output(['scc', '--configs', '-o', s + '/.kernel-meta'], env=env).decode('utf-8')
      0340:    except subprocess.CalledProcessError:
  *** 0341:        bb.fatal( "Cannot gather config fragments for audit: %s" % configs)
      0342:
      0343:    try:
      0344:        subprocess.check_call(['kconf_check', '--report', '-o',
      0345:                '%s/%s/cfg' % (s, kmeta), d.getVar('B') + '/.config', s, configs], cwd=s, env=env)
 Exception: UnboundLocalError: local variable 'configs' referenced before assignment

This crash bug was introduced by commit
21de5cc43cfedc703e5bc0515507a6dae36afb74

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/kernel-yocto.bbclass

index 2ecd06009321195b760e0ee72b417d60dc1ba968..496c8a7f68e790a58ca6dbf468b4e9d2f721e84d 100644 (file)
@@ -337,8 +337,8 @@ python do_kernel_configcheck() {
 
     try:
         configs = subprocess.check_output(['scc', '--configs', '-o', s + '/.kernel-meta'], env=env).decode('utf-8')
-    except subprocess.CalledProcessError:
-        bb.fatal( "Cannot gather config fragments for audit: %s" % configs)
+    except subprocess.CalledProcessError as e:
+        bb.fatal( "Cannot gather config fragments for audit: %s" % e.output.decode("utf-8") )
 
     try:
         subprocess.check_call(['kconf_check', '--report', '-o',