summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/wic/kickstart/custom_commands/partition.py6
-rw-r--r--scripts/lib/wic/utils/oe/misc.py18
2 files changed, 14 insertions, 10 deletions
diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
index eee25a493d..babc006945 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -297,7 +297,7 @@ class Wic_PartData(FC4_PartData):
297 297
298 mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \ 298 mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \
299 (self.fstype, extra_imagecmd, rootfs, label_str, rootfs_dir) 299 (self.fstype, extra_imagecmd, rootfs, label_str, rootfs_dir)
300 exec_native_cmd(pseudo + mkfs_cmd, native_sysroot) 300 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
301 301
302 def prepare_rootfs_btrfs(self, rootfs, oe_builddir, rootfs_dir, 302 def prepare_rootfs_btrfs(self, rootfs, oe_builddir, rootfs_dir,
303 native_sysroot, pseudo): 303 native_sysroot, pseudo):
@@ -330,7 +330,7 @@ class Wic_PartData(FC4_PartData):
330 330
331 mkfs_cmd = "mkfs.%s -b %d -r %s %s %s" % \ 331 mkfs_cmd = "mkfs.%s -b %d -r %s %s %s" % \
332 (self.fstype, rootfs_size * 1024, rootfs_dir, label_str, rootfs) 332 (self.fstype, rootfs_size * 1024, rootfs_dir, label_str, rootfs)
333 exec_native_cmd(pseudo + mkfs_cmd, native_sysroot) 333 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
334 334
335 def prepare_rootfs_vfat(self, rootfs, oe_builddir, rootfs_dir, 335 def prepare_rootfs_vfat(self, rootfs, oe_builddir, rootfs_dir,
336 native_sysroot, pseudo): 336 native_sysroot, pseudo):
@@ -378,7 +378,7 @@ class Wic_PartData(FC4_PartData):
378 """ 378 """
379 squashfs_cmd = "mksquashfs %s %s -noappend" % \ 379 squashfs_cmd = "mksquashfs %s %s -noappend" % \
380 (rootfs_dir, rootfs) 380 (rootfs_dir, rootfs)
381 exec_native_cmd(pseudo + squashfs_cmd, native_sysroot) 381 exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo)
382 382
383 def prepare_empty_partition_ext(self, rootfs, oe_builddir, 383 def prepare_empty_partition_ext(self, rootfs, oe_builddir,
384 native_sysroot): 384 native_sysroot):
diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index c6d2e5f204..81239ac357 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -89,7 +89,7 @@ def cmd_in_path(cmd, path):
89 89
90 return bb.utils.which(path, cmd) != "" or False 90 return bb.utils.which(path, cmd) != "" or False
91 91
92def exec_native_cmd(cmd_and_args, native_sysroot, catch=3): 92def exec_native_cmd(cmd_and_args, native_sysroot, catch=3, pseudo=""):
93 """ 93 """
94 Execute native command, catching stderr, stdout 94 Execute native command, catching stderr, stdout
95 95
@@ -97,6 +97,12 @@ def exec_native_cmd(cmd_and_args, native_sysroot, catch=3):
97 97
98 Always need to execute native commands as_shell 98 Always need to execute native commands as_shell
99 """ 99 """
100 # The reason -1 is used is because there may be "export" commands.
101 args = cmd_and_args.split(';')[-1].split()
102 msger.debug(args)
103
104 if pseudo:
105 cmd_and_args = pseudo + cmd_and_args
100 native_paths = \ 106 native_paths = \
101 "%s/sbin:%s/usr/sbin:%s/usr/bin" % \ 107 "%s/sbin:%s/usr/sbin:%s/usr/bin" % \
102 (native_sysroot, native_sysroot, native_sysroot) 108 (native_sysroot, native_sysroot, native_sysroot)
@@ -104,18 +110,16 @@ def exec_native_cmd(cmd_and_args, native_sysroot, catch=3):
104 (native_paths, cmd_and_args) 110 (native_paths, cmd_and_args)
105 msger.debug("exec_native_cmd: %s" % cmd_and_args) 111 msger.debug("exec_native_cmd: %s" % cmd_and_args)
106 112
107 # The reason -1 is used is because there may be "export" commands.
108 args = cmd_and_args.split(';')[-1].split()
109 msger.debug(args)
110
111 # If the command isn't in the native sysroot say we failed. 113 # If the command isn't in the native sysroot say we failed.
112 if cmd_in_path(args[0], native_paths): 114 if cmd_in_path(args[0], native_paths):
113 ret, out = _exec_cmd(native_cmd_and_args, True, catch) 115 ret, out = _exec_cmd(native_cmd_and_args, True, catch)
114 else: 116 else:
115 ret = 127 117 ret = 127
116 118
117 if ret == 127: # shell command-not-found 119 prog = args[0]
118 prog = args[0] 120 # shell command-not-found
121 if ret == 127 \
122 or (pseudo and ret == 1 and out == "Can't find '%s' in $PATH." % prog):
119 msg = "A native program %s required to build the image "\ 123 msg = "A native program %s required to build the image "\
120 "was not found (see details above).\n\n" % prog 124 "was not found (see details above).\n\n" % prog
121 recipe = NATIVE_RECIPES.get(prog) 125 recipe = NATIVE_RECIPES.get(prog)