| Message ID | 20250613164642.1614047-1-richard.purdie@linuxfoundation.org |
|---|---|
| State | Accepted, archived |
| Commit | 6d9c76196ffad39e628aff76d53d6ecbb517cfa1 |
| Headers | show |
| Series | wic: Avoid problems with "-" characters in plugin names | expand |
On Fri Jun 13, 2025 at 6:46 PM CEST, Richard Purdie via lists.openembedded.org wrote: > Remap "-" characters in plugin names to "_" so wic plugins > can be extended using standard python class inheritance. > > This change means wic files can be incrementally updated over time > to the correct name rather than breaking everything. Actual plugin > module files will need to be renamed as done in previous patches. > > Also remove a double call to get_plugins() which isn't needed. > > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> > --- Is this patch to be applied with the ones from Anibal? In any cases, with or without them, I have build errors: | ERROR: The 'bootimg_partition' --source specified for /boot doesn't exist. https://autobuilder.yoctoproject.org/valkyrie/#/builders/10/builds/1848 https://autobuilder.yoctoproject.org/valkyrie/#/builders/10/builds/1849 Or am I missing another patch?
On Sun, 2025-06-15 at 16:04 +0200, Mathieu Dubois-Briand wrote: > On Fri Jun 13, 2025 at 6:46 PM CEST, Richard Purdie via > lists.openembedded.org wrote: > > Remap "-" characters in plugin names to "_" so wic plugins > > can be extended using standard python class inheritance. > > > > This change means wic files can be incrementally updated over time > > to the correct name rather than breaking everything. Actual plugin > > module files will need to be renamed as done in previous patches. > > > > Also remove a double call to get_plugins() which isn't needed. > > > > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> > > --- > > Is this patch to be applied with the ones from Anibal? > > In any cases, with or without them, I have build errors: > > > ERROR: The 'bootimg_partition' --source specified for /boot doesn't > > exist. > > https://autobuilder.yoctoproject.org/valkyrie/#/builders/10/builds/1848 > https://autobuilder.yoctoproject.org/valkyrie/#/builders/10/builds/1849 > > Or am I missing another patch? You need a mix of patches, some from Anibal, some from myself. I believe master-next has the correct mix of them. Cheers, Richard
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 64b1d528825..b9e60cbe4eb 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py @@ -180,6 +180,8 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, os.makedirs(options.outdir) pname = options.imager + # Don't support '-' in plugin names + pname = pname.replace("-", "_") plugin_class = PluginMgr.get_plugins('imager').get(pname) if not plugin_class: raise WicError('Unknown plugin: %s' % pname) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 5b51ab214fe..b34691d3137 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -164,6 +164,9 @@ class Partition(): plugins = PluginMgr.get_plugins('source') + # Don't support '-' in plugin names + self.source = self.source.replace("-", "_") + if self.source not in plugins: raise WicError("The '%s' --source specified for %s doesn't exist.\n\t" "See 'wic list source-plugins' for a list of available" @@ -178,7 +181,7 @@ class Partition(): splitted = self.sourceparams.split(',') srcparams_dict = dict((par.split('=', 1) + [None])[:2] for par in splitted if par) - plugin = PluginMgr.get_plugins('source')[self.source] + plugin = plugins[self.source] plugin.do_configure_partition(self, srcparams_dict, creator, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, native_sysroot) diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index 2124ceac7f4..711535626bb 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py @@ -201,6 +201,8 @@ class DirectPlugin(ImagerPlugin): creating and installing a bootloader configuration. """ source_plugin = self.ks.bootloader.source + # Don't support '-' in plugin names + source_plugin = source_plugin.replace("-", "_") disk_name = self.parts[0].disk if source_plugin: plugin = PluginMgr.get_plugins('source')[source_plugin]
Remap "-" characters in plugin names to "_" so wic plugins can be extended using standard python class inheritance. This change means wic files can be incrementally updated over time to the correct name rather than breaking everything. Actual plugin module files will need to be renamed as done in previous patches. Also remove a double call to get_plugins() which isn't needed. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- scripts/lib/wic/engine.py | 2 ++ scripts/lib/wic/partition.py | 5 ++++- scripts/lib/wic/plugins/imager/direct.py | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-)