[PATCH 1/2] build: adjust spec file to work with and without systemd

Jim Meyering meyering at redhat.com
Fri Mar 2 09:32:39 UTC 2012


* iwhd.spec.in: Adjust conditionals to work with both rhel and fedora:
test for 0%{?rhel}/0%{?fedora} > or >=, not <, since each is 0
when building on the other.
Remove empty %post section.
(%check): Use _smp_mflags and VERBOSE=yes.
(%files): Omit /etc/rc.d/init.d/iwhd on a systemd-using system.
---
 iwhd.spec.in |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/iwhd.spec.in b/iwhd.spec.in
index b96fa9b..4781487 100644
--- a/iwhd.spec.in
+++ b/iwhd.spec.in
@@ -31,10 +31,10 @@ BuildRequires: autoconf
 BuildRequires: automake
 BuildRequires: help2man

-%if 0%{?rhel} < 7 || 0%{?fedora} < 16
-%define _unitdir /lib/systemd/system
-%else
+%if 0%{?rhel} >= 7 || 0%{?fedora} >= 16
 BuildRequires: systemd-units
+%else
+%define _unitdir /lib/systemd/system
 %endif

 # mongodb-server is required at build time so make check succeeds
@@ -56,13 +56,11 @@ make install DESTDIR=%{buildroot}
 %find_lang %{name}

 %check
-make -s check
+make %{?_smp_mflags} check VERBOSE=yes

 %clean
 rm -rf %{buildroot}

-%post
-
 %files -f %{name}.lang
 %defattr(-,root,root,-)
 %doc AUTHORS COPYING README NEWS
@@ -70,7 +68,6 @@ rm -rf %{buildroot}
 %{_bindir}/dc-rhev-image
 %{_bindir}/dc-vmware-image
 %{_mandir}/man8/iwhd.8*
-%{_sysconfdir}/rc.d/init.d/iwhd
 %config(noreplace)	%{_sysconfdir}/iwhd/conf.js
 %config(noreplace)	%{_sysconfdir}/iwhd/users.js
 %config(noreplace)	%{_sysconfdir}/logrotate.d/iwhd
@@ -78,6 +75,12 @@ rm -rf %{buildroot}
 %{_localstatedir}/lib/iwhd
 %{_unitdir}/iwhd.service

+%if 0%{?rhel} >= 7 || 0%{?fedora} >= 16
+# nothing required here
+%else
+%{_sysconfdir}/rc.d/init.d/iwhd
+%endif
+
 %changelog
 * Wed Oct  7 2010 Jim Meyering <meyering at redhat.com> - 0.90-1
 - Initial release.
--
1.7.9.2.324.g1221




More information about the iwhd-devel mailing list