kernel-livepatch-tools/macros.kernel-livepatch

36 lines
1.5 KiB
Plaintext
Raw Normal View History

# Defines %flavors_to_build and %kernel_source() as a side effect.
%klp_module_package(n:x) \
%{expand:%( \
subpkg=/usr/lib/rpm/kernel-livepatch-subpackage \
echo "%%define _suse_klp_module_subpackage(n:v:r:f:p:bc) %%{expand:%%(cd %_sourcedir; cat $subpkg; echo %%%%nil)}" \
flavors_to_build= \
flavors="%*" \
for flavor in $(ls /usr/src/linux-obj/%_target_cpu 2>/dev/null); do \
case " $flavors " in \
(*" $flavor "*) \
[ -n "%{-x}" ] && continue ;; \
(*) \
[ -z "%{-x}" -a -n "$flavors" ] && continue ;; \
esac \
krel=$(make -s -C /usr/src/linux-obj/%_target_cpu/$flavor kernelrelease) \
krpmver_flavor=${krel/.0-rc/.rc} \
krpmver=${krpmver_flavor%%-*} \
kprovide="kernel-$flavor-$krpmver" \
khashprovide=$(rpm -q --whatprovides "$kprovide" --provides | grep "^kernel-$flavor-srchash-") \
if [ -n "$khashprovide" ]; then \
kprovide="$khashprovide" \
fi \
flavors_to_build="$flavors_to_build $flavor" \
echo "%%_suse_klp_module_subpackage -n %{-n*}%{!-n:kernel-livepatch} -r %{release} $krel $krpmver_flavor $kprovide" \
done \
echo "%%global flavors_to_build${flavors_to_build:-%%nil}" \
echo "%%{expand:%%(test -z '%flavors_to_build' && echo %%%%internal_kmp_error)}" \
echo "%%global kernel_source() /usr/src/linux-obj/%_target_cpu/%%%%{1}" \
\
echo "%package -n %{-n*}%{!-n:kernel-livepatch}-kmp-_dummy_" \
echo "Version: %version" \
echo "Summary: %summary" \
echo "Group: %group" \
echo "%description -n %{-n*}%{!-n:kernel-livepatch}-kmp-_dummy_" \
)}