]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
kmod: Narrow glob used to select firmware
authorDaanDeMeyer <daan.j.demeyer@gmail.com>
Mon, 25 Aug 2025 19:55:38 +0000 (21:55 +0200)
committerDaanDeMeyer <daan.j.demeyer@gmail.com>
Mon, 25 Aug 2025 19:56:45 +0000 (21:56 +0200)
We want to select the firmware regardless of which compression extension
it has, but let's insist on having at least a '.' which indicates what
follows is an extension in the first place.

mkosi/kmod.py

index cb23d80a5fc4ea7919cd2c0e36843a8245456a58..799bb6a2d62e66e0698f7dc5ae55f8832834a47f 100644 (file)
@@ -276,9 +276,13 @@ def resolve_module_dependencies(
                 depends.update(normalize_module_name(d) for d in value.split() if not d.endswith(":"))
 
             elif key == "firmware":
-                glob = "" if value.endswith("*") else "*"
-                fw = [f for f in Path("usr/lib/firmware").glob(f"{value}{glob}")]
-                firmware.update(fw)
+                if (Path("usr/lib/firmware") / value).exists():
+                    firmware.add(Path("usr/lib/firmware") / value)
+
+                glob = "" if value.endswith("*") else ".*"
+
+                for fw in Path("usr/lib/firmware").glob(f"{value}{glob}"):
+                    firmware.add(fw)
 
             elif key == "name":
                 # The file names use dashes, but the module names use underscores. We track the names in