classes/kernel-yocto: Cleanup getstatusoutput usage

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.

(From OE-Core rev: 21de5cc43cfedc703e5bc0515507a6dae36afb74)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Watt
2018-08-24 10:59:50 -04:00
committed by Richard Purdie
parent 0b3dabc5aa
commit f13ff77f4d
2 changed files with 18 additions and 8 deletions

View File

@@ -321,7 +321,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
@@ -330,16 +330,26 @@ 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:
bb.fatal( "Cannot gather config fragments for audit: %s" % configs)
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:
# The configuration gathering can return different exit codes, but
# we interpret them based on the KCONF_AUDIT_LEVEL variable, so we catch
# everything here, and let the run continue.
pass
config_check_visibility = int(d.getVar("KCONF_AUDIT_LEVEL") or 0)
bsp_check_visibility = int(d.getVar("KCONF_BSP_AUDIT_LEVEL") or 0)
# if config check visibility is non-zero, report dropped configuration values
mismatch_file = d.expand("${S}/%s/cfg/mismatch.txt" % kmeta)

View File

@@ -4,7 +4,7 @@ LIC_FILES_CHKSUM = "file://git/tools/kgit;beginline=5;endline=9;md5=a6c2fa8aef1b
DEPENDS = "git-native"
SRCREV = "8cd13500a27c0a6a911cc83c0349dec01ef66e27"
SRCREV = "602237a57487e969016db3085d181b585f5a74a7"
PR = "r12"
PV = "0.2+git${SRCPV}"