m/n/b/fwprune: process links from metadata file
The linux-firmware repository has a metadata file called WHENCE which
contains mostly license and origin information, but critically it also
contains data for symbolic links which are not materialized inside the
repo itself. So we need to parse that file and create these symlinks
ourselves.
Change-Id: I9e6973e60d6f06e844dc879f658c9dd1913c432d
Reviewed-on: https://review.monogon.dev/c/monogon/+/555
Reviewed-by: Mateusz Zalega <mateusz@monogon.tech>
diff --git a/metropolis/node/build/fwprune/def.bzl b/metropolis/node/build/fwprune/def.bzl
index b43b1d1..507532e 100644
--- a/metropolis/node/build/fwprune/def.bzl
+++ b/metropolis/node/build/fwprune/def.bzl
@@ -13,10 +13,10 @@
ctx.actions.run(
outputs = [fsspec_out],
- inputs = [fwlist, modinfo] + ctx.files.firmware_files,
+ inputs = [fwlist, modinfo, ctx.file.metadata] + ctx.files.firmware_files,
tools = [ctx.executable._fwprune],
executable = ctx.executable._fwprune,
- arguments = [modinfo.path, fwlist.path, fsspec_out.path],
+ arguments = [modinfo.path, fwlist.path, ctx.file.metadata.path, fsspec_out.path],
)
return [DefaultInfo(files = depset([fsspec_out])), FSSpecInfo(spec = fsspec_out, referenced = ctx.files.firmware_files)]
@@ -36,6 +36,14 @@
be in here.
""",
),
+ "metadata": attr.label(
+ mandatory = True,
+ allow_single_file = True,
+ doc = """
+ The metadata file for the Linux firmware. Currently this is the WHENCE file at the root of the
+ linux-firmware repository. Used for resolving additional links.
+ """,
+ ),
"kernel": attr.label(
doc = """
Kernel for which firmware should be selected. Needs to have a modinfo OutputGroup.