summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic
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>2020-04-26 14:00:50 +0100
commitfc2589384bbf40b2c2b3e81b668eac71762c192f (patch)
tree20cba684e1ad4e05018c1148027657e46e171417 /scripts/lib/wic
parent6cfcc149ef7779c6f8ddad425eba9e05cb811c06 (diff)
downloadpoky-fc2589384bbf40b2c2b3e81b668eac71762c192f.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: 2f574d535f8665b26dab65c14668cf8fc7b751c0) Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic')
-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 1f199b9f23..91975ba151 100644
--- a/scripts/lib/wic/misc.py
+++ b/scripts/lib/wic/misc.py
@@ -45,7 +45,8 @@ NATIVE_RECIPES = {"bmaptool": "bmap-tools",
45 "parted": "parted", 45 "parted": "parted",
46 "sfdisk": "util-linux", 46 "sfdisk": "util-linux",
47 "sgdisk": "gptfdisk", 47 "sgdisk": "gptfdisk",
48 "syslinux": "syslinux" 48 "syslinux": "syslinux",
49 "tar": "tar"
49 } 50 }
50 51
51def runtool(cmdln_or_args): 52def runtool(cmdln_or_args):
@@ -112,6 +113,15 @@ def exec_cmd(cmd_and_args, as_shell=False):
112 """ 113 """
113 return _exec_cmd(cmd_and_args, as_shell)[1] 114 return _exec_cmd(cmd_and_args, as_shell)[1]
114 115
116def find_executable(cmd, paths):
117 recipe = cmd
118 if recipe in NATIVE_RECIPES:
119 recipe = NATIVE_RECIPES[recipe]
120 provided = get_bitbake_var("ASSUME_PROVIDED")
121 if provided and "%s-native" % recipe in provided:
122 return True
123
124 return spawn.find_executable(cmd, paths)
115 125
116def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""): 126def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""):
117 """ 127 """
@@ -136,7 +146,7 @@ def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""):
136 logger.debug("exec_native_cmd: %s", native_cmd_and_args) 146 logger.debug("exec_native_cmd: %s", native_cmd_and_args)
137 147
138 # If the command isn't in the native sysroot say we failed. 148 # If the command isn't in the native sysroot say we failed.
139 if spawn.find_executable(args[0], native_paths): 149 if find_executable(args[0], native_paths):
140 ret, out = _exec_cmd(native_cmd_and_args, True) 150 ret, out = _exec_cmd(native_cmd_and_args, True)
141 else: 151 else:
142 ret = 127 152 ret = 127