summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeif Madsen <lmadsen@redhat.com>2017-03-06 15:46:43 -0500
committerRussell Bryant <russell@ovn.org>2017-03-08 11:13:19 -0500
commitdb8dcbaf1c57efb1fbd29cee598a6a84a2a5f9ec (patch)
tree6b0664128152dee99c248c11a83be234246d4c91
parent2fde4546d118f2683658c384f31ebe361c906f34 (diff)
downloadopenvswitch-db8dcbaf1c57efb1fbd29cee598a6a84a2a5f9ec.tar.gz
packaging: Make Fedora spec file CentOS compatible
On CentOS, the package names aren't prefixed with python2, but rather are prefixed with simply python. This change addresses that and fixes up some documentation that was outdated, and updates the Vagrantfile to use the proper spec file and package names. Fixes: bb1a7ca21107 ("fedora: Add python3-openvswitch split package") Signed-off-by: Leif Madsen <lmadsen@redhat.com> Signed-off-by: Russell Bryant <russell@ovn.org>
-rw-r--r--AUTHORS.rst1
-rw-r--r--Documentation/intro/install/fedora.rst4
-rw-r--r--Vagrantfile6
-rw-r--r--rhel/openvswitch-fedora.spec.in54
4 files changed, 45 insertions, 20 deletions
diff --git a/AUTHORS.rst b/AUTHORS.rst
index 39a5f40f8..bc06f3abc 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -183,6 +183,7 @@ Kyle Upton kupton@baymicrosystems.com
Lance Richardson lrichard@redhat.com
Lars Kellogg-Stedman lars@redhat.com
Lei Huang huang.f.lei@gmail.com
+Leif Madsen lmadsen@redhat.com
Leo Alterman lalterman@nicira.com
Lilijun jerry.lilijun@huawei.com
Linda Sun lsun@vmware.com
diff --git a/Documentation/intro/install/fedora.rst b/Documentation/intro/install/fedora.rst
index 0ecd255d1..ffc77a429 100644
--- a/Documentation/intro/install/fedora.rst
+++ b/Documentation/intro/install/fedora.rst
@@ -42,8 +42,8 @@ in the :doc:`general`. Specific packages (by package name) include:
- rpm-build
- autoconf automake libtool
- systemd-units openssl openssl-devel
-- python-devel python3-devel
-- python python-twisted-core python-zope-interface python-six
+- python2-devel python3-devel
+- python2 python2-twisted python2-zope-interface python2-six
- desktop-file-utils
- groff graphviz
- procps-ng
diff --git a/Vagrantfile b/Vagrantfile
index 5296279e7..28e9219b8 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -9,7 +9,7 @@ $bootstrap_fedora = <<SCRIPT
dnf -y update
dnf -y install autoconf automake openssl-devel libtool \
python-devel python3-devel \
- python-twisted-core python-zope-interface \
+ python-twisted python-zope-interface \
desktop-file-utils groff graphviz rpmdevtools nc curl \
wget python-six pyftpdlib checkpolicy selinux-policy-devel \
libcap-ng-devel kernel-devel-`uname -r` ethtool python-tftpy
@@ -80,8 +80,8 @@ PACKAGE_VERSION=`autom4te -l Autoconf -t 'AC_INIT:$2' /vagrant/configure.ac`
make && make dist
rpmdev-setuptree
cp openvswitch-$PACKAGE_VERSION.tar.gz $HOME/rpmbuild/SOURCES
-rpmbuild --bb -D "kversion `uname -r`" /vagrant/rhel/openvswitch-kmod-rhel6.spec
-rpmbuild --bb --without check /vagrant/rhel/openvswitch.spec
+rpmbuild --bb -D "kversion `uname -r`" /vagrant/rhel/openvswitch-kmod-fedora.spec
+rpmbuild --bb --without check /vagrant/rhel/openvswitch-fedora.spec
rpm -e openvswitch
rpm -ivh $HOME/rpmbuild/RPMS/x86_64/openvswitch-$PACKAGE_VERSION-1.x86_64.rpm
systemctl enable openvswitch
diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index d100f4991..2d146609d 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -28,6 +28,10 @@
%bcond_without libcapng
# To enable DPDK support, specify '--with dpdk' when building
%bcond_with dpdk
+# Enable Python 3 by specifying '--with build_python3'.
+# This is enabled by default for versions of the distribution that
+# have Python 3 by default (Fedora > 22).
+%bcond_with build_python3
# Enable PIE, bz#955181
%global _hardened_build 1
@@ -38,6 +42,17 @@
%define _rundir /run
%endif
+# define the python package prefix based on distribution version so that we can
+# simultaneously support RHEL-based and later Fedora versions in this spec file.
+%if 0%{?fedora} >= 25
+%define _py2 python2
+%endif
+
+%if 0%{?rhel} || 0%{?fedora} < 25
+%define _py2 python
+%endif
+
+
Name: openvswitch
Summary: Open vSwitch
Group: System Environment/Daemons
@@ -53,16 +68,16 @@ Source: http://openvswitch.org/releases/%{name}-%{version}.tar.gz
BuildRequires: autoconf automake libtool
BuildRequires: systemd-units openssl openssl-devel
-BuildRequires: python2-devel
+BuildRequires: %{_py2}-devel
+%if 0%{?fedora} > 22 || %{with build_python3}
BuildRequires: python3-devel
+%endif
BuildRequires: desktop-file-utils
BuildRequires: groff graphviz
BuildRequires: checkpolicy, selinux-policy-devel
# make check dependencies
-%if %{with check}
-BuildRequires: python2-twisted python2-zope-interface python2-six
+BuildRequires: %{_py2}-twisted%{?rhel:-core} %{_py2}-zope-interface %{_py2}-six
BuildRequires: procps-ng
-%endif
%if %{with libcapng}
BuildRequires: libcap-ng libcap-ng-devel
%endif
@@ -81,6 +96,7 @@ Requires(preun): systemd-units
Requires(postun): systemd-units
Obsoletes: openvswitch-controller <= 0:2.1.0-1
+# to skip running checks, pass --without check
%bcond_without check
%bcond_with check_datapath_kernel
@@ -98,33 +114,35 @@ Requires: selinux-policy-targeted
%description selinux-policy
Tailored Open vSwitch SELinux policy
-%package -n python2-openvswitch
+%package -n %{_py2}-openvswitch
Summary: Open vSwitch python2 bindings
License: ASL 2.0
BuildArch: noarch
-Requires: python2
-Requires: python2-six
-Provides: python-openvswitch = %{version}-%{release}
-
-%description -n python2-openvswitch
+Requires: %{_py2}
+Requires: %{_py2}-six
+%{?python_provide:%python_provide python2-openvswitch = %{version}-%{release}}
+%description -n %{_py2}-openvswitch
Python bindings for the Open vSwitch database
+%if 0%{?fedora} > 22 || %{with build_python3}
%package -n python3-openvswitch
Summary: Open vSwitch python3 bindings
License: ASL 2.0
BuildArch: noarch
Requires: python3
Requires: python3-six
+%{?python_provide:%python_provide python3-openvswitch = %{version}-%{release}}
%description -n python3-openvswitch
Python bindings for the Open vSwitch database
+%endif
%package test
Summary: Open vSwitch testing utilities
License: ASL 2.0
BuildArch: noarch
-Requires: python2-openvswitch = %{version}-%{release}
-Requires: python2 python2-twisted
+Requires: %{_py2}-openvswitch = %{version}-%{release}
+Requires: %{_py2} %{_py2}-twisted
%description test
Utilities that are useful to diagnose performance and connectivity
@@ -182,7 +200,7 @@ Utilities that are use to diagnose and manage the OVN components.
%package ovn-docker
Summary: Open vSwitch - Open Virtual Network support
License: ASL 2.0
-Requires: openvswitch openvswitch-ovn-common python2-openvswitch
+Requires: openvswitch openvswitch-ovn-common %{_py2}-openvswitch
%description ovn-docker
Docker network plugins for OVN.
@@ -238,11 +256,15 @@ install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \
$RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
install -d -m 0755 $RPM_BUILD_ROOT%{python2_sitelib}
-install -d -m 0755 $RPM_BUILD_ROOT%{python3_sitelib}
cp -a $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/* \
$RPM_BUILD_ROOT%{python2_sitelib}
+
+%if 0%{?fedora} > 22 || %{with build_python3}
+install -d -m 0755 $RPM_BUILD_ROOT%{python3_sitelib}
cp -a $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/ovs \
$RPM_BUILD_ROOT%{python3_sitelib}
+%endif
+
rm -rf $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
@@ -429,13 +451,15 @@ fi
%defattr(-,root,root)
%{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp
-%files -n python2-openvswitch
+%files -n %{_py2}-openvswitch
%{python2_sitelib}/ovs
%doc COPYING
+%if 0%{?fedora} > 22 || %{with build_python3}
%files -n python3-openvswitch
%{python3_sitelib}/ovs
%doc COPYING
+%endif
%files test
%{_bindir}/ovs-test