2021-06-03 15:21:41 +00:00
|
|
|
# Use these macros to differentiate between RH and other KMP implementation(s).
|
|
|
|
redhat_kernel_module_package 1
|
|
|
|
kernel_module_package_release 1
|
|
|
|
|
|
|
|
%__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 ...
|
|
|
|
|
|
|
|
%kernel_module_package_buildreqs %global kmodtool_generate_buildreqs 1 \
|
|
|
|
kernel-devel
|
|
|
|
|
|
|
|
%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \
|
2019-01-21 07:52:21 +00:00
|
|
|
%global kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
|
|
|
|
%global kmod_version %{-v*}%{!-v:%{version}} \
|
|
|
|
%global kmod_release %{-r*}%{!-r:%{release}} \
|
2019-01-21 09:44:44 +00:00
|
|
|
%global latest_kernel %(rpm -q --qf '%{VERSION}-%{RELEASE}.%{ARCH}\\\\n' `rpm -qa | egrep "^kernel(-rt|-aarch64)?-devel" | /usr/lib/rpm/redhat/rpmsort -r | head -n 1` | head -n 1) \
|
2021-06-03 15:21:41 +00:00
|
|
|
%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
|
|
|
|
%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
|
|
|
|
flavors="default" \
|
|
|
|
if [ -z "%*" ]; then \
|
|
|
|
flavors_to_build=$flavors \
|
|
|
|
elif [ -z "%{-x}" ]; then \
|
|
|
|
flavors_to_build="%*" \
|
|
|
|
else \
|
|
|
|
flavors_to_build=" $flavors "\
|
|
|
|
for i in %* \
|
|
|
|
do \
|
|
|
|
flavors_to_build=${flavors_to_build//$i /}
|
|
|
|
done \
|
|
|
|
fi \
|
|
|
|
echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
|
2019-01-21 07:52:21 +00:00
|
|
|
echo "%%global kernel_source() /usr/src/kernels/%kverrel\\\$([ %%%%{1} = default ] || echo ".%%%%{1}")" \
|
|
|
|
echo "%%global kernel_module_package_moddir() extra" \
|
2021-06-03 15:21:41 +00:00
|
|
|
if [ ! -z "%{-f*}" ] \
|
|
|
|
then \
|
|
|
|
filelist="%{-f*}" \
|
|
|
|
fi \
|
|
|
|
if [ ! -z "%{-p*}" ] \
|
|
|
|
then \
|
|
|
|
preamble="%{-p*}" \
|
|
|
|
fi \
|
|
|
|
nobuildreqs="yes" \
|
|
|
|
if [ "x%{kmodtool_generate_buildreqs}" != "x1" ] \
|
|
|
|
then \
|
|
|
|
nobuildreqs="no" \
|
|
|
|
fi \
|
2019-01-21 07:52:21 +00:00
|
|
|
override_filelist="$filelist" override_preamble="$preamble" nobuildreqs="$nobuildreqs" kmod_version=%kmod_version kmod_release=%kmod_release %{kmodtool} rpmtemplate %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
|
2021-06-03 15:21:41 +00:00
|
|
|
)}
|