]> code.ossystems Code Review - openembedded-core.git/commitdiff
sanity/patch.py: Remove commands module usage
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 7 May 2013 12:56:05 +0000 (13:56 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 9 May 2013 13:04:19 +0000 (14:04 +0100)
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>
meta/classes/kernel-yocto.bbclass
meta/classes/package.bbclass
meta/classes/sanity.bbclass
meta/lib/oe/patch.py
meta/recipes-core/psplash/psplash_git.bb

index d1b4f1025459360abdfe0943c895b447fe805437..c81e70e678c368426654550d43b56b61417d0a39 100644 (file)
@@ -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:
index 96228b0bc0ad60c752ffe1db7b97676db617f387..1dba185b3e3112c0603dd1101bc21894dba66042 100644 (file)
@@ -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)
index 17420a87678e08303036112ae66fc327f6b752bc..3836c0404d540a60bf31a63f0ea74526deeb5ac9 100644 (file)
@@ -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)
index cbc5cd97557c71837c25e0252dfdf5f289ea54c4..8de73a7037ad6f81fe50d2b7d16effd6b027f6f6 100644 (file)
@@ -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
index bbeaa0b3b9dcdfa3c40724c6809146f1773e6bb5..392fada689c3db81ed5b70e0db57d184a1ba9d01 100644 (file)
@@ -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)