diff options
Diffstat (limited to 'scripts/lib/wic/partition.py')
| -rw-r--r-- | scripts/lib/wic/partition.py | 53 |
1 files changed, 25 insertions, 28 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 @@ | |||
| 27 | import os | 27 | import os |
| 28 | import tempfile | 28 | import tempfile |
| 29 | 29 | ||
| 30 | from wic.utils.oe.misc import msger, parse_sourceparams | 30 | from wic.utils.oe.misc import msger |
| 31 | from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var | 31 | from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var |
| 32 | from wic.plugin import pluginmgr | 32 | from wic.plugin import pluginmgr |
| 33 | 33 | ||
| 34 | partition_methods = { | ||
| 35 | "do_stage_partition":None, | ||
| 36 | "do_prepare_partition":None, | ||
| 37 | "do_configure_partition":None, | ||
| 38 | } | ||
| 39 | |||
| 40 | class Partition(): | 34 | class Partition(): |
| 41 | 35 | ||
| 42 | def __init__(self, args, lineno): | 36 | def __init__(self, args, lineno): |
| @@ -129,9 +123,6 @@ class Partition(): | |||
| 129 | Prepare content for individual partitions, depending on | 123 | Prepare content for individual partitions, depending on |
| 130 | partition command parameters. | 124 | partition command parameters. |
| 131 | """ | 125 | """ |
| 132 | if self.sourceparams: | ||
| 133 | self.sourceparams_dict = parse_sourceparams(self.sourceparams) | ||
| 134 | |||
| 135 | if not self.source: | 126 | if not self.source: |
| 136 | if not self.size and not self.fixed_size: | 127 | if not self.size and not self.fixed_size: |
| 137 | msger.error("The %s partition has a size of zero. Please " | 128 | msger.error("The %s partition has a size of zero. Please " |
| @@ -164,24 +155,30 @@ class Partition(): | |||
| 164 | "details on adding a new source plugin." % \ | 155 | "details on adding a new source plugin." % \ |
| 165 | (self.source, self.mountpoint)) | 156 | (self.source, self.mountpoint)) |
| 166 | 157 | ||
| 167 | self._source_methods = pluginmgr.get_source_plugin_methods(\ | 158 | srcparams_dict = {} |
| 168 | self.source, partition_methods) | 159 | if self.sourceparams: |
| 169 | self._source_methods["do_configure_partition"](self, self.sourceparams_dict, | 160 | # Split sourceparams string of the form key1=val1[,key2=val2,...] |
| 170 | creator, cr_workdir, | 161 | # into a dict. Also accepts valueless keys i.e. without = |
| 171 | oe_builddir, | 162 | splitted = self.sourceparams.split(',') |
| 172 | bootimg_dir, | 163 | srcparams_dict = dict(par.split('=') for par in splitted if par) |
| 173 | kernel_dir, | 164 | |
| 174 | native_sysroot) | 165 | partition_methods = { |
| 175 | self._source_methods["do_stage_partition"](self, self.sourceparams_dict, | 166 | "do_stage_partition": None, |
| 176 | creator, cr_workdir, | 167 | "do_prepare_partition": None, |
| 177 | oe_builddir, | 168 | "do_configure_partition": None |
| 178 | bootimg_dir, kernel_dir, | 169 | } |
| 179 | native_sysroot) | 170 | |
| 180 | self._source_methods["do_prepare_partition"](self, self.sourceparams_dict, | 171 | methods = pluginmgr.get_source_plugin_methods(self.source, |
| 181 | creator, cr_workdir, | 172 | partition_methods) |
| 182 | oe_builddir, | 173 | methods["do_configure_partition"](self, srcparams_dict, creator, |
| 183 | bootimg_dir, kernel_dir, rootfs_dir, | 174 | cr_workdir, oe_builddir, bootimg_dir, |
| 184 | native_sysroot) | 175 | kernel_dir, native_sysroot) |
| 176 | methods["do_stage_partition"](self, srcparams_dict, creator, | ||
| 177 | cr_workdir, oe_builddir, bootimg_dir, | ||
| 178 | kernel_dir, native_sysroot) | ||
| 179 | methods["do_prepare_partition"](self, srcparams_dict, creator, | ||
| 180 | cr_workdir, oe_builddir, bootimg_dir, | ||
| 181 | kernel_dir, rootfs_dir, native_sysroot) | ||
| 185 | 182 | ||
| 186 | # further processing required Partition.size to be an integer, make | 183 | # further processing required Partition.size to be an integer, make |
| 187 | # sure that it is one | 184 | # sure that it is one |
