summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/engine.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/engine.py')
-rw-r--r--scripts/lib/wic/engine.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 1aa8f6534e..b64714c686 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -28,6 +28,7 @@
28# Tom Zanussi <tom.zanussi (at] linux.intel.com> 28# Tom Zanussi <tom.zanussi (at] linux.intel.com>
29# 29#
30 30
31import logging
31import os 32import os
32import sys 33import sys
33 34
@@ -35,6 +36,7 @@ from wic import msger
35from wic.plugin import pluginmgr 36from wic.plugin import pluginmgr
36from wic.utils.misc import get_bitbake_var 37from wic.utils.misc import get_bitbake_var
37 38
39logger = logging.getLogger('wic')
38 40
39def verify_build_env(): 41def verify_build_env():
40 """ 42 """
@@ -43,7 +45,7 @@ def verify_build_env():
43 Returns True if it is, false otherwise 45 Returns True if it is, false otherwise
44 """ 46 """
45 if not os.environ.get("BUILDDIR"): 47 if not os.environ.get("BUILDDIR"):
46 print("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") 48 logger.error("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)")
47 sys.exit(1) 49 sys.exit(1)
48 50
49 return True 51 return True
@@ -179,7 +181,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
179 try: 181 try:
180 oe_builddir = os.environ["BUILDDIR"] 182 oe_builddir = os.environ["BUILDDIR"]
181 except KeyError: 183 except KeyError:
182 print("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") 184 logger.error("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)")
183 sys.exit(1) 185 sys.exit(1)
184 186
185 if options.debug: 187 if options.debug:
@@ -191,14 +193,15 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
191 pname = 'direct' 193 pname = 'direct'
192 plugin_class = pluginmgr.get_plugins('imager').get(pname) 194 plugin_class = pluginmgr.get_plugins('imager').get(pname)
193 if not plugin_class: 195 if not plugin_class:
194 msger.error('Unknown plugin: %s' % pname) 196 logger.error('Unknown plugin: %s', pname)
197 sys.exit(1)
195 198
196 plugin = plugin_class(wks_file, rootfs_dir, bootimg_dir, kernel_dir, 199 plugin = plugin_class(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
197 native_sysroot, oe_builddir, options) 200 native_sysroot, oe_builddir, options)
198 201
199 plugin.do_create() 202 plugin.do_create()
200 203
201 print("\nThe image(s) were created using OE kickstart file:\n %s" % wks_file) 204 logger.info("The image(s) were created using OE kickstart file:\n %s", wks_file)
202 205
203 206
204def wic_list(args, scripts_path): 207def wic_list(args, scripts_path):
@@ -218,10 +221,10 @@ def wic_list(args, scripts_path):
218 wks_file = args[0] 221 wks_file = args[0]
219 fullpath = find_canned_image(scripts_path, wks_file) 222 fullpath = find_canned_image(scripts_path, wks_file)
220 if not fullpath: 223 if not fullpath:
221 print("No image named %s found, exiting. "\ 224 logger.error("No image named %s found, exiting. "
222 "(Use 'wic list images' to list available images, or "\ 225 "(Use 'wic list images' to list available images, or "
223 "specify a fully-qualified OE kickstart (.wks) "\ 226 "specify a fully-qualified OE kickstart (.wks) "
224 "filename)\n" % wks_file) 227 "filename)\n", wks_file)
225 sys.exit(1) 228 sys.exit(1)
226 list_canned_image_help(scripts_path, fullpath) 229 list_canned_image_help(scripts_path, fullpath)
227 return True 230 return True