diff --git a/openvswitch.changes b/openvswitch.changes index 001856f..7290128 100644 --- a/openvswitch.changes +++ b/openvswitch.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Thu Nov 8 11:17:38 UTC 2018 - Markos Chandras + +- Improve python packaging (bsc#1115085) + * Rename python*-openvswitch subpackages to python*-ovs to follow + the openSUSE policy that packages should be named after the modules + they install. + * Build the JSON C bindings and as a result the 'noarch' BuildArch + needs to be removed. + * Drop the python*-openvswitch-test packages and merge them with the + test subpackage + * Build the python bindings using setuptools + * Include the egg-info package. + * Use libopenvswitch as dependency to python bindings + ------------------------------------------------------------------- Mon Oct 22 09:38:00 UTC 2018 - Markos Chandras diff --git a/openvswitch.spec b/openvswitch.spec index 9ec733a..523f384 100644 --- a/openvswitch.spec +++ b/openvswitch.spec @@ -78,6 +78,7 @@ Obsoletes: %{name}-dpdk-switch < 2.7.0 Obsoletes: %{name}-switch < 2.7.0 %if 0%{?suse_version} BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} BuildRequires: %{python_module six} BuildRequires: %{python_module xml} BuildRequires: fdupes @@ -93,6 +94,7 @@ BuildRequires: openssl-devel BuildRequires: python-devel BuildRequires: python-six BuildRequires: python2-rpm-macros +BuildRequires: python2-setuptools BuildRequires: python3-rpm-macros BuildRequires: systemd-units Requires(post): systemd-units @@ -268,58 +270,32 @@ forwarding. Open vSwitch is a full-featured software-based Ethernet switch. -%package -n python2-openvswitch +%package -n python2-ovs Summary: Python2 bindings for Open vSwitch License: Apache-2.0 Group: Productivity/Networking/System -Requires: openvswitch-common = %{version} +Requires: %{lname} = %{version} Requires: python2 Requires: python2-six -Provides: python-openvswitch = %{version} -Obsoletes: python-openvswitch < 2.8.1 -BuildArch: noarch +Provides: python-%{name} = %{version} +Provides: python2-%{name} = %{version} +Obsoletes: python-%{name} < 2.8.1 +Obsoletes: python2-%{name} < 2.10.1 -%description -n python2-openvswitch +%description -n python2-ovs This package contains the Python2 bindings for Open vSwitch database. -%package -n python2-openvswitch-test -Summary: Python2 bindings for Open vSwitch -License: Apache-2.0 -Group: Productivity/Networking/System -Requires: openvswitch-common = %{version} -Requires: python2 -Requires: python2-Twisted -Requires: python2-openvswitch = %{version} -Provides: python-openvswitch-test = %{version} -Obsoletes: python-openvswitch-test < 2.8.1 -BuildArch: noarch - -%description -n python2-openvswitch-test -This package contains the Python bindings for Open vSwitch database. - -%package -n python3-openvswitch +%package -n python3-ovs Summary: Python3 bindings for Open vSwitch License: Apache-2.0 Group: Productivity/Networking/System -Requires: openvswitch-common = %{version} +Requires: %{lname} = %{version} Requires: python3 Requires: python3-six -BuildArch: noarch +Provides: python3-%{name} = %{version} +Obsoletes: python3-%{name} < 2.10.1 -%description -n python3-openvswitch -This package contains the Python3 bindings for Open vSwitch database. - -%package -n python3-openvswitch-test -Summary: Python3 bindings for Open vSwitch -License: Apache-2.0 -Group: Productivity/Networking/System -Requires: openvswitch-common = %{version} -Requires: python3 -Requires: python3-Twisted -Requires: python3-openvswitch = %{version} -BuildArch: noarch - -%description -n python3-openvswitch-test +%description -n python3-ovs This package contains the Python3 bindings for Open vSwitch database. %package test @@ -327,7 +303,9 @@ Summary: Open vSwitch test package License: Apache-2.0 Group: Productivity/Networking/System Requires: %{name} = %{version} -Requires: python3-openvswitch-test = %{version} +Requires: python2 +Requires: python2-Twisted +Requires: python2-ovs = %{version} Provides: %{name}-dpdk-test = %{version} Obsoletes: %{name}-dpdk-test < 2.7.0 @@ -383,9 +361,9 @@ pushd source < rhel/usr_lib_systemd_system_ovs-vswitchd.service.in \ > rhel/usr_lib_systemd_system_ovs-vswitchd.service -%if 0%{?suse_version} -export PYTHON='%{_bindir}/python3' -%endif +# This is only used for building the ovstest module +export PYTHON='%{_bindir}/python2' + %configure \ --disable-static \ --enable-libcapng \ @@ -485,27 +463,33 @@ find %{buildroot}%{_docdir}/%{name}/ -type f ! -name '*.rst' -delete popd -# Python subpackages -# SLES -%if 0%{?suse_version} +# Tests mkdir -p %{buildroot}%{python2_sitelib} -cp -a %{buildroot}%{_datadir}/openvswitch/python/* %{buildroot}%{python2_sitelib} -# Build the byte compiled files -%py_compile %{buildroot}%{python2_sitelib} -%fdupes %{buildroot}%{python2_sitelib} -mkdir -p %{buildroot}%{python3_sitelib} -cp -a %{buildroot}%{_datadir}/openvswitch/python/* %{buildroot}%{python3_sitelib} -# Build the byte compiled files -%py3_compile %{buildroot}%{python3_sitelib} -%fdupes %{buildroot}%{python3_sitelib} +cp -a %{buildroot}%{_datadir}/openvswitch/python/ovstest \ + %{buildroot}%{python2_sitelib} + +# Python subpackages +pushd source/python + +export LDFLAGS="${LDFLAGS} -L %{buildroot}%{_libdir}" +export CPPFLAGS="-I ../include" + +%if 0%{?suse_version} +# SLES +%{python_build} +%{python_install} +%fdupes %{buildroot}%{python2_sitearch} +%fdupes %{buildroot}%{python3_sitearch} + %else # RHEL -install -d -m 0755 %{buildroot}%{python2_sitelib} -cp -a %{buildroot}%{_datadir}/openvswitch/python/* \ - %{buildroot}%{python2_sitelib} +%py2_build +%py2_install # No python3 for RHEL. We are missing python3-* packages from EPEL %endif +popd + rm -rf %{buildroot}%{_datadir}/openvswitch/python find %{buildroot} -type f -name "*.la" -delete -print @@ -880,9 +864,7 @@ export DISABLE_STOP_ON_REMOVAL=yes %files doc %exclude %{_docdir}/%{name}/AUTHORS.rst %exclude %{_docdir}/%{name}/CONTRIBUTING.rst -%exclude %{_docdir}/%{name}/LICENSE %exclude %{_docdir}/%{name}/NEWS -%exclude %{_docdir}/%{name}/NOTICE %exclude %{_docdir}/%{name}/README.rst %{_docdir}/%{name}/ @@ -905,18 +887,14 @@ export DISABLE_STOP_ON_REMOVAL=yes %{_datadir}/openvswitch/scripts/ovs-vtep %{_datadir}/openvswitch/vtep.ovsschema -%files -n python2-openvswitch -%{python2_sitelib}/ovs/ - -%files -n python2-openvswitch-test -%{python2_sitelib}/ovstest/ +%files -n python2-ovs +%{python2_sitearch}/ovs/ +%{python2_sitearch}/ovs-*.egg-info %if 0%{?suse_version} -%files -n python3-openvswitch -%{python3_sitelib}/ovs/ - -%files -n python3-openvswitch-test -%{python3_sitelib}/ovstest/ +%files -n python3-ovs +%{python3_sitearch}/ovs/ +%{python3_sitearch}/ovs-*.egg-info %endif %files ovn-docker @@ -985,6 +963,7 @@ export DISABLE_STOP_ON_REMOVAL=yes %{_mandir}/man8/ovs-l3ping.8%{?ext_man} %{_mandir}/man8/ovs-tcpdump.8%{?ext_man} %{_mandir}/man8/ovs-testcontroller.8%{?ext_man} +%{python2_sitelib}/ovstest/ %files devel %{_libdir}/libofproto.so