Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kmod: do not append glob to search for firmware if it is already there #3210

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions mkosi/kmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,19 @@ def resolve_module_dependencies(
if not sep:
key, sep, value = line.partition("=")

value = value.strip()

if key == "depends":
depends.update(normalize_module_name(d) for d in value.strip().split(",") if d)
depends.update(normalize_module_name(d) for d in value.split(",") if d)

elif key == "softdep":
# softdep is delimited by spaces and can contain strings like pre: and post: so discard
# anything that ends with a colon.
depends.update(
normalize_module_name(d) for d in value.strip().split() if not d.endswith(":")
)
depends.update(normalize_module_name(d) for d in value.split() if not d.endswith(":"))

elif key == "firmware":
fw = [f for f in Path("usr/lib/firmware").glob(f"{value.strip()}*")]
glob = "" if value.endswith("*") else "*"
fw = [f for f in Path("usr/lib/firmware").glob(f"{value}{glob}")]
if not fw:
logging.debug(f"Not including missing firmware /usr/lib/firmware/{value} in the initrd")

Expand All @@ -126,7 +127,7 @@ def resolve_module_dependencies(
elif key == "name":
# The file names use dashes, but the module names use underscores. We track the names in
# terms of the file names, since the depends use dashes and therefore filenames as well.
name = normalize_module_name(value.strip())
name = normalize_module_name(value)

moddep[name] = depends
firmwaredep[name] = firmware
Expand Down
Loading