Add support for openSUSE in the RPM spec 14/68114/7
authorManuel Buil <mbuil@suse.com>
Fri, 9 Feb 2018 16:04:39 +0000 (17:04 +0100)
committerDaniel Farrell <dfarrell@redhat.com>
Fri, 2 Mar 2018 00:18:27 +0000 (19:18 -0500)
openSUSE support is required to run ODL in XCI-OPNFV. RPM installs in
openSUSE fail because the dependencies listed in the spec file have
different names. Conditionally require the right names based on OS.

Change-Id: Idafe9a3656820f96553c2e4d53c1c15c992d681c
Signed-off-by: Manuel Buil <mbuil@suse.com>
packages/rpm/specs/opendaylight.spec

index ecafdc3b934d71e60d4a2a45acd6fc1110bbccab..c43e23b1d5e740ac097d12e9fdcc770a18c08959 100644 (file)
@@ -17,10 +17,27 @@ URL:        http://www.opendaylight.org
 Source0:    %name-{{ version_major }}.{{ version_minor }}.{{ version_patch }}-{{ pkg_version }}.tar.gz
 Source1:    %name-{{ sysd_commit }}.service.tar.gz
 Buildroot:  /tmp
+
+
+# This spec can be shared by Red Hat and SUSE based OS. The only difference is
+# the name of the dependent packages. Depending on the distro, we use one name
+# or another. For example, shadow-utils for RH and shadow for SUSE
+%if 0%{?rhel}
 # Required for ODL at run time
 Requires:   java >= 1:1.{{ java_version }}.0
 # Required for creating odl group
 Requires(pre): shadow-utils
+%else
+%if 0%{?suse_version}
+# Required for ODL at run time
+Requires:   java >= 1.{{ java_version }}.0
+# Required for creating odl group
+Requires(pre): shadow
+%else
+echo "Your OS is not supported"
+exit 1
+%endif%
+%endif%
 # Required for configuring systemd
 BuildRequires: systemd