summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/wic/partition.py53
-rw-r--r--scripts/lib/wic/utils/oe/misc.py23
2 files changed, 25 insertions, 51 deletions
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 49d13277c3..094a8c3bec 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -27,16 +27,10 @@
import os
import tempfile
-from wic.utils.oe.misc import msger, parse_sourceparams
+from wic.utils.oe.misc import msger
from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var
from wic.plugin import pluginmgr
-partition_methods = {
- "do_stage_partition":None,
- "do_prepare_partition":None,
- "do_configure_partition":None,
-}
-
class Partition():
def __init__(self, args, lineno):
@@ -129,9 +123,6 @@ class Partition():
Prepare content for individual partitions, depending on
partition command parameters.
"""
- if self.sourceparams:
- self.sourceparams_dict = parse_sourceparams(self.sourceparams)
-
if not self.source:
if not self.size and not self.fixed_size:
msger.error("The %s partition has a size of zero. Please "
@@ -164,24 +155,30 @@ class Partition():
"details on adding a new source plugin." % \
(self.source, self.mountpoint))
- self._source_methods = pluginmgr.get_source_plugin_methods(\
- self.source, partition_methods)
- self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
- creator, cr_workdir,
- oe_builddir,
- bootimg_dir,
- kernel_dir,
- native_sysroot)
- self._source_methods["do_stage_partition"](self, self.sourceparams_dict,
- creator, cr_workdir,
- oe_builddir,
- bootimg_dir, kernel_dir,
- native_sysroot)
- self._source_methods["do_prepare_partition"](self, self.sourceparams_dict,
- creator, cr_workdir,
- oe_builddir,
- bootimg_dir, kernel_dir, rootfs_dir,
- native_sysroot)
+ srcparams_dict = {}
+ if self.sourceparams:
+ # Split sourceparams string of the form key1=val1[,key2=val2,...]
+ # into a dict. Also accepts valueless keys i.e. without =
+ splitted = self.sourceparams.split(',')
+ srcparams_dict = dict(par.split('=') for par in splitted if par)
+
+ partition_methods = {
+ "do_stage_partition": None,
+ "do_prepare_partition": None,
+ "do_configure_partition": None
+ }
+
+ methods = pluginmgr.get_source_plugin_methods(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,
+ 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)
# further processing required Partition.size to be an integer, make
# sure that it is one
diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index 3737c4b1f0..6781d8381a 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -222,26 +222,3 @@ def get_bitbake_var(var, image=None, cache=True):
get_var method of BB_VARS singleton.
"""
return BB_VARS.get_var(var, image, cache)
-
-def parse_sourceparams(sourceparams):
- """
- Split sourceparams string of the form key1=val1[,key2=val2,...]
- into a dict. Also accepts valueless keys i.e. without =.
-
- Returns dict of param key/val pairs (note that val may be None).
- """
- params_dict = {}
-
- params = sourceparams.split(',')
- if params:
- for par in params:
- if not par:
- continue
- if not '=' in par:
- key = par
- val = None
- else:
- key, val = par.split('=')
- params_dict[key] = val
-
- return params_dict