mirror of
https://git.yoctoproject.org/poky
synced 2026-09-14 21:49:33 +02:00
oeqa/commands: add support for running cross tools to runCmd
If native_sysroot is passed, also support the caller passing in the target_sys and add that to the path if so. This allows runCmd() to be used to invoke the cross tools. (From OE-Core rev: afa3d3ba00b40fd29e9852eeaa2c2c9b68f18659) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
31dc02701d
commit
e015c6cf32
@@ -168,15 +168,22 @@ class Result(object):
|
|||||||
|
|
||||||
|
|
||||||
def runCmd(command, ignore_status=False, timeout=None, assert_error=True, sync=True,
|
def runCmd(command, ignore_status=False, timeout=None, assert_error=True, sync=True,
|
||||||
native_sysroot=None, limit_exc_output=0, output_log=None, **options):
|
native_sysroot=None, target_sys=None, limit_exc_output=0, output_log=None, **options):
|
||||||
result = Result()
|
result = Result()
|
||||||
|
|
||||||
if native_sysroot:
|
if native_sysroot:
|
||||||
extra_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin" % \
|
new_env = dict(options.get('env', os.environ))
|
||||||
(native_sysroot, native_sysroot, native_sysroot)
|
paths = new_env["PATH"].split(":")
|
||||||
nenv = dict(options.get('env', os.environ))
|
paths = [
|
||||||
nenv['PATH'] = extra_paths + ':' + nenv.get('PATH', '')
|
os.path.join(native_sysroot, "bin"),
|
||||||
options['env'] = nenv
|
os.path.join(native_sysroot, "sbin"),
|
||||||
|
os.path.join(native_sysroot, "usr", "bin"),
|
||||||
|
os.path.join(native_sysroot, "usr", "sbin"),
|
||||||
|
] + paths
|
||||||
|
if target_sys:
|
||||||
|
paths = [os.path.join(native_sysroot, "usr", "bin", target_sys)] + paths
|
||||||
|
new_env["PATH"] = ":".join(paths)
|
||||||
|
options['env'] = new_env
|
||||||
|
|
||||||
cmd = Command(command, timeout=timeout, output_log=output_log, **options)
|
cmd = Command(command, timeout=timeout, output_log=output_log, **options)
|
||||||
cmd.run()
|
cmd.run()
|
||||||
|
|||||||
Reference in New Issue
Block a user