Switch kmodtool-generated spec to internal dependency generator

It leads to some regressions in requires generation precision, though,
as it is no longer possible to exclude requires that are satisfied
by other kmods in the package.  And calling a script on each file (instead
of calling it on the whole file list at once) does not make things faster,
either (so much for "sanity and benefit").

* find-provides.ksyms: Check for "$@" as well.
* find-requires.ksyms: Likewise.
* kernel-srpm-macros.spec (Source104, Source105, Source106): New
attribute files.
(%install): Install firmware.prov and modalias.prov with executable bit;
install provided_ksyms.attr, required_ksyms.attr, and modalias.attr into
"%{buildroot}%{_fileattrsdir}".
(%files -n kernel-rpm-macros): Add provided_ksyms.attr,
required_ksyms.attr, and modalias.attr.
kmodtool: Remove "%global _use_internal_dependency_generator 0".
macros.kmp: Remove %__find_provides and %__find_requires.
* modalias.attr: New file.
* provided_ksyms.attr: Likewise.
* required_ksyms.attr: Likewise.

Resolves: #1942072
Resolves: #1942563
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
This commit is contained in:
Eugene Syromiatnikov 2021-11-16 00:20:29 +01:00
parent b341b38e28
commit 4c68fd7e56
8 changed files with 21 additions and 10 deletions

View File

@ -2,7 +2,7 @@
IFS=$'\n'
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$'); do
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$') "$@"; do
tmpfile=""
if [ "x${module%.ko}" = "x${module}" ]; then
tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko)

View File

@ -123,7 +123,7 @@ check_kabi() {
fi
}
modules=($(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$'))
modules=($(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$') "$@")
if [ ${#modules[@]} -gt 0 ]; then
kernel=$(/sbin/modinfo -F vermagic "${modules[0]}" | sed -e 's: .*::' -e q)

View File

@ -16,11 +16,14 @@ Conflicts: redhat-rpm-config <= 184
Source0: macros.kernel-srpm
Source1: macros.kmp
# Dependency generator scripts (deprecated)
# Dependency generator scripts
Source100: find-provides.ksyms
Source101: find-requires.ksyms
Source102: firmware.prov
Source103: modalias.prov
Source104: provided_ksyms.attr
Source105: required_ksyms.attr
Source106: modalias.attr
# Dependency generators & their rules
Source200: kmod.attr
@ -81,7 +84,7 @@ mkdir -p %{buildroot}%{rrcdir}/find-provides.d
mkdir -p %{buildroot}%{_fileattrsdir}
install -p -m 755 -t %{buildroot}%{rrcdir} kmodtool rpmsort symset-table
install -p -m 755 -t %{buildroot}%{rrcdir} find-provides.ksyms find-requires.ksyms
install -p -m 644 -t %{buildroot}%{rrcdir}/find-provides.d firmware.prov modalias.prov
install -p -m 755 -t %{buildroot}%{rrcdir}/find-provides.d firmware.prov modalias.prov
install -p -m 755 -t %{buildroot}%{rrcdir} brp-kmod-restore-perms brp-kmod-set-exec-bit
install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.kmp
install -p -m 644 -t %{buildroot}%{_fileattrsdir} kmod.attr
@ -89,6 +92,9 @@ install -p -m 644 -t %{buildroot}%{_fileattrsdir} kmod.attr
install -p -m 644 -t "%{buildroot}%{_fileattrsdir}" kabi.attr
install -p -m 755 -t "%{buildroot}%{_rpmconfigdir}" kabi.sh
install -p -m 644 -t "%{buildroot}%{_fileattrsdir}" provided_ksyms.attr required_ksyms.attr
install -p -m 644 -t "%{buildroot}%{_fileattrsdir}" modalias.attr
%files
%{_rpmconfigdir}/macros.d/macros.kernel-srpm
%{_fileattrsdir}/kmod.attr
@ -97,6 +103,9 @@ install -p -m 755 -t "%{buildroot}%{_rpmconfigdir}" kabi.sh
%{_rpmconfigdir}/kabi.sh
%{_rpmconfigdir}/macros.d/macros.kmp
%{_fileattrsdir}/kabi.attr
%{_fileattrsdir}/modalias.attr
%{_fileattrsdir}/provided_ksyms.attr
%{_fileattrsdir}/required_ksyms.attr
%dir %{rrcdir}/find-provides.d
%{rrcdir}/brp-kmod-restore-perms
%{rrcdir}/brp-kmod-set-exec-bit

View File

@ -168,9 +168,6 @@ get_rpmtemplate ()
echo "Release: %{kmod_release}"
fi
# Turn of the internal dep generator so we will use the kmod scripts.
echo "%global _use_internal_dependency_generator 0"
cat <<EOF
Provides: kernel-modules >= ${verrel}${dotvariant}
Provides: kernel${dashvariant}-modules >= ${verrel}

View File

@ -9,9 +9,6 @@ redhat_kmp_has_post_hooks 1
%__kmod_brps_added 0
%__find_provides /usr/lib/rpm/redhat/find-provides
%__find_requires /usr/lib/rpm/redhat/find-requires
#kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ]
# [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ...

2
modalias.attr Normal file
View File

@ -0,0 +1,2 @@
%__modalias_provides /usr/lib/rpm/redhat/find-provides.d/modalias.prov
%__modalias_path .*\.(ko|ko\.gz|ko\.bz2|ko\.xz)$

2
provided_ksyms.attr Normal file
View File

@ -0,0 +1,2 @@
%__provided_ksyms_provides /usr/lib/rpm/redhat/find-provides.ksyms
%__provided_ksyms_path .*\.(ko|ko\.gz|ko\.bz2|ko\.xz)$

4
required_ksyms.attr Normal file
View File

@ -0,0 +1,4 @@
%__required_ksyms_requires /usr/lib/rpm/redhat/find-requires.ksyms
%__required_ksyms_path .*\.(ko|ko\.gz|ko\.bz2|ko\.xz)$
# Exclude built-in kernel modules
%__required_ksyms_exclude_path ^/lib/modules/[1-9][^/]*/kernel/.*