Blame SOURCES/macros.kmp

67e50c
# Use these macros to differentiate between RH and other KMP implementation(s).
67e50c
redhat_kernel_module_package	1
67e50c
kernel_module_package_release	1
67e50c
67e50c
%__find_provides        /usr/lib/rpm/redhat/find-provides
67e50c
%__find_requires        /usr/lib/rpm/redhat/find-requires
67e50c
67e50c
#kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ]
67e50c
#                      [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ...
67e50c
67e50c
%kernel_module_package_buildreqs	%global kmodtool_generate_buildreqs 1 \
67e50c
					kernel-devel
67e50c
67e50c
%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \
67e50c
	%define kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
67e50c
	%define kmp_version %{-v*}%{!-v:%{version}} \
67e50c
	%define kmp_release %{-r*}%{!-r:%{release}} \
67e50c
	%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) \
67e50c
	%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
67e50c
	%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
67e50c
	flavors="default" \
67e50c
	if [ "i686" == "%{_target_cpu}" ] || [ "x86_64" == "%{_target_cpu}" ] \
67e50c
	then \
67e50c
		xenver=$(rpm -q kernel-xen-devel-%{kverrel}|head -n 1)\
67e50c
		kdver=$(rpm -q kernel-kdump-devel-%{kverrel}|head -n 1)\
67e50c
		if [ "kernel-xen-devel-%{kverrel}" == "$xenver" ] \
67e50c
		then \
67e50c
			flavors="$flavors xen" \
67e50c
		fi \
67e50c
		if [ "kernel-kdump-devel-%{kverrel}" == "$kdver" ] \
67e50c
		then \
67e50c
			flavors="$flavors kdump" \
67e50c
		fi \
67e50c
	fi \
67e50c
	if [ -z "%*" ]; then \
67e50c
		flavors_to_build=$flavors \
67e50c
	elif [ -z "%{-x}" ]; then \
67e50c
		flavors_to_build="%*" \
67e50c
	else \
67e50c
		flavors_to_build=" $flavors "\
67e50c
		echo "[$flavors_to_build]" >/tmp/tmp.txt
67e50c
		for i in %* \
67e50c
		do \
67e50c
			flavors_to_build=${flavors_to_build//$i /}
67e50c
		done \
67e50c
	fi \
67e50c
	echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
67e50c
	echo "%%global kernel_source() /usr/src/kernels/%kverrel.\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")%_target_cpu" \
67e50c
	if [ ! -z "%{-f*}" ] \
67e50c
	then \
67e50c
		filelist="%{-f*}" \
67e50c
	fi \
67e50c
	if [ ! -z "%{-p*}" ] \
67e50c
	then \
67e50c
		preamble="%{-p*}" \
67e50c
	fi \
67e50c
	nobuildreqs="yes" \
67e50c
	if [ "x%{kmodtool_generate_buildreqs}" != "x1" ] \
67e50c
	then \
67e50c
		nobuildreqs="no" \
67e50c
	fi \
67e50c
	kmp_override_filelist="$filelist" kmp_override_preamble="$preamble" kmp_nobuildreqs="$nobuildreqs" %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
67e50c
)}