wic: direct_plugin: stop using config manager
This is a preparation to removing conf.py and config/wic.conf from the codebase. Got rid of using configmgr global object in direct_plugin and direct modules. It was used to implicitly parse kickstart file and set couple of variables. Replaced usage of configmgr by passing parameters directly to the DirectImageCreator. [YOCTO #10619] (From OE-Core rev: 79191119de010acb107f9392a991108728858441) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
65a99448a4
commit
0ff04e1e95
|
@ -72,18 +72,18 @@ class DirectImageCreator:
|
||||||
media and used on actual hardware.
|
media and used on actual hardware.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, oe_builddir, image_output_dir, rootfs_dir,
|
def __init__(self, image_name, ksobj, oe_builddir, image_output_dir,
|
||||||
bootimg_dir, kernel_dir, native_sysroot, compressor,
|
rootfs_dir, bootimg_dir, kernel_dir, native_sysroot,
|
||||||
creatoropts, bmap=False):
|
compressor, bmap=False):
|
||||||
"""
|
"""
|
||||||
Initialize a DirectImageCreator instance.
|
Initialize a DirectImageCreator instance.
|
||||||
|
|
||||||
This method takes the same arguments as ImageCreator.__init__()
|
This method takes the same arguments as ImageCreator.__init__()
|
||||||
"""
|
"""
|
||||||
self.name = creatoropts['name']
|
self.name = image_name
|
||||||
self.outdir = image_output_dir
|
self.outdir = image_output_dir
|
||||||
self.workdir = tempfile.mktemp(prefix='wic')
|
self.workdir = tempfile.mktemp(prefix='wic')
|
||||||
self.ks = creatoropts['ks']
|
self.ks = ksobj
|
||||||
|
|
||||||
self.__image = None
|
self.__image = None
|
||||||
self.__disks = {}
|
self.__disks = {}
|
||||||
|
|
|
@ -24,8 +24,12 @@
|
||||||
# Tom Zanussi <tom.zanussi (at] linux.intel.com>
|
# Tom Zanussi <tom.zanussi (at] linux.intel.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from time import strftime
|
||||||
|
|
||||||
|
from os.path import basename, splitext
|
||||||
from wic.utils import errors
|
from wic.utils import errors
|
||||||
from wic.conf import configmgr
|
from wic.ksparser import KickStart, KickStartError
|
||||||
|
from wic import msger
|
||||||
|
|
||||||
import wic.imager.direct as direct
|
import wic.imager.direct as direct
|
||||||
from wic.pluginbase import ImagerPlugin
|
from wic.pluginbase import ImagerPlugin
|
||||||
|
@ -68,27 +72,31 @@ class DirectPlugin(ImagerPlugin):
|
||||||
bootimg_dir = args[2]
|
bootimg_dir = args[2]
|
||||||
rootfs_dir = args[3]
|
rootfs_dir = args[3]
|
||||||
|
|
||||||
creatoropts = configmgr.create
|
|
||||||
ksconf = args[4]
|
ksconf = args[4]
|
||||||
|
|
||||||
image_output_dir = args[5]
|
image_output_dir = args[5]
|
||||||
oe_builddir = args[6]
|
oe_builddir = args[6]
|
||||||
compressor = args[7]
|
compressor = args[7]
|
||||||
|
|
||||||
|
try:
|
||||||
|
ksobj = KickStart(ksconf)
|
||||||
|
except KickStartError as err:
|
||||||
|
msger.error(str(err))
|
||||||
|
|
||||||
|
image_name = "%s-%s" % (splitext(basename(ksconf))[0],
|
||||||
|
strftime("%Y%m%d%H%M"))
|
||||||
krootfs_dir = cls.__rootfs_dir_to_dict(rootfs_dir)
|
krootfs_dir = cls.__rootfs_dir_to_dict(rootfs_dir)
|
||||||
|
|
||||||
configmgr._ksconf = ksconf
|
creator = direct.DirectImageCreator(image_name,
|
||||||
|
ksobj,
|
||||||
creator = direct.DirectImageCreator(oe_builddir,
|
oe_builddir,
|
||||||
image_output_dir,
|
image_output_dir,
|
||||||
krootfs_dir,
|
krootfs_dir,
|
||||||
bootimg_dir,
|
bootimg_dir,
|
||||||
kernel_dir,
|
kernel_dir,
|
||||||
native_sysroot,
|
native_sysroot,
|
||||||
compressor,
|
compressor,
|
||||||
creatoropts,
|
|
||||||
opts.bmap)
|
opts.bmap)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
creator.create()
|
creator.create()
|
||||||
creator.assemble()
|
creator.assemble()
|
||||||
|
|
Loading…
Reference in New Issue