diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-02-03 22:26:06 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-05 09:20:22 +0000 |
commit | 1e28d512341ce470c7afb256a01e597ab87170ca (patch) | |
tree | 06197ccceb8f7793d4ab4b906793b4d95d6c58aa /scripts/lib/wic/engine.py | |
parent | 798edc3f9931bae4481e09287ac00002ad30654f (diff) | |
download | openembedded-core-1e28d512341ce470c7afb256a01e597ab87170ca.tar.gz openembedded-core-1e28d512341ce470c7afb256a01e597ab87170ca.tar.bz2 openembedded-core-1e28d512341ce470c7afb256a01e597ab87170ca.zip |
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.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts/lib/wic/engine.py')
-rw-r--r-- | scripts/lib/wic/engine.py | 32 |
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 @@ import os import sys -from wic import msger, creator +from wic import msger from wic.plugin import pluginmgr from wic.utils.misc import get_bitbake_var @@ -145,10 +145,10 @@ def list_source_plugins(): print(" %s" % plugin) -def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, - native_sysroot, scripts_path, image_output_dir, - compressor, bmap, debug): - """Create image +def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, native_sysroot, + scripts_path, options): + """ + Create image wks_file - user-defined OE kickstart file 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, native_sysroot - absolute path to the build's native sysroots dir scripts_path - absolute path to /scripts dir image_output_dir - dirname to create for image - compressor - compressor utility to compress the image - bmap - enable generation of .bmap + options - wic command line options (debug, bmap, etc) Normally, the values for the build artifacts values are determined 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, print("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") sys.exit(1) - if debug: + if options.debug: msger.set_loglevel('debug') - if not os.path.exists(image_output_dir): - os.makedirs(image_output_dir) + if not os.path.exists(options.outdir): + os.makedirs(options.outdir) - crobj = creator.Creator() + pname = 'direct' + plugin_class = pluginmgr.get_plugins('imager').get(pname) + if not plugin_class: + msger.error('Unknown plugin: %s' % pname) - cmdline = ["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir, - wks_file, image_output_dir, oe_builddir, compressor or ""] - if bmap: - cmdline.append('--bmap') + plugin = plugin_class(wks_file, rootfs_dir, bootimg_dir, kernel_dir, + native_sysroot, scripts_path, oe_builddir, options) - crobj.main(cmdline) + plugin.do_create() print("\nThe image(s) were created using OE kickstart file:\n %s" % wks_file) |