Skip to contentSkip to conversation

wic: Avoid problems with "-" characters in plugin names

PATCH In review Richard Purdie 2 participants 3 messages Jun 13, 2025 – Jun 16, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wic: Avoid problems with "-" characters in plugin names

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.

---
 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(-)
scripts/lib/wic/engine.py +2 -0
index 64b1d528825..b9e60cbe4eb 100644
@@ -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)
scripts/lib/wic/partition.py +4 -1
index 5b51ab214fe..b34691d3137 100644
@@ -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)
scripts/lib/wic/plugins/imager/direct.py +2 -0
index 2124ceac7f4..711535626bb 100644
@@ -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]
#1 lore raw
Quoted 11 lines · Richard Purdie via lists.openembedded.org

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.

---

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?

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw
Quoted 18 lines · Mathieu Dubois-Briand
Quoted 11 lines · Richard Purdie via lists.openembedded.org

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.

---

Is this patch to be applied with the ones from Anibal?

In any cases, with or without them, I have build errors:

Quoted 7 lines
Quoted 2 lines

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