Split kernel module macros to a separate file
This commit is contained in:
parent
188c86566f
commit
0e6d36bee9
60
macros
60
macros
@ -189,66 +189,6 @@ package or when debugging this package.\
|
||||
%__global_cflags -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches %{_hardened_cflags}
|
||||
%__global_ldflags -Wl,-z,relro %{_hardened_ldflags}
|
||||
|
||||
# Use these macros to differentiate between RH and other KMP implementation(s).
|
||||
redhat_kernel_module_package 1
|
||||
kernel_module_package_release 1
|
||||
|
||||
#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:%( \
|
||||
%define kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
|
||||
%define kmp_version %{-v*}%{!-v:%{version}} \
|
||||
%define kmp_release %{-r*}%{!-r:%{release}} \
|
||||
%define latest_kernel %(rpm -q --qf '%{VERSION}-%{RELEASE}\\\\n' `rpm -q kernel-devel | /usr/lib/rpm/redhat/rpmsort -r | head -n 1` | head -n 1) \
|
||||
%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
|
||||
%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
|
||||
flavors="default" \
|
||||
if [ "i686" == "%{_target_cpu}" ] || [ "x86_64" == "%{_target_cpu}" ] \
|
||||
then \
|
||||
xenver=$(rpm -q kernel-xen-devel-%{kverrel}|head -n 1)\
|
||||
kdver=$(rpm -q kernel-kdump-devel-%{kverrel}|head -n 1)\
|
||||
if [ "kernel-xen-devel-%{kverrel}" == "$xenver" ] \
|
||||
then \
|
||||
flavors="$flavors xen" \
|
||||
fi \
|
||||
if [ "kernel-kdump-devel-%{kverrel}" == "$kdver" ] \
|
||||
then \
|
||||
flavors="$flavors kdump" \
|
||||
fi \
|
||||
fi \
|
||||
if [ -z "%*" ]; then \
|
||||
flavors_to_build=$flavors \
|
||||
elif [ -z "%{-x}" ]; then \
|
||||
flavors_to_build="%*" \
|
||||
else \
|
||||
flavors_to_build=" $flavors "\
|
||||
echo "[$flavors_to_build]" >/tmp/tmp.txt
|
||||
for i in %* \
|
||||
do \
|
||||
flavors_to_build=${flavors_to_build//$i /}
|
||||
done \
|
||||
fi \
|
||||
echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
|
||||
echo "%%global kernel_source() /usr/src/kernels/%kverrel-\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")%_target_cpu" \
|
||||
if [ ! -z "%{-f*}" ] \
|
||||
then \
|
||||
filelist="%{-f*}" \
|
||||
fi \
|
||||
if [ ! -z "%{-p*}" ] \
|
||||
then \
|
||||
preamble="%{-p*}" \
|
||||
fi \
|
||||
if [ -z "%{kmodtool_generate_buildreqs}" ] \
|
||||
then \
|
||||
nobuildreqs="yes" \
|
||||
fi \
|
||||
kmp_override_filelist="$filelist" kmp_override_preamble="$preamble" kmp_nobuildreqs="$buildreqs" %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
|
||||
)}
|
||||
|
||||
#==============================================================================
|
||||
# ---- Generic auto req/prov filtering macros
|
||||
#
|
||||
|
60
macros.kmp
Normal file
60
macros.kmp
Normal file
@ -0,0 +1,60 @@
|
||||
# Use these macros to differentiate between RH and other KMP implementation(s).
|
||||
redhat_kernel_module_package 1
|
||||
kernel_module_package_release 1
|
||||
|
||||
#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:%( \
|
||||
%define kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
|
||||
%define kmp_version %{-v*}%{!-v:%{version}} \
|
||||
%define kmp_release %{-r*}%{!-r:%{release}} \
|
||||
%define latest_kernel %(rpm -q --qf '%{VERSION}-%{RELEASE}\\\\n' `rpm -q kernel-devel | /usr/lib/rpm/redhat/rpmsort -r | head -n 1` | head -n 1) \
|
||||
%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
|
||||
%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
|
||||
flavors="default" \
|
||||
if [ "i686" == "%{_target_cpu}" ] || [ "x86_64" == "%{_target_cpu}" ] \
|
||||
then \
|
||||
xenver=$(rpm -q kernel-xen-devel-%{kverrel}|head -n 1)\
|
||||
kdver=$(rpm -q kernel-kdump-devel-%{kverrel}|head -n 1)\
|
||||
if [ "kernel-xen-devel-%{kverrel}" == "$xenver" ] \
|
||||
then \
|
||||
flavors="$flavors xen" \
|
||||
fi \
|
||||
if [ "kernel-kdump-devel-%{kverrel}" == "$kdver" ] \
|
||||
then \
|
||||
flavors="$flavors kdump" \
|
||||
fi \
|
||||
fi \
|
||||
if [ -z "%*" ]; then \
|
||||
flavors_to_build=$flavors \
|
||||
elif [ -z "%{-x}" ]; then \
|
||||
flavors_to_build="%*" \
|
||||
else \
|
||||
flavors_to_build=" $flavors "\
|
||||
echo "[$flavors_to_build]" >/tmp/tmp.txt
|
||||
for i in %* \
|
||||
do \
|
||||
flavors_to_build=${flavors_to_build//$i /}
|
||||
done \
|
||||
fi \
|
||||
echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
|
||||
echo "%%global kernel_source() /usr/src/kernels/%kverrel-\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")%_target_cpu" \
|
||||
if [ ! -z "%{-f*}" ] \
|
||||
then \
|
||||
filelist="%{-f*}" \
|
||||
fi \
|
||||
if [ ! -z "%{-p*}" ] \
|
||||
then \
|
||||
preamble="%{-p*}" \
|
||||
fi \
|
||||
if [ -z "%{kmodtool_generate_buildreqs}" ] \
|
||||
then \
|
||||
nobuildreqs="yes" \
|
||||
fi \
|
||||
kmp_override_filelist="$filelist" kmp_override_preamble="$preamble" kmp_nobuildreqs="$buildreqs" %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
|
||||
)}
|
||||
|
@ -34,6 +34,7 @@ Source104: macros.ocaml-srpm
|
||||
|
||||
# Other misc macros
|
||||
Source150: macros.dwz
|
||||
Source151: macros.kmp
|
||||
|
||||
# Build policy scripts
|
||||
Source200: brp-compress
|
||||
@ -127,10 +128,12 @@ install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.*
|
||||
%{rrcdir}/find-requires.ksyms
|
||||
%{rrcdir}/find-provides.d/firmware.prov
|
||||
%{rrcdir}/find-provides.d/modalias.prov
|
||||
%{_rpmconfigdir}/macros.d/macros.kmp
|
||||
|
||||
%changelog
|
||||
* Mon Apr 07 2014 Panu Matilainen <pmatilai@redhat.com> - 12-1
|
||||
- Be more explicit about the package contents
|
||||
- Split kernel module macros to a separate file
|
||||
|
||||
* Wed Apr 02 2014 Panu Matilainen <pmatilai@redhat.com> - 11-1
|
||||
- Stop pretending this package is relocatable, its not
|
||||
|
Loading…
Reference in New Issue
Block a user