[packages/test/newkernel: 3/3] - proof of concept building multiple kernel packages from same spec at the same time

baggins baggins at pld-linux.org
Sun Oct 20 22:07:05 CEST 2013


commit 5e2aabf740e6b681260d03e7b6f441f5ff15b855
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sun Oct 20 22:06:05 2013 +0200

    - proof of concept building multiple kernel packages from same spec at the same time

 test.spec | 106 ++++++++++++++++++++++++++++++++++----------------------------
 1 file changed, 59 insertions(+), 47 deletions(-)
---
diff --git a/test.spec b/test.spec
index 0ab7f6c..1da3891 100644
--- a/test.spec
+++ b/test.spec
@@ -1,56 +1,73 @@
+# Module for kernels <2.6.24
+#
+# Conditional build:
+%bcond_without	dist_kernel	# allow non-distribution kernel
+%bcond_without	kernel		# don't build kernel modules
+%bcond_with	verbose		# verbose build (V=1)
 
-%define		kpkg	%(echo %{ksa} | tr , '\\n' | while read n ; do echo %%pkg $n; done)
-
-Summary:	testing something
-Name:		test
-Version:	1
-Release:	0.1
-License:	GPL
-Group:		Applications/System
-URL:		http://www.pld-linux.org/
-BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+%if %{without kernel}
+%undefine with_dist_kernel
+%endif
 
-%define	kernel_pkg()\
-%package -n kernel%{_alt_kernel}-net-%{pname} %1\
-Summary:	Intel(R) PRO/1000e driver for Linux
-Summary(pl.UTF-8):	Sterownik do karty Intel® PRO/1000e
-Release:	%{rel}@%{_kernel_ver_str}
-Group:		Base/Kernel
-Requires(post,postun):	/sbin/depmod
-%if %{with dist_kernel}
-%requires_releq_kernel
-Requires(postun):	%releq_kernel
+%if "%{_alt_kernel}" != "%{nil}"
+%if 0%{?build_kernels:1}
+Error: alt_kernel and build_kernels are mutually exclusive
+%endif
+%undefine	with_userspace
+%define		_build_kernels		%{alt_kernel}
+%else
+%define		_build_kernels		NIL%{?build_kernels:,%{?build_kernels}}
 %endif
 
-%description -n kernel%{_alt_kernel}-net-%{pname}
-This package contains the Linux driver for the Intel(R) PRO/1000
-family of 10/100/1000 Ethernet network adapters. This driver is
-designed to work with the Intel(R) 82571/2/3/4 PCI-E family of gigabit
-adapters and 82567 controllers.
+%define		kpkg	%(echo %{_build_kernels} | tr , '\\n' | while read n ; do if [ $n = NIL ]; then echo %%undefine alt_kernel ; else echo %%define alt_kernel $n ; fi ; echo %%kernel_pkg; done)
+%define		bkpkg	%(echo %{_build_kernels} | tr , '\\n' | while read n ; do if [ $n = NIL ]; then echo %%undefine alt_kernel ; else echo %%define alt_kernel $n ; fi ; echo %%build_kernel_pkg; done)
 
-%description -n kernel%{_alt_kernel}-net-%{pname} -l pl.UTF-8
-Ten pakiet zawiera sterownik dla Linuksa do kart sieciowych
-10/100/1000Mbit z rodziny Intel® PRO/1000. Ten sterownik jest
-stworzony aby pracować z kartami gigabitowymi rodziny Intel®
-82571/2/3/4 PCI-E oraz kontrolerami 82567.
+%define		rel	0.1
+%define		pname	test
 
-Summary:	Munin plugins from MuninExchange - %1\
-Summary(pl.UTF-8):	Wtyczki munina z MuninExchange - %1\
-Group:		Daemons\
-Requires:	munin-node\
+%define	kernel_pkg()\
+%package -n kernel%{_alt_kernel}-net-%{pname}\
+Summary:	Intel(R) PRO/1000e driver for Linux %{_kernelsrcdir}:%{__kernel_rpmvr}\
+Summary(pl.UTF-8):	Sterownik do karty Intel® PRO/1000e\
+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 %1\
-This package contains plugins for Munin from MuninExchange repository\
-located at <https://github.com/munin-monitoring/contrib/>.\
+%description -n kernel%{_alt_kernel}-net-%{pname}\
+This package contains the Linux driver for the Intel(R) PRO/1000\
+family of 10/100/1000 Ethernet network adapters. This driver is\
+designed to work with the Intel(R) 82571/2/3/4 PCI-E family of gigabit\
+adapters and 82567 controllers.\
 \
-%description %1 -l pl.UTF-8\
-Ten pakiet zawera wtyczki dla Munina z repozytorium MuninExchange,\
-znajdującym się na <https://github.com/munin-monitoring/contrib/>.\
+%description -n kernel%{_alt_kernel}-net-%{pname} -l pl.UTF-8\
+Ten pakiet zawiera sterownik dla Linuksa do kart sieciowych\
+10/100/1000Mbit z rodziny Intel® PRO/1000. Ten sterownik jest\
+stworzony aby pracować z kartami gigabitowymi rodziny Intel®\
+82571/2/3/4 PCI-E oraz kontrolerami 82567.\
 \
-%files %1 -f %1.list\
+%files -n kernel%{_alt_kernel}-net-%{pname} -f kernel%{_alt_kernel}-net-%{pname}.list\
 %defattr(755,root,root,755)\
 %{nil}
 
+%define build_kernel_pkg()\
+echo %{_kernelsrcdir}\
+touch kernel%{_alt_kernel}-net-%{pname}.list\
+%{nil}
+
+Summary:	testing something
+Name:		%{pname}
+Version:	1
+Release:	%{rel}
+License:	GPL
+Group:		Applications/System
+URL:		http://www.pld-linux.org/
+#BuildRequires:	rpm-build-macros >= 1.676
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
 %description
 testing something
 
@@ -63,12 +80,7 @@ testing something
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT
 
-touch a.list b.list c.list
-
-%define _alt_kernel    xxx
-echo %{_kernelsrcdir}
-%define _alt_kernel    zzz
-echo %{_kernelsrcdir}
+%{expand:%bkpkg}
 
 %clean
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/test.git/commitdiff/5e2aabf740e6b681260d03e7b6f441f5ff15b855



More information about the pld-cvs-commit mailing list