I've updated kernel_module_package again.

This commit is contained in:
Jon Masters 2006-10-18 00:23:15 +00:00
parent e53623e26d
commit 141cba90d8
3 changed files with 100 additions and 35 deletions

View File

@ -28,7 +28,7 @@ shopt -s extglob
myprog="kmodtool" myprog="kmodtool"
myver="0.10.10_kmp2" myver="0.10.10_kmp2"
knownvariants=@(BOOT|PAE|@(big|huge)mem|debug|enterprise|kdump|?(large)smp|uml|xen[0U]?(-PAE)) knownvariants=@(BOOT|PAE|@(big|huge)mem|debug|enterprise|kdump|?(large)smp|uml|xen[0U]?(-PAE)|xen)
kmod_name= kmod_name=
kver= kver=
verrel= verrel=
@ -66,14 +66,25 @@ get_rpmtemplate ()
local variant="${1}" local variant="${1}"
local dashvariant="${variant:+-${variant}}" local dashvariant="${variant:+-${variant}}"
case "$verrel" in case "$verrel" in
*.el*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;;
*.EL*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;; *.EL*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;;
*) kdep="kernel-%{_target_cpu} = ${verrel}${variant}" ;; *) kdep="kernel-%{_target_cpu} = ${verrel}${variant}" ;;
esac esac
cat <<EOF
%package -n kmod-${kmod_name}${dashvariant} echo "%package -n kmod-${kmod_name}${dashvariant}"
Summary: ${kmod_name} kernel module(s)
Group: System Environment/Kernel if [ -z "$kmp_provides_summary" ]; then
EOF echo "Summary: ${kmod_name} kernel module(s)"
fi
if [ -z "$kmp_provides_group" ]; then
echo "Group: System Environment/Kernel"
fi
if [ ! -z "$kmp" ]; then
echo "Version: %{kmp_version}"
echo "Release: %{kmp_release}"
fi
if [ ! -z "$kmp" ]; then if [ ! -z "$kmp" ]; then
echo "%global _use_internal_dependency_generator 0" echo "%global _use_internal_dependency_generator 0"
@ -93,6 +104,14 @@ Requires: ${kmod_name}-kmod-common >= %{?epoch:%{epoch}:}%{version}
Requires(post): /sbin/depmod Requires(post): /sbin/depmod
Requires(postun): /sbin/depmod Requires(postun): /sbin/depmod
BuildRequires: kernel${dashvariant}-devel-%{_target_cpu} = ${verrel} BuildRequires: kernel${dashvariant}-devel-%{_target_cpu} = ${verrel}
EOF
if [ "" != "$kmp_override_preamble" ]
then
cat "$kmp_override_preamble"
fi
cat <<EOF
%description -n kmod-${kmod_name}${dashvariant} %description -n kmod-${kmod_name}${dashvariant}
This package provides the ${kmod_name} kernel modules built for the Linux This package provides the ${kmod_name} kernel modules built for the Linux
kernel ${verrel}${variant} for the %{_target_cpu} family of processors. kernel ${verrel}${variant} for the %{_target_cpu} family of processors.
@ -132,11 +151,15 @@ fi
EOF EOF
fi fi
cat <<EOF echo "%files -n kmod-${kmod_name}${dashvariant}"
%files -n kmod-${kmod_name}${dashvariant}
%defattr(644,root,root,755) if [ "" == "$kmp_override_filelist" ];
/lib/modules/${verrel}${variant}/ then
EOF echo "%defattr(644,root,root,755)"
echo "/lib/modules/${verrel}${variant}/"
else
cat "$kmp_override_filelist"
fi
} }
print_rpmtemplate () print_rpmtemplate ()

View File

