summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/engine.py
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-02-14 22:21:38 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-04 23:18:17 +0000
commitf5ae79da406190bf27194d7cecf15926bbb6ef20 (patch)
tree8f745825923833393a896c3a084e42cd3f184528 /scripts/lib/wic/engine.py
parent3d47a212a627af50c78099eaf7308a6d38aaf1b3 (diff)
downloadpoky-f5ae79da406190bf27194d7cecf15926bbb6ef20.tar.gz
wic: raise WicError in core modules
Replaced sys.exit with raising WicError in the core wic modules. (From OE-Core rev: 1b11437fb25ece5b3eede52344b071e875fa738f) 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/engine.py')
-rw-r--r--scripts/lib/wic/engine.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 2ccd5107f3..38a68ed340 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -30,8 +30,8 @@
30 30
31import logging 31import logging
32import os 32import os
33import sys
34 33
34from wic.errors import WicError
35from wic.plugin import pluginmgr 35from wic.plugin import pluginmgr
36from wic.utils.misc import get_bitbake_var 36from wic.utils.misc import get_bitbake_var
37 37
@@ -44,8 +44,7 @@ def verify_build_env():
44 Returns True if it is, false otherwise 44 Returns True if it is, false otherwise
45 """ 45 """
46 if not os.environ.get("BUILDDIR"): 46 if not os.environ.get("BUILDDIR"):
47 logger.error("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") 47 raise WicError("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)")
48 sys.exit(1)
49 48
50 return True 49 return True
51 50
@@ -180,8 +179,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
180 try: 179 try:
181 oe_builddir = os.environ["BUILDDIR"] 180 oe_builddir = os.environ["BUILDDIR"]
182 except KeyError: 181 except KeyError:
183 logger.error("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") 182 raise WicError("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)")
184 sys.exit(1)
185 183
186 if not os.path.exists(options.outdir): 184 if not os.path.exists(options.outdir):
187 os.makedirs(options.outdir) 185 os.makedirs(options.outdir)
@@ -189,8 +187,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
189 pname = 'direct' 187 pname = 'direct'
190 plugin_class = pluginmgr.get_plugins('imager').get(pname) 188 plugin_class = pluginmgr.get_plugins('imager').get(pname)
191 if not plugin_class: 189 if not plugin_class:
192 logger.error('Unknown plugin: %s', pname) 190 raise WicError('Unknown plugin: %s' % pname)
193 sys.exit(1)
194 191
195 plugin = plugin_class(wks_file, rootfs_dir, bootimg_dir, kernel_dir, 192 plugin = plugin_class(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
196 native_sysroot, oe_builddir, options) 193 native_sysroot, oe_builddir, options)
@@ -217,11 +214,11 @@ def wic_list(args, scripts_path):
217 wks_file = args[0] 214 wks_file = args[0]
218 fullpath = find_canned_image(scripts_path, wks_file) 215 fullpath = find_canned_image(scripts_path, wks_file)
219 if not fullpath: 216 if not fullpath:
220 logger.error("No image named %s found, exiting. " 217 raise WicError("No image named %s found, exiting. "
221 "(Use 'wic list images' to list available images, or " 218 "(Use 'wic list images' to list available images, "
222 "specify a fully-qualified OE kickstart (.wks) " 219 "or specify a fully-qualified OE kickstart (.wks) "
223 "filename)\n", wks_file) 220 "filename)" % wks_file)
224 sys.exit(1) 221
225 list_canned_image_help(scripts_path, fullpath) 222 list_canned_image_help(scripts_path, fullpath)
226 return True 223 return True
227 224