[OE-core] [PATCH] classes/kernel-yocto: Cleanup getstatusoutput usage
Joshua Watt
jpewhacker at gmail.com
Wed Jul 25 18:35:29 UTC 2018
Replace usage of os.utils.getstatusoutput() with direct subprocess
calls. Pass a modified environment and working directory where necessary
to bypass the need to execute in a shell.
Signed-off-by: Joshua Watt <JPEWhacker at gmail.com>
---
meta/classes/kernel-yocto.bbclass | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 82d80741a95..3a7717282f3 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -319,7 +319,7 @@ do_kernel_configme() {
addtask kernel_configme before do_configure after do_patch
python do_kernel_configcheck() {
- import re, string, sys
+ import re, string, sys, subprocess
# if KMETA isn't set globally by a recipe using this routine, we need to
# set the default to 'meta'. Otherwise, kconf_check is not passed a valid
@@ -328,13 +328,23 @@ python do_kernel_configcheck() {
if not os.path.exists(kmeta):
kmeta = "." + kmeta
- pathprefix = "export PATH=%s:%s; " % (d.getVar('PATH'), "${S}/scripts/util/")
+ s = d.getVar('S')
- cmd = d.expand("scc --configs -o ${S}/.kernel-meta")
- ret, configs = oe.utils.getstatusoutput("%s%s" % (pathprefix, cmd))
+ env = os.environ.copy()
+ env['PATH'] = "%s:%s%s" % (d.getVar('PATH'), s, "/scripts/util/")
- cmd = d.expand("cd ${S}; kconf_check --report -o ${S}/%s/cfg/ ${B}/.config ${S} %s" % (kmeta,configs))
- ret, result = oe.utils.getstatusoutput("%s%s" % (pathprefix, cmd))
+ try:
+ configs = subprocess.check_output(['scc', '--configs', '-o', s + '/.kernel-meta'], env=env).decode('utf-8')
+ except subprocess.CalledProcessError:
+ # Is this really non-fatal?
+ pass
+
+ try:
+ subprocess.check_call(['kconf_check', '--report', '-o',
+ '%s/%s/cfg' % (s, kmeta), d.getVar('B') + '/.config', s, configs], cwd=s, env=env)
+ except subprocess.CalledProcessError:
+ # Is this really non-fatal?
+ pass
config_check_visibility = int(d.getVar("KCONF_AUDIT_LEVEL") or 0)
bsp_check_visibility = int(d.getVar("KCONF_BSP_AUDIT_LEVEL") or 0)
--
2.17.1
More information about the Openembedded-core
mailing list