From d045fed31acd3f31fbe99815204e8540dc5f6846 Mon Sep 17 00:00:00 2001 From: Marcus Folkesson Date: Wed, 10 Jul 2024 10:53:09 +0200 Subject: bootimg-partition: break out code to a common library. Break out the code that parse IMAGE_BOOT_FILES to a common library. (From OE-Core rev: 1e07fe51bdb24070308c85e83df0b80ab9f83cea) Signed-off-by: Marcus Folkesson Reviewed-by: Quentin Schulz Reviewed-by: Konrad Weihmann Signed-off-by: Richard Purdie --- .../lib/wic/plugins/source/bootimg-partition.py | 39 ++-------------------- 1 file changed, 2 insertions(+), 37 deletions(-) (limited to 'scripts/lib/wic/plugins/source/bootimg-partition.py') diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py index 1071d1af3f..589853a439 100644 --- a/scripts/lib/wic/plugins/source/bootimg-partition.py +++ b/scripts/lib/wic/plugins/source/bootimg-partition.py @@ -16,7 +16,7 @@ import logging import os import re -from glob import glob +from oe.bootfiles import get_boot_files from wic import WicError from wic.engine import get_custom_config @@ -66,42 +66,7 @@ class BootimgPartitionPlugin(SourcePlugin): logger.debug('Boot files: %s', boot_files) - # list of tuples (src_name, dst_name) - deploy_files = [] - for src_entry in re.findall(r'[\w;\-\./\*]+', boot_files): - if ';' in src_entry: - dst_entry = tuple(src_entry.split(';')) - if not dst_entry[0] or not dst_entry[1]: - raise WicError('Malformed boot file entry: %s' % src_entry) - else: - dst_entry = (src_entry, src_entry) - - logger.debug('Destination entry: %r', dst_entry) - deploy_files.append(dst_entry) - - cls.install_task = []; - for deploy_entry in deploy_files: - src, dst = deploy_entry - if '*' in src: - # by default install files under their basename - entry_name_fn = os.path.basename - if dst != src: - # unless a target name was given, then treat name - # as a directory and append a basename - entry_name_fn = lambda name: \ - os.path.join(dst, - os.path.basename(name)) - - srcs = glob(os.path.join(kernel_dir, src)) - - logger.debug('Globbed sources: %s', ', '.join(srcs)) - for entry in srcs: - src = os.path.relpath(entry, kernel_dir) - entry_dst_name = entry_name_fn(entry) - cls.install_task.append((src, entry_dst_name)) - else: - cls.install_task.append((src, dst)) - + cls.install_task = get_boot_files(kernel_dir, boot_files) if source_params.get('loader') != "u-boot": return -- cgit v1.2.3-54-g00ecf