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

baggins baggins at pld-linux.org
Tue Oct 29 12:53:39 CET 2013


commit d7fb0fa18a54ce922ad7af7aaddba30df9c82dc3
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Tue Oct 29 12:53:14 2013 +0100

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

 lin_tape.spec | 91 +++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 58 insertions(+), 33 deletions(-)
---
diff --git a/lin_tape.spec b/lin_tape.spec
index 62a759a..f8a813c 100644
--- a/lin_tape.spec
+++ b/lin_tape.spec
@@ -2,13 +2,30 @@
 # Conditional build:
 %bcond_without	dist_kernel	# allow non-distribution kernel
 %bcond_with	verbose		# verbose build (V=1)
-#
-%define		rel	7
+
+%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	8
 %define		pname	lin_tape
 Summary:	IBM Tape SCSI Device Driver for Linux
 Name:		%{pname}%{_alt_kernel}
 Version:	2.1.0
-Release:	%{rel}
+Release:	%{rel}%{?_pld_builder:@%{_kernel_ver_str}}
 License:	GPL v2/LGPL
 Group:		Base/Kernel
 Source0:	%{pname}-%{version}.tgz
@@ -17,8 +34,8 @@ Patch0:		use-module-dir.patch
 Patch1:		linux-3.10.patch
 # System Storage, Tape systems, Tape drivers and software, Tape device drivers (Linux)
 URL:		http://www.ibm.com/support/fixcentral/
-%{?with_dist_kernel:BuildRequires:	kernel%{_alt_kernel}-module-build >= 3:2.6.20.2}
-BuildRequires:	rpmbuild(macros) >= 1.379
+BuildRequires:	rpmbuild(macros) >= 1.678
+%{?with_dist_kernel:%{expand:%kbrs}}
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -26,27 +43,45 @@ The IBM Tape Device Driver, lin_tape, product is a device driver that
 provides attachment for the IBM TotalStorage and System Storage tape
 devices to Linux compatible platforms.
 
-%package -n kernel%{_alt_kernel}-scsi-lin_tape
-Summary:	IBM Tape SCSI Device 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-lin_tape\
+Summary:	IBM Tape SCSI Device 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-lin_tape\
+The IBM Tape Device Driver is a device driver that provides attachment\
+for the IBM TotalStorage and System Storage tape devices to Linux\
+compatible platforms.\
+\
+%post	-n kernel%{_alt_kernel}-scsi-lin_tape\
+%depmod %{_kernel_ver}\
+\
+%postun	-n kernel%{_alt_kernel}-scsi-lin_tape\
+%depmod %{_kernel_ver}\
+\
+%files -n kernel%{_alt_kernel}-scsi-lin_tape\
+%defattr(644,root,root,755)\
+%doc lin_tape.fixlist lin_tape_Ultrium.ReadMe lin_tape_359X.ReadMe\
+/lib/modules/%{_kernel_ver}/kernel/drivers/scsi/lin_tape.ko*\
+%{nil}
 
-%description -n kernel%{_alt_kernel}-scsi-lin_tape
-The IBM Tape Device Driver is a device driver that provides attachment
-for the IBM TotalStorage and System Storage tape devices to Linux
-compatible platforms.
+%define build_kernel_pkg()\
+%build_kernel_modules -m lin_tape\
+%install_kernel_modules -D installed -m lin_tape -d kernel/drivers/scsi\
+%{nil}
+
+%{expand:%kpkg}
 
 %prep
 %setup -q -n %{pname}-%{version}
 %patch0 -p1
-%if "%{_alt_kernel}" == "%{nil}"
 %patch1 -p1
-%endif
 %ifarch %ix86 ia64
 proc="Intel"
 %endif
@@ -67,23 +102,13 @@ proc="zSeries"
 %{__cp} -af Makefile.GPL Makefile
 
 %build
-%build_kernel_modules -m lin_tape
+%{expand:%bkpkg}
 
 %install
 rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT
 
-%install_kernel_modules -m lin_tape -d kernel/drivers/scsi
+cp -a installed/* $RPM_BUILD_ROOT
 
 %clean
 rm -rf $RPM_BUILD_ROOT
-
-%post	-n kernel%{_alt_kernel}-scsi-lin_tape
-%depmod %{_kernel_ver}
-
-%postun	-n kernel%{_alt_kernel}-scsi-lin_tape
-%depmod %{_kernel_ver}
-
-%files -n kernel%{_alt_kernel}-scsi-lin_tape
-%defattr(644,root,root,755)
-%doc lin_tape.fixlist lin_tape_Ultrium.ReadMe lin_tape_359X.ReadMe
-/lib/modules/%{_kernel_ver}/kernel/drivers/scsi/lin_tape.ko*
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lin_tape.git/commitdiff/d7fb0fa18a54ce922ad7af7aaddba30df9c82dc3



More information about the pld-cvs-commit mailing list