[packages/linuxrdac] - switch to macro driven module build for multiple kernel versions - rel 64

baggins baggins at pld-linux.org
Tue Oct 29 19:30:16 CET 2013


commit 593fd2495b4cc9bfd885c6abd9f1038e6379f9e5
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Tue Oct 29 19:29:30 2013 +0100

    - switch to macro driven module build for multiple kernel versions
    - rel 64

 linuxrdac.spec | 85 ++++++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 56 insertions(+), 29 deletions(-)
---
diff --git a/linuxrdac.spec b/linuxrdac.spec
index aea7e85..0a3abe9 100644
--- a/linuxrdac.spec
+++ b/linuxrdac.spec
@@ -3,12 +3,29 @@
 %bcond_without	dist_kernel	# allow non-distribution kernel
 %bcond_with	verbose		# verbose build (V=1)
 
-%define		rel	63
+%if "%{_alt_kernel}" != "%{nil}"
+%if 0%{?build_kernels:1}
+%{error:alt_kernel and build_kernels are mutually exclusive}
+exit 1
+%endif
+%global		_build_kernels		%{alt_kernel}
+%else
+%global		_build_kernels		%{?build_kernels:,%{?build_kernels}}
+%endif
+
+# nothing to be placed to debuginfo package
+%define		_enable_debug_packages	0
+
+%define		kbrs	%(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo "BuildRequires:kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2" ; done)
+%define		kpkg	%(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%kernel_pkg ; done)
+%define		bkpkg	%(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%build_kernel_pkg ; done)
+
+%define		rel	64
 %define		pname	linuxrdac
 Summary:	RDAC Multi-Path Proxy Driver for Linux
 Name:		%{pname}%{_alt_kernel}
 Version:	09.03.0C06.0452.2
-Release:	%{rel}
+Release:	%{rel}%{?_pld_builder:@%{_kernel_ver_str}}
 License:	GPLv2
 Group:		Base/Kernel
 Source0:	linuxrdac-%{version}-mktarball.dkms.tgz
@@ -17,25 +34,46 @@ Patch0:		linuxrdac-linux-2.6.39.patch
 Patch1:		linuxrdac-linux-3.4.patch
 Patch2:		linuxrdac-linux-3.7.patch
 #URL:		-
-BuildRequires:	rpmbuild(macros) >= 1.379
-%{?with_dist_kernel:BuildRequires:	kernel%{_alt_kernel}-module-build >= 3:2.6.20.2}
+BuildRequires:	rpmbuild(macros) >= 1.678
+%{?with_dist_kernel:%{expand:%kbrs}}
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
 RDAC Multi-Path Proxy Driver for Linux.
 
-%package -n kernel%{_alt_kernel}-scsi-mpprdac
-Summary:	RDAC Multi-Path Proxy Driver for Linux
-Release:	%{rel}@%{_kernel_ver_str}
-Group:		Base/Kernel
-Requires(post,postun):	/sbin/depmod
-%if %{with dist_kernel}
-%requires_releq_kernel
-Requires(postun):	%releq_kernel
-%endif
+%define	kernel_pkg()\
+%package -n kernel%{_alt_kernel}-scsi-mpprdac\
+Summary:	RDAC Multi-Path Proxy Driver for Linux\
+Release:	%{rel}@%{_kernel_ver_str}\
+Group:		Base/Kernel\
+Requires(post,postun):	/sbin/depmod\
+%if %{with dist_kernel}\
+%requires_releq_kernel\
+Requires(postun):	%releq_kernel\
+%endif\
+\
+%description -n kernel%{_alt_kernel}-scsi-mpprdac\
+RDAC Multi-Path Proxy Driver for Linux.\
+\
+%files -n kernel%{_alt_kernel}-scsi-mpprdac\
+%defattr(644,root,root,755)\
+%doc Readme.txt\
+/lib/modules/%{_kernel_ver}/kernel/drivers/scsi/*.ko*\
+\
+%post -n kernel%{_alt_kernel}-scsi-mpprdac\
+%depmod %{_kernel_ver}\
+\
+%postun -n kernel%{_alt_kernel}-scsi-mpprdac\
+%depmod %{_kernel_ver}\
+%{nil}
 
-%description -n kernel%{_alt_kernel}-scsi-mpprdac
-RDAC Multi-Path Proxy Driver for Linux.
+%define build_kernel_pkg()\
+%{__make} clean\
+%{__make} -j1 KERNEL_OBJ=%{_kernelsrcdir}\
+%install_kernel_modules -D installed -m mppVhba,mppUpper -d kernel/drivers/scsi\
+%{nil}
+
+%{expand:%kpkg}
 
 %prep
 %setup -q -c
@@ -45,24 +83,13 @@ mv dkms_source_tree/* .
 %patch2 -p1
 
 %build
-%{__make} -j1 \
-	KERNEL_OBJ=%{_kernelsrcdir}
+%{expand:%bkpkg}
 
 %install
 rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT
 
-%install_kernel_modules -m mppVhba,mppUpper -d kernel/drivers/scsi
+cp -a installed/* $RPM_BUILD_ROOT
 
 %clean
 rm -rf $RPM_BUILD_ROOT
-
-%post -n kernel%{_alt_kernel}-scsi-mpprdac
-%depmod %{_kernel_ver}
-
-%postun -n kernel%{_alt_kernel}-scsi-mpprdac
-%depmod %{_kernel_ver}
-
-%files -n kernel%{_alt_kernel}-scsi-mpprdac
-%defattr(644,root,root,755)
-%doc Readme.txt
-/lib/modules/%{_kernel_ver}/kernel/drivers/scsi/*.ko*
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/linuxrdac.git/commitdiff/593fd2495b4cc9bfd885c6abd9f1038e6379f9e5



More information about the pld-cvs-commit mailing list