The JSON C extensions performs much better than the pure Python
version, so build it when producing RPMs.

Signed-off-by: Terry Wilson <[email protected]>
---
 rhel/openvswitch-fedora.spec.in | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index 59e8ff8..29982e8 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -125,9 +125,9 @@ Tailored Open vSwitch SELinux policy
 %package -n %{_py2}-openvswitch
 Summary: Open vSwitch python2 bindings
 License: ASL 2.0
-BuildArch: noarch
 Requires: %{_py2}
 Requires: %{_py2}-six
+Requires: openvswitch-devel
 %{?python_provide:%python_provide python2-openvswitch = %{version}-%{release}}
 %description -n %{_py2}-openvswitch
 Python bindings for the Open vSwitch database
@@ -136,9 +136,9 @@ Python bindings for the Open vSwitch database
 %package -n python3-openvswitch
 Summary: Open vSwitch python3 bindings
 License: ASL 2.0
-BuildArch: noarch
 Requires: python3
 Requires: python3-six
+Requires: openvswitch-devel
 %{?python_provide:%python_provide python3-openvswitch = %{version}-%{release}}
 
 %description -n python3-openvswitch
@@ -227,7 +227,8 @@ Docker network plugins for OVN.
        --with-dpdk=$(dirname %{_datadir}/dpdk/*/.config) \
 %endif
        --enable-ssl \
-       --with-pkidir=%{_sharedstatedir}/openvswitch/pki
+       --with-pkidir=%{_sharedstatedir}/openvswitch/pki \
+       --enable-shared
 
 /usr/bin/perl build-aux/dpdkstrip.pl \
 %if %{with dpdk}
@@ -283,14 +284,25 @@ 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}
-cp -a $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/* \
+cp -a $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/ovstest \
    $RPM_BUILD_ROOT%{python2_sitelib}
 
+# We can't build the Python lib until after the libopenvswitch install
+pushd python
+# py2/py3_build, but with extra CFLAGS--is there a better way to do this?
+CFLAGS="%{optflags} -I ../include -L $RPM_BUILD_ROOT%{_libdir}" %{__python} \
+        setup.py %{?py_setup_args} build --executable="%{__python2} -s"
+
+%if 0%{?fedora} > 22 || %{with build_python3}
+CFLAGS="%{optflags} -I ../include -L $RPM_BUILD_ROOT%{_libdir}" %{__python3} \
+        setup.py %{?py_setup_args} build --executable="%{__python3} -s"
+%endif
+
+%py2_install
 %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}
+%py3_install
 %endif
+popd
 
 rm -rf $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
 
@@ -481,12 +493,14 @@ fi
 %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp
 
 %files -n %{_py2}-openvswitch
-%{python2_sitelib}/ovs
+%{python2_sitearch}/ovs
+%{python2_sitearch}/ovs-*.egg-info
 %doc COPYING
 
 %if 0%{?fedora} > 22 || %{with build_python3}
 %files -n python3-openvswitch
-%{python3_sitelib}/ovs
+%{python3_sitearch}/ovs
+%{python3_sitearch}/ovs-*.egg-info
 %doc COPYING
 %endif
 
@@ -508,6 +522,7 @@ fi
 %files devel
 %{_libdir}/*.a
 %{_libdir}/*.la
+%{_libdir}/lib*.so*
 %{_libdir}/pkgconfig/*.pc
 %{_includedir}/openvswitch/*
 %{_includedir}/openflow/*
-- 
2.9.4

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to