mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
sanity/patch.py: Remove commands module usage
The commands module is removed in python3. Use the subprocess module instead and the pipes module to replace the mkargs usage. (From OE-Core rev: e2e1dcd74bc45381baccf507c0309dd792229afe) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -254,7 +254,7 @@ do_kernel_configme() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
python do_kernel_configcheck() {
|
python do_kernel_configcheck() {
|
||||||
import re, string, sys, commands
|
import re, string, sys, subprocess
|
||||||
|
|
||||||
bb.plain("NOTE: validating kernel config, see log.do_kernel_configcheck for details")
|
bb.plain("NOTE: validating kernel config, see log.do_kernel_configcheck for details")
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ python do_kernel_configcheck() {
|
|||||||
|
|
||||||
pathprefix = "export PATH=%s:%s; " % (d.getVar('PATH', True), "${S}/scripts/util/")
|
pathprefix = "export PATH=%s:%s; " % (d.getVar('PATH', True), "${S}/scripts/util/")
|
||||||
cmd = d.expand("cd ${S}; kconf_check -config- %s/meta-series ${S} ${B}" % kmeta)
|
cmd = d.expand("cd ${S}; kconf_check -config- %s/meta-series ${S} ${B}" % kmeta)
|
||||||
ret, result = commands.getstatusoutput("%s%s" % (pathprefix, cmd))
|
ret, result = subprocess.getstatusoutput("%s%s" % (pathprefix, cmd))
|
||||||
|
|
||||||
config_check_visibility = d.getVar( "KCONF_AUDIT_LEVEL", True ) or 1
|
config_check_visibility = d.getVar( "KCONF_AUDIT_LEVEL", True ) or 1
|
||||||
if config_check_visibility == 1:
|
if config_check_visibility == 1:
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ def splitdebuginfo(file, debugfile, debugsrcdir, d):
|
|||||||
#
|
#
|
||||||
# sourcefile is also generated containing a list of debugsources
|
# sourcefile is also generated containing a list of debugsources
|
||||||
|
|
||||||
import commands, stat, subprocess
|
import stat, subprocess
|
||||||
|
|
||||||
dvar = d.getVar('PKGD', True)
|
dvar = d.getVar('PKGD', True)
|
||||||
objcopy = d.getVar("OBJCOPY", True)
|
objcopy = d.getVar("OBJCOPY", True)
|
||||||
@@ -283,7 +283,7 @@ def copydebugsources(debugsrcdir, d):
|
|||||||
# The debug src information written out to sourcefile is further procecessed
|
# The debug src information written out to sourcefile is further procecessed
|
||||||
# and copied to the destination here.
|
# and copied to the destination here.
|
||||||
|
|
||||||
import commands, stat, subprocess
|
import stat, subprocess
|
||||||
|
|
||||||
sourcefile = d.expand("${WORKDIR}/debugsources.list")
|
sourcefile = d.expand("${WORKDIR}/debugsources.list")
|
||||||
if debugsrcdir and os.path.isfile(sourcefile):
|
if debugsrcdir and os.path.isfile(sourcefile):
|
||||||
@@ -696,7 +696,7 @@ python fixup_perms () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
python split_and_strip_files () {
|
python split_and_strip_files () {
|
||||||
import commands, stat, errno, subprocess
|
import stat, errno, subprocess
|
||||||
|
|
||||||
dvar = d.getVar('PKGD', True)
|
dvar = d.getVar('PKGD', True)
|
||||||
pn = d.getVar('PN', True)
|
pn = d.getVar('PN', True)
|
||||||
@@ -732,7 +732,7 @@ python split_and_strip_files () {
|
|||||||
# 16 - kernel module
|
# 16 - kernel module
|
||||||
def isELF(path):
|
def isELF(path):
|
||||||
type = 0
|
type = 0
|
||||||
ret, result = commands.getstatusoutput("file '%s'" % path)
|
ret, result = subprocess.getstatusoutput("file '%s'" % path)
|
||||||
|
|
||||||
if ret:
|
if ret:
|
||||||
bb.error("split_and_strip_files: 'file %s' failed" % path)
|
bb.error("split_and_strip_files: 'file %s' failed" % path)
|
||||||
|
|||||||
@@ -342,13 +342,13 @@ def check_gcc_march(sanity_data):
|
|||||||
f = open("gcc_test.c", "w")
|
f = open("gcc_test.c", "w")
|
||||||
f.write("int main (){ __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4; return 0;}\n")
|
f.write("int main (){ __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4; return 0;}\n")
|
||||||
f.close()
|
f.close()
|
||||||
import commands
|
import subprocess
|
||||||
|
|
||||||
# Check if GCC could work without march
|
# Check if GCC could work without march
|
||||||
status,result = commands.getstatusoutput("${BUILD_PREFIX}gcc gcc_test.c -o gcc_test")
|
status,result = subprocess.getstatusoutput("${BUILD_PREFIX}gcc gcc_test.c -o gcc_test")
|
||||||
if status != 0:
|
if status != 0:
|
||||||
# Check if GCC could work with march
|
# Check if GCC could work with march
|
||||||
status,result = commands.getstatusoutput("${BUILD_PREFIX}gcc -march=native gcc_test.c -o gcc_test")
|
status,result = subprocess.getstatusoutput("${BUILD_PREFIX}gcc -march=native gcc_test.c -o gcc_test")
|
||||||
if status == 0:
|
if status == 0:
|
||||||
result = True
|
result = True
|
||||||
else:
|
else:
|
||||||
@@ -370,7 +370,6 @@ def check_sanity(sanity_data):
|
|||||||
def LooseVersion(v):
|
def LooseVersion(v):
|
||||||
print("WARNING: sanity.bbclass can't compare versions without python-distutils")
|
print("WARNING: sanity.bbclass can't compare versions without python-distutils")
|
||||||
return 1
|
return 1
|
||||||
import commands
|
|
||||||
|
|
||||||
# Check the bitbake version meets minimum requirements
|
# Check the bitbake version meets minimum requirements
|
||||||
minversion = sanity_data.getVar('BB_MIN_VERSION', True)
|
minversion = sanity_data.getVar('BB_MIN_VERSION', True)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class CmdError(bb.BBHandledException):
|
|||||||
|
|
||||||
|
|
||||||
def runcmd(args, dir = None):
|
def runcmd(args, dir = None):
|
||||||
import commands
|
import subprocess, pipes
|
||||||
|
|
||||||
if dir:
|
if dir:
|
||||||
olddir = os.path.abspath(os.curdir)
|
olddir = os.path.abspath(os.curdir)
|
||||||
@@ -27,10 +27,10 @@ def runcmd(args, dir = None):
|
|||||||
# print("cwd: %s -> %s" % (olddir, dir))
|
# print("cwd: %s -> %s" % (olddir, dir))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
args = [ commands.mkarg(str(arg)) for arg in args ]
|
args = [ pipes.quote(str(arg)) for arg in args ]
|
||||||
cmd = " ".join(args)
|
cmd = " ".join(args)
|
||||||
# print("cmd: %s" % cmd)
|
# print("cmd: %s" % cmd)
|
||||||
(exitstatus, output) = commands.getstatusoutput(cmd)
|
(exitstatus, output) = subprocess.getstatusoutput(cmd)
|
||||||
if exitstatus != 0:
|
if exitstatus != 0:
|
||||||
raise CmdError(exitstatus >> 8, output)
|
raise CmdError(exitstatus >> 8, output)
|
||||||
return output
|
return output
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ ALTERNATIVE_PRIORITY = "100"
|
|||||||
ALTERNATIVE_LINK_NAME[psplash] = "${bindir}/psplash"
|
ALTERNATIVE_LINK_NAME[psplash] = "${bindir}/psplash"
|
||||||
|
|
||||||
python do_compile () {
|
python do_compile () {
|
||||||
import shutil, commands
|
import shutil, subprocess
|
||||||
|
|
||||||
# Build a separate executable for each splash image
|
# Build a separate executable for each splash image
|
||||||
convertscript = "%s/make-image-header.sh" % d.getVar('S', True)
|
convertscript = "%s/make-image-header.sh" % d.getVar('S', True)
|
||||||
@@ -80,7 +80,7 @@ python do_compile () {
|
|||||||
outputfiles = d.getVar('SPLASH_INSTALL', True).split()
|
outputfiles = d.getVar('SPLASH_INSTALL', True).split()
|
||||||
for localfile, outputfile in zip(localfiles, outputfiles):
|
for localfile, outputfile in zip(localfiles, outputfiles):
|
||||||
if localfile.endswith(".png"):
|
if localfile.endswith(".png"):
|
||||||
outp = commands.getstatusoutput('%s %s POKY' % (convertscript, localfile))
|
outp = subprocess.getstatusoutput('%s %s POKY' % (convertscript, localfile))
|
||||||
print(outp[1])
|
print(outp[1])
|
||||||
fbase = os.path.splitext(os.path.basename(localfile))[0]
|
fbase = os.path.splitext(os.path.basename(localfile))[0]
|
||||||
shutil.copyfile("%s-img.h" % fbase, destfile)
|
shutil.copyfile("%s-img.h" % fbase, destfile)
|
||||||
|
|||||||
Reference in New Issue
Block a user