summaryrefslogtreecommitdiffstats
path: root/meta
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:06:51 +0100
commite16faa55daca2a87190ce66dc98a37906ecf90af (patch)
tree1a332be79ff1d5a44b399e7180196b9d66ec261d /meta
parente1b5647d2c84579b65f54aa7ca07a41b1dd9470d (diff)
downloadpoky-e16faa55daca2a87190ce66dc98a37906ecf90af.tar.gz
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>
Diffstat (limited to 'meta')
-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() {
254} 254}
255 255
256python do_kernel_configcheck() { 256python do_kernel_configcheck() {
257 import re, string, sys, commands 257 import re, string, sys, subprocess
258 258
259 bb.plain("NOTE: validating kernel config, see log.do_kernel_configcheck for details") 259 bb.plain("NOTE: validating kernel config, see log.do_kernel_configcheck for details")
260 260
@@ -265,7 +265,7 @@ python do_kernel_configcheck() {
265 265
266 pathprefix = "export PATH=%s:%s; " % (d.getVar('PATH', True), "${S}/scripts/util/") 266 pathprefix = "export PATH=%s:%s; " % (d.getVar('PATH', True), "${S}/scripts/util/")
267 cmd = d.expand("cd ${S}; kconf_check -config- %s/meta-series ${S} ${B}" % kmeta) 267 cmd = d.expand("cd ${S}; kconf_check -config- %s/meta-series ${S} ${B}" % kmeta)
268 ret, result = commands.getstatusoutput("%s%s" % (pathprefix, cmd)) 268 ret, result = subprocess.getstatusoutput("%s%s" % (pathprefix, cmd))
269 269
270 config_check_visibility = d.getVar( "KCONF_AUDIT_LEVEL", True ) or 1 270 config_check_visibility = d.getVar( "KCONF_AUDIT_LEVEL", True ) or 1
271 if config_check_visibility == 1: 271 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):
233 # 233 #
234 # sourcefile is also generated containing a list of debugsources 234 # sourcefile is also generated containing a list of debugsources
235 235
236 import commands, stat, subprocess 236 import stat, subprocess
237 237
238 dvar = d.getVar('PKGD', True) 238 dvar = d.getVar('PKGD', True)
239 objcopy = d.getVar("OBJCOPY", True) 239 objcopy = d.getVar("OBJCOPY", True)
@@ -283,7 +283,7 @@ def copydebugsources(debugsrcdir, d):
283 # The debug src information written out to sourcefile is further procecessed 283 # The debug src information written out to sourcefile is further procecessed
284 # and copied to the destination here. 284 # and copied to the destination here.
285 285
286 import commands, stat, subprocess 286 import stat, subprocess
287 287
288 sourcefile = d.expand("${WORKDIR}/debugsources.list") 288 sourcefile = d.expand("${WORKDIR}/debugsources.list")
289 if debugsrcdir and os.path.isfile(sourcefile): 289 if debugsrcdir and os.path.isfile(sourcefile):
@@ -696,7 +696,7 @@ python fixup_perms () {
696} 696}
697 697
698python split_and_strip_files () { 698python split_and_strip_files () {
699 import commands, stat, errno, subprocess 699 import stat, errno, subprocess
700 700
701 dvar = d.getVar('PKGD', True) 701 dvar = d.getVar('PKGD', True)
702 pn = d.getVar('PN', True) 702 pn = d.getVar('PN', True)
@@ -732,7 +732,7 @@ python split_and_strip_files () {
732 # 16 - kernel module 732 # 16 - kernel module
733 def isELF(path): 733 def isELF(path):
734 type = 0 734 type = 0
735 ret, result = commands.getstatusoutput("file '%s'" % path) 735 ret, result = subprocess.getstatusoutput("file '%s'" % path)
736 736
737 if ret: 737 if ret:
738 bb.error("split_and_strip_files: 'file %s' failed" % path) 738 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):
342 f = open("gcc_test.c", "w") 342 f = open("gcc_test.c", "w")
343 f.write("int main (){ __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4; return 0;}\n") 343 f.write("int main (){ __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4; return 0;}\n")
344 f.close() 344 f.close()
345 import commands 345 import subprocess
346 346
347 # Check if GCC could work without march 347 # Check if GCC could work without march
348 status,result = commands.getstatusoutput("${BUILD_PREFIX}gcc gcc_test.c -o gcc_test") 348 status,result = subprocess.getstatusoutput("${BUILD_PREFIX}gcc gcc_test.c -o gcc_test")
349 if status != 0: 349 if status != 0:
350 # Check if GCC could work with march 350 # Check if GCC could work with march
351 status,result = commands.getstatusoutput("${BUILD_PREFIX}gcc -march=native gcc_test.c -o gcc_test") 351 status,result = subprocess.getstatusoutput("${BUILD_PREFIX}gcc -march=native gcc_test.c -o gcc_test")
352 if status == 0: 352 if status == 0:
353 result = True 353 result = True
354 else: 354 else:
@@ -370,7 +370,6 @@ def check_sanity(sanity_data):
370 def LooseVersion(v): 370 def LooseVersion(v):
371 print("WARNING: sanity.bbclass can't compare versions without python-distutils") 371 print("WARNING: sanity.bbclass can't compare versions without python-distutils")
372 return 1 372 return 1
373 import commands
374 373
375 # Check the bitbake version meets minimum requirements 374 # Check the bitbake version meets minimum requirements
376 minversion = sanity_data.getVar('BB_MIN_VERSION', True) 375 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):
17 17
18 18
19def runcmd(args, dir = None): 19def runcmd(args, dir = None):
20 import commands 20 import subprocess, pipes
21 21
22 if dir: 22 if dir:
23 olddir = os.path.abspath(os.curdir) 23 olddir = os.path.abspath(os.curdir)
@@ -27,10 +27,10 @@ def runcmd(args, dir = None):
27 # print("cwd: %s -> %s" % (olddir, dir)) 27 # print("cwd: %s -> %s" % (olddir, dir))
28 28
29 try: 29 try:
30 args = [ commands.mkarg(str(arg)) for arg in args ] 30 args = [ pipes.quote(str(arg)) for arg in args ]
31 cmd = " ".join(args) 31 cmd = " ".join(args)
32 # print("cmd: %s" % cmd) 32 # print("cmd: %s" % cmd)
33 (exitstatus, output) = commands.getstatusoutput(cmd) 33 (exitstatus, output) = subprocess.getstatusoutput(cmd)
34 if exitstatus != 0: 34 if exitstatus != 0:
35 raise CmdError(exitstatus >> 8, output) 35 raise CmdError(exitstatus >> 8, output)
36 return output 36 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"
71ALTERNATIVE_LINK_NAME[psplash] = "${bindir}/psplash" 71ALTERNATIVE_LINK_NAME[psplash] = "${bindir}/psplash"
72 72
73python do_compile () { 73python do_compile () {
74 import shutil, commands 74 import shutil, subprocess
75 75
76 # Build a separate executable for each splash image 76 # Build a separate executable for each splash image
77 convertscript = "%s/make-image-header.sh" % d.getVar('S', True) 77 convertscript = "%s/make-image-header.sh" % d.getVar('S', True)
@@ -80,7 +80,7 @@ python do_compile () {
80 outputfiles = d.getVar('SPLASH_INSTALL', True).split() 80 outputfiles = d.getVar('SPLASH_INSTALL', True).split()
81 for localfile, outputfile in zip(localfiles, outputfiles): 81 for localfile, outputfile in zip(localfiles, outputfiles):
82 if localfile.endswith(".png"): 82 if localfile.endswith(".png"):
83 outp = commands.getstatusoutput('%s %s POKY' % (convertscript, localfile)) 83 outp = subprocess.getstatusoutput('%s %s POKY' % (convertscript, localfile))
84 print(outp[1]) 84 print(outp[1])
85 fbase = os.path.splitext(os.path.basename(localfile))[0] 85 fbase = os.path.splitext(os.path.basename(localfile))[0]
86 shutil.copyfile("%s-img.h" % fbase, destfile) 86 shutil.copyfile("%s-img.h" % fbase, destfile)