kernel-srpm-macros/kabi.sh
Eugene Syromiatnikov 96aa636698 kabi: handle symvers.xz
Check for symvers.xz support in addition to symvers.gz,
due to unnanounced unilateral change[1][2] in the kernel packaging.

[1] 2644665657
[2] 2db77a072a

* kabi.attr: Add xz extension to the file matching pattern
* kabi.sh: Add xz extension to the matching pattern;  determine catenation
program based on extension.

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
References: https://bugzilla.redhat.com/show_bug.cgi?id=2192895
2023-05-16 09:27:51 +02:00

23 lines
809 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)') "$@";
do
cat_prog="cat"
case "$symvers" in
*.gz) cat_prog="zcat" ;;
*.xz) cat_prog="xzcat" ;;
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