All of lore.kernel.org
 help / color / mirror / Atom feed
* [Drbd-dev] [PATCH] drbd-km.spec: Port to openSuSE
@ 2015-09-10 17:33 Bart Van Assche
  2015-09-11 12:44 ` Lars Ellenberg
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2015-09-10 17:33 UTC (permalink / raw)
  To: drbd-dev

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.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
---
 drbd-km.spec | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drbd-km.spec b/drbd-km.spec
index e5ad36b..a738b58 100644
--- a/drbd-km.spec
+++ b/drbd-km.spec
@@ -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.
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-11 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-10 17:33 [Drbd-dev] [PATCH] drbd-km.spec: Port to openSuSE Bart Van Assche
2015-09-11 12:44 ` Lars Ellenberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.