[PATCH v5 3/6] wic: extra-partition: Move extra var handling to a dedicated method

Adam Duskett
2026-01-16T09:32:25Z

For organizational purposes, and to make the following patches
easier to follow, move the extra file parsing to a dedicated
method.

Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
---
.../lib/wic/plugins/source/extra_partition.py | 25 +++++++++++--------
1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/extra_partition.py b/scripts/lib/wic/plugins/source/extra_partition.py
index aa4fb931c2..05b0ace361 100644
--- a/scripts/lib/wic/plugins/source/extra_partition.py
+++ b/scripts/lib/wic/plugins/source/extra_partition.py
@@ -36,6 +36,20 @@ class ExtraPartitionPlugin(SourcePlugin):
name = 'extra_partition'
image_extra_partition_files_var_name = 'IMAGE_EXTRA_PARTITION_FILES'

+ @classmethod
+ def _get_extra_vars(cls, part, var_name):
+ """Get extra partition directory or file variables"""
+ extra_vars = None
+ for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), ("_part-name-%s", part.part_name), (None, None)):
+ var = ""
+ if fmt:
+ var = fmt % id
+ thing = var_name + var
+ extra_vars = get_bitbake_var(thing)
+ if extra_vars is not None:
+ break
+ return extra_vars
+
@classmethod
def _parse_extra_files(cls, part, kernel_dir):
"""
@@ -43,16 +57,7 @@ class ExtraPartitionPlugin(SourcePlugin):
"""
deploy_files = []

- extra_files = None
- for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), ("_part-name-%s", part.part_name), (None, None)):
- if fmt:
- var = fmt % id
- else:
- var = ""
- extra_files = get_bitbake_var(cls.image_extra_partition_files_var_name + var)
- if extra_files is not None:
- break
-
+ extra_files = cls._get_extra_vars(part, cls.image_extra_partition_files_var_name)
if extra_files is None:
raise WicError('No extra files defined, %s unset for entry #%d' % (cls.image_extra_partition_files_var_name, part.lineno))

--
2.52.0