diff options
author | Ross Burton <ross.burton@arm.com> | 2022-08-22 16:19:49 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-23 15:24:11 +0100 |
commit | e015c6cf32e68179d1bb68dfa1d7b72c2447a70b (patch) | |
tree | f8238b8f8c5df6c0b588cfdc9e1debd00f4efe7b /meta/lib | |
parent | 31dc02701d0becb426c7f01c891641a74a897774 (diff) | |
download | poky-e015c6cf32e68179d1bb68dfa1d7b72c2447a70b.tar.gz |
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>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/utils/commands.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 024261410e..f733fcdf3c 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py | |||
@@ -168,15 +168,22 @@ class Result(object): | |||
168 | 168 | ||
169 | 169 | ||
170 | def runCmd(command, ignore_status=False, timeout=None, assert_error=True, sync=True, | 170 | def runCmd(command, ignore_status=False, timeout=None, assert_error=True, sync=True, |
171 | native_sysroot=None, limit_exc_output=0, output_log=None, **options): | 171 | native_sysroot=None, target_sys=None, limit_exc_output=0, output_log=None, **options): |
172 | result = Result() | 172 | result = Result() |
173 | 173 | ||
174 | if native_sysroot: | 174 | if native_sysroot: |
175 | extra_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin" % \ | 175 | new_env = dict(options.get('env', os.environ)) |
176 | (native_sysroot, native_sysroot, native_sysroot) | 176 | paths = new_env["PATH"].split(":") |
177 | nenv = dict(options.get('env', os.environ)) | 177 | paths = [ |
178 | nenv['PATH'] = extra_paths + ':' + nenv.get('PATH', '') | 178 | os.path.join(native_sysroot, "bin"), |
179 | options['env'] = nenv | 179 | os.path.join(native_sysroot, "sbin"), |
180 | os.path.join(native_sysroot, "usr", "bin"), | ||
181 | os.path.join(native_sysroot, "usr", "sbin"), | ||
182 | ] + paths | ||
183 | if target_sys: | ||
184 | paths = [os.path.join(native_sysroot, "usr", "bin", target_sys)] + paths | ||
185 | new_env["PATH"] = ":".join(paths) | ||
186 | options['env'] = new_env | ||
180 | 187 | ||
181 | cmd = Command(command, timeout=timeout, output_log=output_log, **options) | 188 | cmd = Command(command, timeout=timeout, output_log=output_log, **options) |
182 | cmd.run() | 189 | cmd.run() |