[projects/template-specs] - use new macros for multi kernel builds - drop non-dist kernel support for building modules
baggins
baggins at pld-linux.org
Sun Dec 14 13:16:40 CET 2014
commit d3b4d5e6abe5f3cbe9b9dce609bf2f5e40a28061
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Sun Dec 14 13:16:12 2014 +0100
- use new macros for multi kernel builds
- drop non-dist kernel support for building modules
kernel-module.spec | 48 ++++++++++++------------------------------------
1 file changed, 12 insertions(+), 36 deletions(-)
---
diff --git a/kernel-module.spec b/kernel-module.spec
index 5739310..0322e2a 100644
--- a/kernel-module.spec
+++ b/kernel-module.spec
@@ -5,45 +5,23 @@
# PACKAGE_NAME with package name
#
# Conditional build:
-%bcond_without dist_kernel # allow non-distribution kernel
%bcond_without kernel # don't build kernel modules
%bcond_without userspace # don't build userspace programs
%bcond_with verbose # verbose build (V=1)
-%if %{without kernel}
-%undefine with_dist_kernel
+%if "%{?alt_kernel}" != "" && 0%{?build_kernels:1}
+ %{error:alt_kernel (%{?alt_kernel}) and build_kernels (%{?build_kernels}) defined}
%endif
-# The goal here is to have main, userspace, package built once with
-# simple release number, and only rebuild kernel packages with kernel
-# version as part of release number, without the need to bump release
-# with every kernel change.
%if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
%{error:kernel and userspace cannot be built at the same time on PLD builders}
exit 1
%endif
-%if "%{_alt_kernel}" != "%{nil}"
-%if 0%{?build_kernels:1}
-%{error:alt_kernel and build_kernels are mutually exclusive}
-exit 1
-%endif
-%undefine with_userspace
-%global _build_kernels %{alt_kernel}
-%else
-%global _build_kernels %{?build_kernels:,%{?build_kernels}}
-%endif
-
%if %{without userspace}
# nothing to be placed to debuginfo package
%define _enable_debug_packages 0
%endif
-
-%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 ikpkg %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%install_kernel_pkg ; done)
-
#
# main package.
#
@@ -62,8 +40,8 @@ Source0: %{pname}-%{version}.tar.gz
# Source1-md5: -
#Patch0: %{pname}-what.patch
#URL: -
-BuildRequires: rpmbuild(macros) >= 1.678
-%{?with_dist_kernel:%{expand:%kbrs}}
+BuildRequires: rpmbuild(macros) >= 1.701
+%{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}}
#BuildRequires: -
#Requires(postun): -
#Requires(pre,post): -
@@ -87,10 +65,8 @@ Summary(pl.UTF-8): Sterownik dla Linuksa do MODULE_NAME\
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}-MODULE_DIR-MODULE_NAME\
This is driver for MODULE_NAME for Linux.\
@@ -154,7 +130,7 @@ alias MODULE_NAME MODULE_NAME-current\
EOF\
%{nil}
-%{?with_kernel:%{expand:%kpkg}}
+%{?with_kernel:%{expand:%create_kernel_packages}}
%prep
%setup -q -n %{pname}-%{version}
@@ -174,25 +150,25 @@ CFLAGS += -DCONFIG_MODULE_NAME_SOME_OPTION=1
EOF
%build
+%{?with_kernel:%{expand:%build_kernel_packages}}
+
%if %{with userspace}
%endif
-%{?with_kernel:%{expand:%bkpkg}}
-
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT
-%if %{with userspace}
-
-%endif
-
%if %{with kernel}
-%{expand:%ikpkg}
+%{expand:%install_kernel_packages}
cp -a installed/* $RPM_BUILD_ROOT
%endif
+%if %{with userspace}
+
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/template-specs.git/commitdiff/d3b4d5e6abe5f3cbe9b9dce609bf2f5e40a28061
More information about the pld-cvs-commit
mailing list