diff options
author | Joshua Watt <jpewhacker@gmail.com> | 2018-08-24 10:59:50 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-08-28 10:30:28 +0100 |
commit | f13ff77f4d8a3bd96d27152722f15edc3657d0c9 (patch) | |
tree | 28d37ac562449cc4fdfd851602e520d6d0577f60 /meta/classes/kernel-yocto.bbclass | |
parent | 0b3dabc5aa4d3584cce7935de0820b9a4a7c1043 (diff) | |
download | poky-f13ff77f4d8a3bd96d27152722f15edc3657d0c9.tar.gz |
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>
Diffstat (limited to 'meta/classes/kernel-yocto.bbclass')
-rw-r--r-- | meta/classes/kernel-yocto.bbclass | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass index 077a1ab8ef..19d74a7875 100644 --- a/meta/classes/kernel-yocto.bbclass +++ b/meta/classes/kernel-yocto.bbclass | |||
@@ -321,7 +321,7 @@ do_kernel_configme() { | |||
321 | addtask kernel_configme before do_configure after do_patch | 321 | addtask kernel_configme before do_configure after do_patch |
322 | 322 | ||
323 | python do_kernel_configcheck() { | 323 | python do_kernel_configcheck() { |
324 | import re, string, sys | 324 | import re, string, sys, subprocess |
325 | 325 | ||
326 | # if KMETA isn't set globally by a recipe using this routine, we need to | 326 | # if KMETA isn't set globally by a recipe using this routine, we need to |
327 | # set the default to 'meta'. Otherwise, kconf_check is not passed a valid | 327 | # set the default to 'meta'. Otherwise, kconf_check is not passed a valid |
@@ -330,16 +330,26 @@ python do_kernel_configcheck() { | |||
330 | if not os.path.exists(kmeta): | 330 | if not os.path.exists(kmeta): |
331 | kmeta = "." + kmeta | 331 | kmeta = "." + kmeta |
332 | 332 | ||
333 | pathprefix = "export PATH=%s:%s; " % (d.getVar('PATH'), "${S}/scripts/util/") | 333 | s = d.getVar('S') |
334 | 334 | ||
335 | cmd = d.expand("scc --configs -o ${S}/.kernel-meta") | 335 | env = os.environ.copy() |
336 | ret, configs = oe.utils.getstatusoutput("%s%s" % (pathprefix, cmd)) | 336 | env['PATH'] = "%s:%s%s" % (d.getVar('PATH'), s, "/scripts/util/") |
337 | 337 | ||
338 | cmd = d.expand("cd ${S}; kconf_check --report -o ${S}/%s/cfg/ ${B}/.config ${S} %s" % (kmeta,configs)) | 338 | try: |
339 | ret, result = oe.utils.getstatusoutput("%s%s" % (pathprefix, cmd)) | 339 | configs = subprocess.check_output(['scc', '--configs', '-o', s + '/.kernel-meta'], env=env).decode('utf-8') |
340 | except subprocess.CalledProcessError: | ||
341 | bb.fatal( "Cannot gather config fragments for audit: %s" % configs) | ||
342 | |||
343 | try: | ||
344 | subprocess.check_call(['kconf_check', '--report', '-o', | ||
345 | '%s/%s/cfg' % (s, kmeta), d.getVar('B') + '/.config', s, configs], cwd=s, env=env) | ||
346 | except subprocess.CalledProcessError: | ||
347 | # The configuration gathering can return different exit codes, but | ||
348 | # we interpret them based on the KCONF_AUDIT_LEVEL variable, so we catch | ||
349 | # everything here, and let the run continue. | ||
350 | pass | ||
340 | 351 | ||
341 | config_check_visibility = int(d.getVar("KCONF_AUDIT_LEVEL") or 0) | 352 | config_check_visibility = int(d.getVar("KCONF_AUDIT_LEVEL") or 0) |
342 | bsp_check_visibility = int(d.getVar("KCONF_BSP_AUDIT_LEVEL") or 0) | ||
343 | 353 | ||
344 | # if config check visibility is non-zero, report dropped configuration values | 354 | # if config check visibility is non-zero, report dropped configuration values |
345 | mismatch_file = d.expand("${S}/%s/cfg/mismatch.txt" % kmeta) | 355 | mismatch_file = d.expand("${S}/%s/cfg/mismatch.txt" % kmeta) |