summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>2020-04-19 08:35:35 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-01-22 17:56:53 +0000
commit2be5df91820a0d712f1b4adb7dbae7d2e7451281 (patch)
tree191efadb2a6254c87d7aa1d1aced24ec2fc49a40 /scripts
parent192834adc0f88e0b458c68cfd215a99fe599f34d (diff)
downloadpoky-2be5df91820a0d712f1b4adb7dbae7d2e7451281.tar.gz
wic: misc: Do not find for executables in ASSUME_PROVIDED
Executables like tar won't be available on the native sysroot, as they are part of the ASSUME_PROVIDED variable. Cc: Paul Barker <pbarker@konsulko.com> (From OE-Core rev: eab485069809c991433b9e1b8e4223a555e4d7f9) Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 2f574d535f8665b26dab65c14668cf8fc7b751c0) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/misc.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/lib/wic/misc.py b/scripts/lib/wic/misc.py
index 8fb508dd39..57c042c503 100644
--- a/scripts/lib/wic/misc.py
+++ b/scripts/lib/wic/misc.py
@@ -46,7 +46,8 @@ NATIVE_RECIPES = {"bmaptool": "bmap-tools",
46 "parted": "parted", 46 "parted": "parted",
47 "sfdisk": "util-linux", 47 "sfdisk": "util-linux",
48 "sgdisk": "gptfdisk", 48 "sgdisk": "gptfdisk",
49 "syslinux": "syslinux" 49 "syslinux": "syslinux",
50 "tar": "tar"
50 } 51 }
51 52
52def runtool(cmdln_or_args): 53def runtool(cmdln_or_args):
@@ -113,6 +114,15 @@ def exec_cmd(cmd_and_args, as_shell=False):
113 """ 114 """
114 return _exec_cmd(cmd_and_args, as_shell)[1] 115 return _exec_cmd(cmd_and_args, as_shell)[1]
115 116
117def find_executable(cmd, paths):
118 recipe = cmd
119 if recipe in NATIVE_RECIPES:
120 recipe = NATIVE_RECIPES[recipe]
121 provided = get_bitbake_var("ASSUME_PROVIDED")
122 if provided and "%s-native" % recipe in provided:
123 return True
124
125 return spawn.find_executable(cmd, paths)
116 126
117def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""): 127def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""):
118 """ 128 """
@@ -141,7 +151,7 @@ def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""):
141 logger.debug("exec_native_cmd: %s", native_cmd_and_args) 151 logger.debug("exec_native_cmd: %s", native_cmd_and_args)
142 152
143 # If the command isn't in the native sysroot say we failed. 153 # If the command isn't in the native sysroot say we failed.
144 if spawn.find_executable(args[0], native_paths): 154 if find_executable(args[0], native_paths):
145 ret, out = _exec_cmd(native_cmd_and_args, True) 155 ret, out = _exec_cmd(native_cmd_and_args, True)
146 else: 156 else:
147 ret = 127 157 ret = 127