wic: move checks to exec_native_cmd

Checked for return code and output of native commands
inside exec_native_cmd.

Removed similar code from a lot of places where
exec_native_cmd is called.

(From OE-Core rev: 9e3e933321d58c04619a585326fb291dbf2748f5)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ed Bartosh
2015-06-05 09:13:07 +03:00
committed by Richard Purdie
parent 77e9243210
commit dec9156ce8
3 changed files with 12 additions and 27 deletions

View File

@@ -86,6 +86,12 @@ def exec_native_cmd(cmd_and_args, native_sysroot, catch=3):
msger.error("A native program %s required to build the image "
"was not found (see details above). Please make sure "
"it's installed and try again." % args[0])
if out:
msger.debug('"%s" output: %s' % (args[0], out))
if rc != 0:
msger.error("exec_cmd: '%s' returned '%s' instead of 0" % \
(cmd_and_args, rc))
return (rc, out)

View File

@@ -227,17 +227,7 @@ class Image:
args = ' '.join(args)
msger.debug(args)
rc, out = exec_native_cmd(args, self.native_sysroot)
if out:
msger.debug('"parted" output: %s' % out)
if rc != 0:
# We don't throw exception when return code is not 0, because
# parted always fails to reload part table with loop devices. This
# prevents us from distinguishing real errors based on return
# code.
msger.error("WARNING: parted returned '%s' instead of 0 (use --debug for details)" % rc)
exec_native_cmd(args, self.native_sysroot)
def __create_partition(self, device, parttype, fstype, start, size):
""" Create a partition on an image described by the 'device' object. """