Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@sandisk.com>
To: <drbd-dev@lists.linbit.com>
Subject: [Drbd-dev] [PATCH] drbd, drbd-km.spec: Port to openSuSE
Date: Fri, 4 Sep 2015 09:31:31 -0700	[thread overview]
Message-ID: <55E9C763.9050008@sandisk.com> (raw)

The package needed to build kernel modules is called kernel-default-devel
on openSuSE. The kernel-syms package is SLES specific and hence the build
fails on openSuSE. Modify the spec file such that the name of the kernel
development RPM is determined automatically. Note: if the kernel development
headers have not been installed as an RPM the %{kernel_devel_rpm} variable
is 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


                 reply	other threads:[~2015-09-11 13:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55E9C763.9050008@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=drbd-dev@lists.linbit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox