kernel-yocto: configcheck: create cfg folder if it doesn't exist
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 kernel-yocto: configcheck: create cfg folder if it doesn't exist
In some situations, the cfg folder doesn't exist when a config check returns data, which results in a python exception:
File: '/.../meta/classes/kernel-yocto.bbclass', lineno: 590, function: do_kernel_configcheck
0586: if analysis:
0587: outfile = "{}/{}/cfg/invalid.txt".format(s,kmeta)
0588: if os.path.isfile(outfile):
0589: os.remove(outfile) *** 0590: with open(outfile, 'w+') as f:
0591: f.write( analysis )
0592:
0593: if bsp_check_visibility and os.stat(outfile).st_size > 0:
0594: with open (outfile, "r") as myfile:
Exception: FileNotFoundError: [Errno 2] No such file or directory:
'/.../openbmc-openbmc/build/tmp/work-shared/.../kernel-source/.kernel-meta/cfg/invalid.txt'
This adds a check to create the cfg folder if it doesn't exist to avoid the python exception.
I have only seen this error with invalid.txt, but it looks like mismatch.txt and redefinition.txt could hit the same issue, so adding the fix for those, too.
--- meta/classes/kernel-yocto.bbclass | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
meta/classes/kernel-yocto.bbclass +12 -3
@@ -562,7 +562,10 @@ python do_kernel_configcheck() { bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8')) if analysis: - outfile = "{}/{}/cfg/mismatch.txt".format( s, kmeta ) + outpath = "{}/{}/cfg".format( s, kmeta ) + if not os.path.exists(outpath): + os.makedirs(outpath) + outfile = "{}/mismatch.txt".format(outpath) if os.path.isfile(outfile): os.remove(outfile) with open(outfile, 'w+') as f:
@@ -584,7 +587,10 @@ python do_kernel_configcheck() { bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8')) if analysis: - outfile = "{}/{}/cfg/invalid.txt".format(s,kmeta) + outpath = "{}/{}/cfg".format(s,kmeta) + if not os.path.exists(outpath): + os.makedirs(outpath) + outfile = "{}/invalid.txt".format(outpath) if os.path.isfile(outfile): os.remove(outfile) with open(outfile, 'w+') as f:
@@ -603,7 +609,10 @@ python do_kernel_configcheck() { bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8')) if analysis: - outfile = "{}/{}/cfg/redefinition.txt".format(s,kmeta) + outpath = "{}/{}/cfg".format(s,kmeta) + if not os.path.exists(outpath): + os.makedirs(outpath) + outfile = "{}/redefinition.txt".format(outpath) if os.path.isfile(outfile): os.remove(outfile) with open(outfile, 'w+') as f:
Signature · 1 line
2.17.1