summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/engine.py
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-02-03 22:26:06 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-02-05 09:22:17 +0000
commit71ce8d09e0f5912544936b0364990250c1381fed (patch)
treea26734dc16a71142d4a0130817e8e288ea9bfce1 /scripts/lib/wic/engine.py
parent3e052dd58c30a6e3e3af45c8369a693628a23eea (diff)
downloadpoky-71ce8d09e0f5912544936b0364990250c1381fed.tar.gz
wic: flatten imager class hierarchy
wic code is hard to follow due to deep and twiggy class inheritance tree. Flatten imager tree: wic -> wic_create -> Creator -> DirectPlugin -> DirectImageCreator to wic -> wic_create -> DirectPlugin by removing Creator class and creator module merging DirectImageCreator into DirectPlugin Changed APIs to use the same parameters names. Passed parsed command line options as an object down the stack. (From OE-Core rev: 1e28d512341ce470c7afb256a01e597ab87170ca) 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>
Diffstat (limited to 'scripts/lib/wic/engine.py')
-rw-r--r--scripts/lib/wic/engine.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 7fb6f1317b..e27598d01a 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -31,7 +31,7 @@
31import os 31import os
32import sys 32import sys
33 33
34from wic import msger, creator 34from wic import msger
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
@@ -145,10 +145,10 @@ def list_source_plugins():
145 print(" %s" % plugin) 145 print(" %s" % plugin)
146 146
147 147
148def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, 148def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, native_sysroot,
149 native_sysroot, scripts_path, image_output_dir, 149 scripts_path, options):
150 compressor, bmap, debug): 150 """
151 """Create image 151 Create image
152 152
153 wks_file - user-defined OE kickstart file 153 wks_file - user-defined OE kickstart file
154 rootfs_dir - absolute path to the build's /rootfs dir 154 rootfs_dir - absolute path to the build's /rootfs dir
@@ -157,8 +157,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
157 native_sysroot - absolute path to the build's native sysroots dir 157 native_sysroot - absolute path to the build's native sysroots dir
158 scripts_path - absolute path to /scripts dir 158 scripts_path - absolute path to /scripts dir
159 image_output_dir - dirname to create for image 159 image_output_dir - dirname to create for image
160 compressor - compressor utility to compress the image 160 options - wic command line options (debug, bmap, etc)
161 bmap - enable generation of .bmap
162 161
163 Normally, the values for the build artifacts values are determined 162 Normally, the values for the build artifacts values are determined
164 by 'wic -e' from the output of the 'bitbake -e' command given an 163 by 'wic -e' from the output of the 'bitbake -e' command given an
@@ -184,20 +183,21 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
184 print("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") 183 print("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)")
185 sys.exit(1) 184 sys.exit(1)
186 185
187 if debug: 186 if options.debug:
188 msger.set_loglevel('debug') 187 msger.set_loglevel('debug')
189 188
190 if not os.path.exists(image_output_dir): 189 if not os.path.exists(options.outdir):
191 os.makedirs(image_output_dir) 190 os.makedirs(options.outdir)
192 191
193 crobj = creator.Creator() 192 pname = 'direct'
193 plugin_class = pluginmgr.get_plugins('imager').get(pname)
194 if not plugin_class:
195 msger.error('Unknown plugin: %s' % pname)
194 196
195 cmdline = ["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir, 197 plugin = plugin_class(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
196 wks_file, image_output_dir, oe_builddir, compressor or ""] 198 native_sysroot, scripts_path, oe_builddir, options)
197 if bmap:
198 cmdline.append('--bmap')
199 199
200 crobj.main(cmdline) 200 plugin.do_create()
201 201
202 print("\nThe image(s) were created using OE kickstart file:\n %s" % wks_file) 202 print("\nThe image(s) were created using OE kickstart file:\n %s" % wks_file)
203 203