Skip to contentSkip to conversation

drbd-km.spec: Port to openSuSE

PATCH In review Bart Van Assche 2 participants 2 messages Sep 10, 2015 – Sep 11, 2015 DRBD driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drbd-km.spec: Port to openSuSE

Currently building an RPM with the drbd-km.spec fails on openSuSE because of an incorrect build dependency (kernel-syms instead of kernel-default-devel). Fix the algorithm in the spec file for determining the kernel development RPM name. Note: if the kernel development headers have not been installed as an RPM the %{kernel_devel_rpm} variable will be empty.

This patch has been tested on openSuSE 13.2, CentOS 7.1 and SLES11 SP3.

---
 drbd-km.spec | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drbd-km.spec +9 -3
index e5ad36b..a738b58 100644
@@ -3,6 +3,14 @@
 # PLEASE: provide both (correctly) or none!!
 %{!?kernelversion: %{expand: %%define kernelversion %(uname -r)}}
 %{!?kdir: %{expand: %%define kdir /lib/modules/%(uname -r)/build}}
+%define kernel_devel_rpm %{expand:%%(rpm -q --quiet -f %{kdir}/ 2>/dev/null &&
+          rpm -q --qf '%%%%{name}\\n' -f %{kdir}/ | uniq)}
+%{echo:kernelversion=%{kernelversion}
+}
+%{echo:kdir=%{kdir}
+}
+%{echo:kernel_devel_rpm=%{kernel_devel_rpm}
+}
 
 # encode - to _ to be able to include that in a package name or release "number"
 %global krelver  %(echo %{kernelversion} | tr -s '-' '_')
@@ -17,9 +25,7 @@ ExclusiveOS: linux
 Group: System Environment/Kernel
 URL: http://www.drbd.org/
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-BuildRequires: gcc
-%(test -e /etc/redhat-release && echo BuildRequires: kernel-devel)
-%(test -e /etc/SuSE-release && echo BuildRequires: kernel-syms)
+BuildRequires: gcc %{kernel_devel_rpm}
 
 %description
 DRBD mirrors a block device over the network to another machine.
Signature · 1 line
2.1.4
maintainer
#1 lore raw
Quoted 8 lines · Bart Van Assche

Currently building an RPM with the drbd-km.spec fails on openSuSE because of an incorrect build dependency (kernel-syms instead of kernel-default-devel). Fix the algorithm in the spec file for determining the kernel development RPM name. Note: if the kernel development headers have not been installed as an RPM the %{kernel_devel_rpm} variable will be empty.

This patch has been tested on openSuSE 13.2, CentOS 7.1 and SLES11 SP3.

You are not supposed to build a "drbd-km" from "drbd-km.spec",
you are supposed to build a kmod-drbd (resp. drbd-kmp) from "drbd-kernel.spec", using the kernel module build "magic" of the respective ditribution. (not "make km-rpm", but "make kmp-rpm")

But thanks ;-)

Lars