kernel-srpm-macros/kabi.sh
Eric Chanudet 9fc01f0ddf kabi: handle symvers.zst
Check for symvers.zst in addition to gz and xz.

The automotive configuration selects zstd as compression alg[1], which
is used for the symvers[2] file as well.

[1] https://gitlab.com/cki-project/kernel-ark/-/blob/os-build/redhat/kernel.spec.template?ref_type=heads#L489
[2] https://gitlab.com/cki-project/kernel-ark/-/blob/os-build/redhat/kernel.spec.template?ref_type=heads#L2514

Add the zst extension to kabi.attr and kabi.sh pattern and add zstdcat
to kabi.sh catenation tool.

Resolves: RHEL-124727

Signed-off-by: Eric Chanudet <echanude@redhat.com>
2025-11-05 12:00:00 -05:00

24 lines
843 B
Bash

#!/bin/bash +x
#
# kabi.sh - Automatically extract any kernel symbol checksum from the
# symvers file and add to RPM deps. This is used to move the
# checksum checking from modprobe to rpm install for 3rd party
# modules (so they can fail during install and not at load).
IFS=$'\n'
for symvers in $(grep -E '(/boot/symvers-.*|/lib/modules/[1-9].*/symvers)\.(gz|xz|zst)') "$@";
do
cat_prog="cat"
case "$symvers" in
*.gz) cat_prog="zcat" ;;
*.xz) cat_prog="xzcat" ;;
*.zst) cat_prog="zstdcat" ;;
esac
# We generate dependencies only for symbols exported by vmlinux itself
# and not for kmods here as they are spread across subpackages,
# so Provides: generation for kmods is handled by find-provides.ksyms.
"$cat_prog" "$symvers" | awk '/[^ ]* [^ ]* vmlinux .*/ { print "kernel(" $2 ") = " $1 }'
done