summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-07 13:56:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-09 14:04:19 +0100
commite2e1dcd74bc45381baccf507c0309dd792229afe (patch)
tree71bca48bffd9feacc6bd8e2beb9c5a625ee1b297
parent4f47b3a4726dd47e8a6db228fcaf25d1890e3e52 (diff)
downloadopenembedded-core-e2e1dcd74bc45381baccf507c0309dd792229afe.tar.gz
openembedded-core-e2e1dcd74bc45381baccf507c0309dd792229afe.tar.bz2
openembedded-core-e2e1dcd74bc45381baccf507c0309dd792229afe.zip
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/kernel-yocto.bbclass4
-rw-r--r--meta/classes/package.bbclass8
-rw-r--r--meta/classes/sanity.bbclass7
-rw-r--r--meta/lib/oe/patch.py6
-rw-r--r--meta/recipes-core/psplash/psplash_git.bb4
5 files changed, 14 insertions, 15 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index d1b4f10254..c81e70e678 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -254,7 +254,7 @@ do_kernel_configme() {
}
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")
@@ -265,7 +265,7 @@ python do_kernel_configcheck() {
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)
- 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
if config_check_visibility == 1:
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 96228b0bc0..1dba185b3e 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -233,7 +233,7 @@ def splitdebuginfo(file, debugfile, debugsrcdir, d):
#
# sourcefile is also generated containing a list of debugsources
- import commands, stat, subprocess
+ import stat, subprocess
dvar = d.getVar('PKGD', 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
# and copied to the destination here.
- import commands, stat, subprocess
+ import stat, subprocess
sourcefile = d.expand("${WORKDIR}/debugsources.list")
if debugsrcdir and os.path.isfile(sourcefile):
@@ -696,7 +696,7 @@ python fixup_perms () {
}
python split_and_strip_files () {
- import commands, stat, errno, subprocess
+ import stat, errno, subprocess
dvar = d.getVar('PKGD', True)
pn = d.getVar('PN', True)
@@ -732,7 +732,7 @@ python split_and_strip_files () {
# 16 - kernel module
def isELF(path):
type = 0
- ret, result = commands.getstatusoutput("file '%s'" % path)
+ ret, result = subprocess.getstatusoutput("file '%s'" % path)
if ret:
bb.error("split_and_strip_files: 'file %s' failed" % path)
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 17420a8767..3836c0404d 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -342,13 +342,13 @@ def check_gcc_march(sanity_data):
f = open("gcc_test.c", "w")
f.write("int main (){ __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4; return 0;}\n")
f.close()
- import commands
+ import subprocess
# 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:
# 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:
result = True
else:
@@ -370,7 +370,6 @@ def check_sanity(sanity_data):
def LooseVersion(v):
print("WARNING: sanity.bbclass can't compare versions without python-distutils")
return 1
- import commands
# Check the bitbake version meets minimum requirements
minversion = sanity_data.getVar('BB_MIN_VERSION', True)
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index cbc5cd9755..8de73a7037 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -17,7 +17,7 @@ class CmdError(bb.BBHandledException):
def runcmd(args, dir = None):
- import commands
+ import subprocess, pipes
if dir:
olddir = os.path.abspath(os.curdir)
@@ -27,10 +27,10 @@ def runcmd(args, dir = None):
# print("cwd: %s -> %s" % (olddir, dir))
try:
- args = [ commands.mkarg(str(arg)) for arg in args ]
+ args = [ pipes.quote(str(arg)) for arg in args ]
cmd = " ".join(args)
# print("cmd: %s" % cmd)
- (exitstatus, output) = commands.getstatusoutput(cmd)
+ (exitstatus, output) = subprocess.getstatusoutput(cmd)
if exitstatus != 0:
raise CmdError(exitstatus >> 8, output)
return output
diff --git a/meta/recipes-core/psplash/psplash_git.bb b/meta/recipes-core/psplash/psplash_git.bb
index bbeaa0b3b9..392fada689 100644
--- a/meta/recipes-core/psplash/psplash_git.bb
+++ b/meta/recipes-core/psplash/psplash_git.bb
@@ -71,7 +71,7 @@ ALTERNATIVE_PRIORITY = "100"
ALTERNATIVE_LINK_NAME[psplash] = "${bindir}/psplash"
python do_compile () {
- import shutil, commands
+ import shutil, subprocess
# Build a separate executable for each splash image
convertscript = "%s/make-image-header.sh" % d.getVar('S', True)
@@ -80,7 +80,7 @@ python do_compile () {
outputfiles = d.getVar('SPLASH_INSTALL', True).split()
for localfile, outputfile in zip(localfiles, outputfiles):
if localfile.endswith(".png"):
- outp = commands.getstatusoutput('%s %s POKY' % (convertscript, localfile))
+ outp = subprocess.getstatusoutput('%s %s POKY' % (convertscript, localfile))
print(outp[1])
fbase = os.path.splitext(os.path.basename(localfile))[0]
shutil.copyfile("%s-img.h" % fbase, destfile)