diff mbox

[ovs-dev] packaging: Make Fedora spec file CentOS compatible

Message ID 20170303030454.13915-1-lmadsen@redhat.com
State Superseded
Headers show

Commit Message

Leif Madsen March 3, 2017, 3:04 a.m. UTC
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.

Signed-off-by: Leif Madsen <lmadsen@redhat.com>
---
 Documentation/intro/install/fedora.rst |  4 +--
 Vagrantfile                            | 10 ++++----
 rhel/openvswitch-fedora.spec.in        | 45 +++++++++++++++++++++++++---------
 3 files changed, 40 insertions(+), 19 deletions(-)

Comments

Leif Madsen March 3, 2017, 3:27 a.m. UTC | #1
On Thu, Mar 2, 2017 at 10:04 PM, Leif Madsen <lmadsen@redhat.com> wrote:

> 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.
>
>
I've done some more testing across multiple distros (EPEL 7, F23, F24,
F25), and I'm having failures on F23 and F24. I know the fix, but I'll have
to work on that tomorrow as it's pretty late here.

Don't merge this yet :)

If you have comments on the approach though, happy to hear them.

Thanks!
Leif.
diff mbox

Patch

diff --git a/Documentation/intro/install/fedora.rst b/Documentation/intro/install/fedora.rst
index 0ecd255..ffc77a4 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 8439918..fccf23e 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -8,10 +8,10 @@  Vagrant.require_version ">=1.7.0"
 $bootstrap_fedora = <<SCRIPT
 dnf -y update
 dnf -y install autoconf automake openssl-devel libtool \
-               python-devel python3-devel \
-               python-twisted-core python-zope-interface \
+               python2-devel python3-devel \
+               python2-twisted python2-zope-interface \
                desktop-file-utils groff graphviz rpmdevtools nc curl \
-               wget python-six pyftpdlib checkpolicy selinux-policy-devel \
+               wget python2-six pyftpdlib checkpolicy selinux-policy-devel \
                libcap-ng-devel kernel-devel-`uname -r` ethtool python-tftpy
 echo "search extra update built-in" >/etc/depmod.d/search_path.conf
 SCRIPT
@@ -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 d100f49..5d24b1b 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -28,6 +28,8 @@ 
 %bcond_without libcapng
 # To enable DPDK support, specify '--with dpdk' when building
 %bcond_with dpdk
+# To enable checks, specify '--with check' when building
+%bcond_with check
 
 # Enable PIE, bz#955181
 %global _hardened_build 1
@@ -38,6 +40,15 @@ 
 %define _rundir /run
 %endif
 
+%if 0%{?fedora}
+%define _py2 python2
+%endif
+
+%if 0%{?rhel}
+%define _py2 python
+%endif
+
+
 Name: openvswitch
 Summary: Open vSwitch
 Group: System Environment/Daemons
@@ -53,14 +64,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}
 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}
@@ -98,17 +111,18 @@  Requires: selinux-policy-targeted
 %description selinux-policy
 Tailored Open vSwitch SELinux policy
 
-%package -n python2-openvswitch
-Summary: Open vSwitch python2 bindings
+%package -n %{_py2}-openvswitch
+Summary: Open vSwitch %{_py2} bindings
 License: ASL 2.0
 BuildArch: noarch
-Requires: python2
-Requires: python2-six
+Requires: %{_py2}
+Requires: %{_py2}-six
 Provides: python-openvswitch = %{version}-%{release}
 
-%description -n python2-openvswitch
+%description -n %{_py2}-openvswitch
 Python bindings for the Open vSwitch database
 
+%if 0%{?fedora}
 %package -n python3-openvswitch
 Summary: Open vSwitch python3 bindings
 License: ASL 2.0
@@ -118,13 +132,14 @@  Requires: python3-six
 
 %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 +197,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 +253,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}
+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 +448,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}
 %files -n python3-openvswitch
 %{python3_sitelib}/ovs
 %doc COPYING
+%endif
 
 %files test
 %{_bindir}/ovs-test