@@ -45,10 +45,14 @@ KERNEL_MODULE_PROVIDE_VIRTUAL ?= "1"
python split_kernel_module_packages () {
import re
- modinfoexp = re.compile("([^=]+)=(.*)")
+ modinfoexp = re.compile(r"([^=]+)=\s*(.+)")
def extract_modinfo(file):
- import tempfile, subprocess
+ """
+ Extract the module metadata from the specified file,
+ returning a dictionary of fields to list of string values.
+ """
+ import collections, tempfile, subprocess
tempfile.tempdir = d.getVar("WORKDIR")
compressed = re.match( r'.*\.(gz|xz|zst)$', file)
tf = tempfile.mkstemp()
@@ -78,12 +82,12 @@ python split_kernel_module_packages () {
os.unlink(tmpfile)
if compressed:
os.unlink(tmpkofile)
- vals = {}
+ vals = collections.defaultdict(list)
for i in l:
m = modinfoexp.match(i)
if not m:
continue
- vals[m.group(1)] = m.group(2)
+ vals[m.group(1)].append(m.group(2))
return vals
def handle_conf_files(d, basename, pkg):
@@ -195,12 +199,12 @@ python split_kernel_module_packages () {
if "description" in vals:
old_desc = d.getVar('DESCRIPTION:' + pkg) or ""
- d.setVar('DESCRIPTION:' + pkg, old_desc + "; " + vals["description"])
+ d.setVar('DESCRIPTION:' + pkg, old_desc + "; " + vals["description"][0])
rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS:' + pkg) or "")
modinfo_deps = []
- if "depends" in vals and vals["depends"] != "":
- for dep in vals["depends"].split(","):
+ for deps in vals.get("depends", []):
+ for dep in deps.split(","):
on = legitimize_package_name(dep)
dependency_pkg = format % on
modinfo_deps.append(dependency_pkg)
extract_modinfo() currently returns a dictionary of key-value entries, but many fields in modinfo can have more than one value: $ modinfo drivers/bluetooth/btmrvl_sdio.ko filename: btmrvl_sdio.ko firmware: mrvl/sdsd8997_combo_v4.bin firmware: mrvl/sd8987_uapsta.bin [ ... ] firmware: mrvl/sd8688_helper.bin license: GPL v2 version: 1.0 description: Marvell BT-over-SDIO driver ver 1.0 author: Marvell International Ltd. srcversion: 7C108FB5953EFD4D4DE0A4C alias: sdio:c*v02DFd9142* [ ... ] alias: sdio:c*v02DFd9105* depends: btmrvl intree: Y name: btmrvl_sdio vermagic: 6.18.24-yocto-standard SMP preempt mod_unload aarch64 Instead of returning a dict of key:value pairs, return a dict of key to list of values and update the callers to take the first element in the list where a single value is expected (such as the description). Signed-off-by: Ross Burton <ross.burton@arm.com> --- .../classes-recipe/kernel-module-split.bbclass | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)