summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugins/source/bootimg-pcbios.py
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-02-14 23:07:35 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-04 23:18:17 +0000
commit8da175607c0d3434428a3bf4ee1549919b698709 (patch)
tree1122f66b976598d3d3aa77cacc67659ccdda0c7c /scripts/lib/wic/plugins/source/bootimg-pcbios.py
parentf5ae79da406190bf27194d7cecf15926bbb6ef20 (diff)
downloadpoky-8da175607c0d3434428a3bf4ee1549919b698709.tar.gz
wic: raise WicError in wic plugins
Replaced sys.exit with raising WicError in wic plugins. (From OE-Core rev: 92e8c81c941597eb2b4b61d5c28833e4826888f8) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/plugins/source/bootimg-pcbios.py')
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-pcbios.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index 8f53fa2a48..2ded2dac52 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -26,10 +26,9 @@
26 26
27import logging 27import logging
28import os 28import os
29import sys
30 29
31from wic.engine import get_custom_config 30from wic.engine import get_custom_config
32from wic.errors import ImageError 31from wic.errors import ImageError, WicError
33from wic.utils import runner 32from wic.utils import runner
34from wic.pluginbase import SourcePlugin 33from wic.pluginbase import SourcePlugin
35from wic.utils.misc import (exec_cmd, exec_native_cmd, 34from wic.utils.misc import (exec_cmd, exec_native_cmd,
@@ -57,14 +56,13 @@ class BootimgPcbiosPlugin(SourcePlugin):
57 elif creator.ptable_format == 'gpt': 56 elif creator.ptable_format == 'gpt':
58 mbrfile += "gptmbr.bin" 57 mbrfile += "gptmbr.bin"
59 else: 58 else:
60 logger.error("Unsupported partition table: %s", creator.ptable_format) 59 raise WicError("Unsupported partition table: %s" %
61 sys.exit(1) 60 creator.ptable_format)
62 61
63 if not os.path.exists(mbrfile): 62 if not os.path.exists(mbrfile):
64 logger.error("Couldn't find %s. If using the -e option, do you " 63 raise WicError("Couldn't find %s. If using the -e option, do you "
65 "have the right MACHINE set in local.conf? If not, " 64 "have the right MACHINE set in local.conf? If not, "
66 "is the bootimg_dir path correct?", mbrfile) 65 "is the bootimg_dir path correct?" % mbrfile)
67 sys.exit(1)
68 66
69 full_path = creator._full_path(workdir, disk_name, "direct") 67 full_path = creator._full_path(workdir, disk_name, "direct")
70 logger.debug("Installing MBR on disk %s as %s with size %s bytes", 68 logger.debug("Installing MBR on disk %s as %s with size %s bytes",
@@ -152,11 +150,9 @@ class BootimgPcbiosPlugin(SourcePlugin):
152 if not _has_syslinux(bootimg_dir): 150 if not _has_syslinux(bootimg_dir):
153 bootimg_dir = get_bitbake_var("STAGING_DATADIR", "wic-tools") 151 bootimg_dir = get_bitbake_var("STAGING_DATADIR", "wic-tools")
154 if not bootimg_dir: 152 if not bootimg_dir:
155 logger.error("Couldn't find STAGING_DATADIR, exiting\n") 153 raise WicError("Couldn't find STAGING_DATADIR, exiting")
156 sys.exit(1)
157 if not _has_syslinux(bootimg_dir): 154 if not _has_syslinux(bootimg_dir):
158 logger.error("Please build syslinux first\n") 155 raise WicError("Please build syslinux first")
159 sys.exit(1)
160 # just so the result notes display it 156 # just so the result notes display it
161 creator.bootimg_dir = bootimg_dir 157 creator.bootimg_dir = bootimg_dir
162 158