redhat-rpm-config/find-provides
Denys Vlasenko 05c9a7fd13 find-provides: fix filtering for find-provides.ksyms
Filtering of files for find-provides.ksyms is utterly broken.
Even though the immediate problem I'm solving now is that it looks only for
/lib/modules/*/*.ko, not looking for .ko.xz et al, the logic in general
is buggy. We can skip find-provides.ksyms only if we never saw /boot/*
or /lib/modules/*.ko*, otherwise we should run it.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2024-12-05 13:04:16 +00:00

37 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
# This script reads filenames from STDIN and outputs any relevant provides
# information that needs to be included in the package.
# Read stdin, backslash-quoting ' and "
filelist=`sed "s/['\"]/\\\&/g"`
# If nothing was given, do nothing
[ "$filelist" ] || exit 0
[ -x /usr/lib/rpm/rpmdeps ] &&
printf "%s\n" "$filelist" | tr '[:blank:]' \\n | /usr/lib/rpm/rpmdeps --provides
# (why are we replacing witespace with newlines?)
# Run any other extra find-provides scripts
for i in /usr/lib/rpm/redhat/find-provides.d/*.prov; do
[ -x $i ] || continue
printf "%s\n" "$filelist" | tr '[:blank:]' \\n | $i | sort -u
done
# Find symbols provided by the kernel or modules.
if [ -x /usr/lib/rpm/redhat/find-provides.ksyms ]; then
# If /lib/modules/*/*.ko[.*z|.lzma|.zst], it is a kernel module
# If /boot/*, it may be the kernel image itself
# (No need to be super precise: find-provides.ksyms filters out the files
# it needs to operate on)
if printf "%s\n" "$filelist" | grep -q \
-e '/lib/modules/.*\.ko$' \
-e '/lib/modules/.*\.ko\..*z' \
-e '/boot/'
then
printf "%s\n" "$filelist" | /usr/lib/rpm/redhat/find-provides.ksyms
fi
fi
exit 0