From: Daan De Meyer Date: Sat, 14 Sep 2024 14:48:34 +0000 (+0200) Subject: Fix relative path calculation in filter_kernel_modules() X-Git-Tag: v25~293 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=055ae7877465be4e9b2dce648ffc1d89963da45c;p=thirdparty%2Fmkosi.git Fix relative path calculation in filter_kernel_modules() I'm not sure what possessed me when I last touched this, but to get the path relative to the kernel/ directory we have to strip of the first 5 parts, not just 1. --- diff --git a/mkosi/kmod.py b/mkosi/kmod.py index eb007dc96..9e38b4a78 100644 --- a/mkosi/kmod.py +++ b/mkosi/kmod.py @@ -27,7 +27,7 @@ def filter_kernel_modules(root: Path, kver: str, *, include: Iterable[str], excl if include: regex = re.compile("|".join(include)) for m in modules: - rel = os.fspath(Path(*m.parts[1:])) + rel = os.fspath(Path(*m.parts[5:])) if regex.search(rel): keep.add(rel) @@ -35,7 +35,7 @@ def filter_kernel_modules(root: Path, kver: str, *, include: Iterable[str], excl remove = set() regex = re.compile("|".join(exclude)) for m in modules: - rel = os.fspath(Path(*m.parts[1:])) + rel = os.fspath(Path(*m.parts[5:])) if rel not in keep and regex.search(rel): remove.add(m)