summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-02-15 20:13:41 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-04 23:18:17 +0000
commitb9839fd6648c05b9052ab922bf81eec2fffd47bb (patch)
treecbef8fbfb033a7994efe75c23aa38923f40cb6b8 /scripts/lib
parent59b72c0b260001b98eca87f3e6c0dfccef38182c (diff)
downloadpoky-b9839fd6648c05b9052ab922bf81eec2fffd47bb.tar.gz
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>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/wic/help.py7
-rw-r--r--scripts/lib/wic/partition.py20
-rw-r--r--scripts/lib/wic/plugin.py17
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py10
4 files changed, 13 insertions, 41 deletions
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index 196896c170..c08ad34ae5 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -373,12 +373,7 @@ DESCRIPTION
373 373
374 This scheme is extensible - adding more hooks is a simple matter 374 This scheme is extensible - adding more hooks is a simple matter
375 of adding more plugin methods to SourcePlugin and derived classes. 375 of adding more plugin methods to SourcePlugin and derived classes.
376 The code that then needs to call the plugin methods uses 376 Please see the implementation for details.
377 plugin.get_plugin_methods() to find the method(s) needed by
378 the call; this is done by filling up a dict with keys containing
379 the method names of interest - on success, these will be filled in
380 with the actual methods. Please see the implementation for
381 examples and details.
382""" 377"""
383 378
384wic_overview_help = """ 379wic_overview_help = """
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 1f384be450..adf44b743c 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -170,20 +170,16 @@ class Partition():
170 splitted = self.sourceparams.split(',') 170 splitted = self.sourceparams.split(',')
171 srcparams_dict = dict(par.split('=') for par in splitted if par) 171 srcparams_dict = dict(par.split('=') for par in splitted if par)
172 172
173 partition_methods = ["do_configure_partition", "do_stage_partition", 173 plugin = PluginMgr.get_plugins('source')[self.source]
174 "do_prepare_partition"] 174 plugin.do_configure_partition(self, srcparams_dict, creator,
175
176 methods = PluginMgr.get_plugin_methods('source', self.source,
177 partition_methods)
178 methods["do_configure_partition"](self, srcparams_dict, creator,
179 cr_workdir, oe_builddir, bootimg_dir,
180 kernel_dir, native_sysroot)
181 methods["do_stage_partition"](self, srcparams_dict, creator,
182 cr_workdir, oe_builddir, bootimg_dir, 175 cr_workdir, oe_builddir, bootimg_dir,
183 kernel_dir, native_sysroot) 176 kernel_dir, native_sysroot)
184 methods["do_prepare_partition"](self, srcparams_dict, creator, 177 plugin.do_stage_partition(self, srcparams_dict, creator,
185 cr_workdir, oe_builddir, bootimg_dir, 178 cr_workdir, oe_builddir, bootimg_dir,
186 kernel_dir, rootfs_dir, native_sysroot) 179 kernel_dir, native_sysroot)
180 plugin.do_prepare_partition(self, srcparams_dict, creator,
181 cr_workdir, oe_builddir, bootimg_dir,
182 kernel_dir, rootfs_dir, native_sysroot)
187 183
188 # further processing required Partition.size to be an integer, make 184 # further processing required Partition.size to be an integer, make
189 # sure that it is one 185 # sure that it is one
diff --git a/scripts/lib/wic/plugin.py b/scripts/lib/wic/plugin.py
index b45478cd9a..36a120bb1c 100644
--- a/scripts/lib/wic/plugin.py
+++ b/scripts/lib/wic/plugin.py
@@ -62,20 +62,3 @@ class PluginMgr:
62 cls._loaded.append(ppath) 62 cls._loaded.append(ppath)
63 63
64 return pluginbase.get_plugins(ptype) 64 return pluginbase.get_plugins(ptype)
65
66 @classmethod
67 def get_plugin_methods(cls, ptype, pname, methods):
68 """
69 The methods param is a dict with the method names to find. On
70 return, the dict values will be filled in with pointers to the
71 corresponding methods. If one or more methods are not found,
72 None is returned.
73 """
74 result = {}
75 plugin = cls.get_plugins(ptype).get(pname)
76 for method in methods:
77 if not hasattr(plugin, method):
78 raise WicError("Unimplemented %s plugin interface for: %s" %
79 (method, pname))
80 result[method] = getattr(plugin, method)
81 return result
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 4ab195519a..7221648fc2 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -197,12 +197,10 @@ class DirectPlugin(ImagerPlugin):
197 source_plugin = self.ks.bootloader.source 197 source_plugin = self.ks.bootloader.source
198 disk_name = self.parts[0].disk 198 disk_name = self.parts[0].disk
199 if source_plugin: 199 if source_plugin:
200 name = "do_install_disk" 200 plugin = PluginMgr.get_plugins('source')[source_plugin]
201 method = PluginMgr.get_plugin_methods('source', source_plugin, 201 plugin.do_install_disk(self._image, disk_name, self, self.workdir,
202 [name])[name] 202 self.oe_builddir, self.bootimg_dir,
203 method(self._image, disk_name, self, self.workdir, 203 self.kernel_dir, self.native_sysroot)
204 self.oe_builddir, self.bootimg_dir,
205 self.kernel_dir, self.native_sysroot)
206 204
207 full_path = self._image.path 205 full_path = self._image.path
208 # Generate .bmap 206 # Generate .bmap