wic: remove PluginMgr.get_plugin_methods
Call methods directly instead of getting them with get_plugin_methods and then calling. (From OE-Core rev: efcd07fe17bf55441059b00a5becc3952e0a4075) 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
59b72c0b26
commit
b9839fd664
|
@ -373,12 +373,7 @@ DESCRIPTION
|
|||
|
||||
This scheme is extensible - adding more hooks is a simple matter
|
||||
of adding more plugin methods to SourcePlugin and derived classes.
|
||||
The code that then needs to call the plugin methods uses
|
||||
plugin.get_plugin_methods() to find the method(s) needed by
|
||||
the call; this is done by filling up a dict with keys containing
|
||||
the method names of interest - on success, these will be filled in
|
||||
with the actual methods. Please see the implementation for
|
||||
examples and details.
|
||||
Please see the implementation for details.
|
||||
"""
|
||||
|
||||
wic_overview_help = """
|
||||
|
|
|
@ -170,20 +170,16 @@ class Partition():
|
|||
splitted = self.sourceparams.split(',')
|
||||
srcparams_dict = dict(par.split('=') for par in splitted if par)
|
||||
|
||||
partition_methods = ["do_configure_partition", "do_stage_partition",
|
||||
"do_prepare_partition"]
|
||||
|
||||
methods = PluginMgr.get_plugin_methods('source', self.source,
|
||||
partition_methods)
|
||||
methods["do_configure_partition"](self, srcparams_dict, creator,
|
||||
cr_workdir, oe_builddir, bootimg_dir,
|
||||
kernel_dir, native_sysroot)
|
||||
methods["do_stage_partition"](self, srcparams_dict, creator,
|
||||
plugin = PluginMgr.get_plugins('source')[self.source]
|
||||
plugin.do_configure_partition(self, srcparams_dict, creator,
|
||||
cr_workdir, oe_builddir, bootimg_dir,
|
||||
kernel_dir, native_sysroot)
|
||||
methods["do_prepare_partition"](self, srcparams_dict, creator,
|
||||
cr_workdir, oe_builddir, bootimg_dir,
|
||||
kernel_dir, rootfs_dir, native_sysroot)
|
||||
plugin.do_stage_partition(self, srcparams_dict, creator,
|
||||
cr_workdir, oe_builddir, bootimg_dir,
|
||||
kernel_dir, native_sysroot)
|
||||
plugin.do_prepare_partition(self, srcparams_dict, creator,
|
||||
cr_workdir, oe_builddir, bootimg_dir,
|
||||
kernel_dir, rootfs_dir, native_sysroot)
|
||||
|
||||
# further processing required Partition.size to be an integer, make
|
||||
# sure that it is one
|
||||
|
|
|
@ -62,20 +62,3 @@ class PluginMgr:
|
|||
cls._loaded.append(ppath)
|
||||
|
||||
return pluginbase.get_plugins(ptype)
|
||||
|
||||
@classmethod
|
||||
def get_plugin_methods(cls, ptype, pname, methods):
|
||||
"""
|
||||
The methods param is a dict with the method names to find. On
|
||||
return, the dict values will be filled in with pointers to the
|
||||
corresponding methods. If one or more methods are not found,
|
||||
None is returned.
|
||||
"""
|
||||
result = {}
|
||||
plugin = cls.get_plugins(ptype).get(pname)
|
||||
for method in methods:
|
||||
if not hasattr(plugin, method):
|
||||
raise WicError("Unimplemented %s plugin interface for: %s" %
|
||||
(method, pname))
|
||||
result[method] = getattr(plugin, method)
|
||||
return result
|
||||
|
|
|
@ -197,12 +197,10 @@ class DirectPlugin(ImagerPlugin):
|
|||
source_plugin = self.ks.bootloader.source
|
||||
disk_name = self.parts[0].disk
|
||||
if source_plugin:
|
||||
name = "do_install_disk"
|
||||
method = PluginMgr.get_plugin_methods('source', source_plugin,
|
||||
[name])[name]
|
||||
method(self._image, disk_name, self, self.workdir,
|
||||
self.oe_builddir, self.bootimg_dir,
|
||||
self.kernel_dir, self.native_sysroot)
|
||||
plugin = PluginMgr.get_plugins('source')[source_plugin]
|
||||
plugin.do_install_disk(self._image, disk_name, self, self.workdir,
|
||||
self.oe_builddir, self.bootimg_dir,
|
||||
self.kernel_dir, self.native_sysroot)
|
||||
|
||||
full_path = self._image.path
|
||||
# Generate .bmap
|
||||
|
|
Loading…
Reference in New Issue