mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
classes/lib: Fix getcmdstatus breakage
I mistakenly thought subprocess had getcmdstatus in python 2. It doesn't so lets add a wrapper and have this work in both worlds. (From OE-Core rev: 2253e9f12734c6e6aa489942b5e4628eca1fa29d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
d529c11fa5
commit
b54339d633
|
@ -254,7 +254,7 @@ do_kernel_configme() {
|
||||||
}
|
}
|
||||||
|
|
||||||
python do_kernel_configcheck() {
|
python do_kernel_configcheck() {
|
||||||
import re, string, sys, subprocess
|
import re, string, sys
|
||||||
|
|
||||||
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 = subprocess.getstatusoutput("%s%s" % (pathprefix, cmd))
|
ret, result = oe.utils.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:
|
||||||
|
|
|
@ -696,7 +696,7 @@ python fixup_perms () {
|
||||||
}
|
}
|
||||||
|
|
||||||
python split_and_strip_files () {
|
python split_and_strip_files () {
|
||||||
import stat, errno, subprocess
|
import stat, errno
|
||||||
|
|
||||||
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 = subprocess.getstatusoutput("file '%s'" % path)
|
ret, result = oe.utils.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,12 @@ 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 subprocess
|
|
||||||
|
|
||||||
# Check if GCC could work without march
|
# Check if GCC could work without march
|
||||||
status,result = subprocess.getstatusoutput("${BUILD_PREFIX}gcc gcc_test.c -o gcc_test")
|
status,result = oe.utils.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 = subprocess.getstatusoutput("${BUILD_PREFIX}gcc -march=native gcc_test.c -o gcc_test")
|
status,result = oe.utils.getstatusoutput("${BUILD_PREFIX}gcc -march=native gcc_test.c -o gcc_test")
|
||||||
if status == 0:
|
if status == 0:
|
||||||
result = True
|
result = True
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -17,7 +17,7 @@ class CmdError(bb.BBHandledException):
|
||||||
|
|
||||||
|
|
||||||
def runcmd(args, dir = None):
|
def runcmd(args, dir = None):
|
||||||
import subprocess, pipes
|
import pipes
|
||||||
|
|
||||||
if dir:
|
if dir:
|
||||||
olddir = os.path.abspath(os.curdir)
|
olddir = os.path.abspath(os.curdir)
|
||||||
|
@ -30,7 +30,7 @@ def runcmd(args, dir = None):
|
||||||
args = [ pipes.quote(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) = subprocess.getstatusoutput(cmd)
|
(exitstatus, output) = oe.utils.getstatusoutput(cmd)
|
||||||
if exitstatus != 0:
|
if exitstatus != 0:
|
||||||
raise CmdError(exitstatus >> 8, output)
|
raise CmdError(exitstatus >> 8, output)
|
||||||
return output
|
return output
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
try:
|
||||||
|
# Python 2
|
||||||
|
import commands as cmdstatus
|
||||||
|
except ImportError:
|
||||||
|
# Python 3
|
||||||
|
import subprocess as cmdstatus
|
||||||
|
|
||||||
def read_file(filename):
|
def read_file(filename):
|
||||||
try:
|
try:
|
||||||
f = file( filename, "r" )
|
f = file( filename, "r" )
|
||||||
|
@ -123,3 +130,6 @@ def packages_filter_out_system(d):
|
||||||
if pkg not in blacklist and localepkg not in pkg:
|
if pkg not in blacklist and localepkg not in pkg:
|
||||||
pkgs.append(pkg)
|
pkgs.append(pkg)
|
||||||
return pkgs
|
return pkgs
|
||||||
|
|
||||||
|
def getstatusoutput(cmd):
|
||||||
|
return cmdstatus.getstatusoutput(cmd)
|
||||||
|
|
|
@ -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, subprocess
|
import shutil
|
||||||
|
|
||||||
# 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 = subprocess.getstatusoutput('%s %s POKY' % (convertscript, localfile))
|
outp = oe.utils.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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user