@ -1,27 +1,49 @@
--- redhat-rpm-config-8.0.45/macros 2005-08-16 20:27:33.000000000 -0400 diff -urN redhat-rpm-config-8.0.45_orig/macros redhat-rpm-config-8.0.45/macros
+++ redhat-rpm-config-8.0.45_wip/macros 2006-10-16 16:52:35.000000000 -0400 --- redhat-rpm-config-8.0.45_orig/macros 2005-08-16 20:27:33.000000000 -0400
@@ -156,3 +157,44 @@ +++ redhat-rpm-config-8.0.45/macros 2006-10-17 20:15:08.000000000 -0400
@@ -156,3 +157,82 @@
# Disable lookups # Disable lookups
%_hkp_keyserver %{nil} %_hkp_keyserver %{nil}
+ +
+# kernel_source kversion kflavor +%ktest() %{expand:%( \
+%kernel_source(v:f:) %{expand:%( \ + echo "%1" \
+ if [ "default" = "%{-f*}" ]
+ then
+ echo "/usr/src/kernels/%{-v*}-%{_target_cpu}"
+ else
+ echo "/usr/src/kernels/%{-v*}-%{-f*}-%{_target_cpu}"
+ fi
+)} +)}
+ +
+%kmodtool /usr/lib/rpm/redhat/kmodtool +# kernel_source kversion kflavor
+%old_kernel_source() %{expand:%( \
+ if [ "default" == "%2" ] \
+ then \
+ echo "/usr/src/kernels/%1-%{_target_cpu}" \
+ else \
+ echo "/usr/src/kernels/%1-%2-%{_target_cpu}" \
+ fi \
+)}
+ +
+# kernel_module_package [ -n name ] +# 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_script kernel_source() { \
+ if [ "default" == "$1" ]; then \
+ echo "/usr/src/kernels/%kverrel-%{_target_cpu}" ; \
+ else \
+ echo "/usr/src/kernels/%kverrel-$1-%{_target_cpu}" ; \
+ fi }
+ +
+%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \ +%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \
+ %global __spec_prep_pre %{__spec_prep_pre};%{kernel_module_script}
+ %global __spec_build_pre %{__spec_build_pre};%{kernel_module_script}
+ %global __spec_install_pre %{__spec_install_pre};%{kernel_module_script}
+ %define kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
+ %define kmp_version %{-v*}%{!-v:%{version}} \
+ %define kmp_release %{-r*}%{!-r:%{release}} \
+ machine=`uname -m` \ + machine=`uname -m` \
+ %{!?kversion: %{expand: %%define kversion %(uname -r)}} \ + %{!?kversion: %{expand: %%global kversion %(uname -r)}} \
+ %global kverrel %(%{kmodtool} verrel %{?kversion} 2>/dev/null) \
+ flavors="default" \ + flavors="default" \
+ if [ "i686" == "$machine" ] \ + if [ "i686" == "$machine" ] \
+ then + then
@ -29,19 +51,36 @@
+ fi + fi
+ if [ "i686" == "$machine" ] || [ "x86_64" == "$machine" ] \ + if [ "i686" == "$machine" ] || [ "x86_64" == "$machine" ] \
+ then \ + then \
+ xenver=$(rpm -q --qf '%{VERSION}-%{RELEASE}' kernel-xen-devel)\ + xenver=$(rpm -q kernel-xen-devel-%{kverrel}|head -n 1)\
+ kdver=$(rpm -q --qf '%{VERSION}-%{RELEASE}' kernel-kdump-devel)\ + kdver=$(rpm -q kernel-kdump-devel-%{kverrel}|head -n 1)\
+ if [ "$kversion" == "$xenver" ] \ + if [ "kernel-xen-devel-%{kverrel}" == "$xenver" ] \
+ then \ + then \
+ flavors="$flavors xen0" \ + flavors="$flavors xen" \
+ fi \ + fi \
+ if [ "$kversion" == "$kdver" ] \ + if [ "kernel-kdump-devel-%{kverrel}" == "$kdver" ] \
+ then \ + then \
+ flavors="$flavors kdump" \ + flavors="$flavors kdump" \
+ fi \ + fi \
+ fi \ + fi \
+ if [ -z "%*" ]; then \
+ flavors_to_build=$flavors \ + 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}" \ + echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
+ %define kverrel %(%{kmodtool} verrel %{?kversion} 2>/dev/null) \ + if [ ! -z "%{-f*}" ] \
+ %{kmodtool} rpmtemplate_kmp %{-n*} %{kverrel} $flavors_to_build 2>/dev/null \ + then \
+ filelist="%{-f*}" \
+ fi \
+ if [ ! -z "%{-p*}" ] \
+ then \
+ preamble="%{-p*}" \
+ fi \
+ kmp_override_filelist="$filelist" kmp_override_preamble="$preamble" %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
+)} +)}

View File

@ -1,7 +1,7 @@
Summary: Red Hat specific rpm configuration files. Summary: Red Hat specific rpm configuration files.
Name: redhat-rpm-config Name: redhat-rpm-config
Version: 8.0.45 Version: 8.0.45
Release: 9 Release: 10%{dist}
License: GPL License: GPL
Group: Development/System Group: Development/System
Source: redhat-rpm-config-%{version}.tar.gz Source: redhat-rpm-config-%{version}.tar.gz
@ -46,6 +46,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_prefix}/lib/rpm/redhat %{_prefix}/lib/rpm/redhat
%changelog %changelog
* Tue Oct 17 2006 Jon Masters <jcm@redhat.com> 8.0.45-10
- Updated kernel_module_package.
* Mon Oct 16 2006 Jon Masters <jcm@redhat.com> 8.0.45-9 * Mon Oct 16 2006 Jon Masters <jcm@redhat.com> 8.0.45-9
- Added kernel_module_package macro. Working on unified packaging. - Added kernel_module_package macro. Working on unified packaging.