From c30d90f8dc70900b01dd0a708400f87da37f87a01ae5db69faa2a196049656e4 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dmueller@suse.com>
Date: Mon, 14 Mar 2022 10:53:37 +0000
Subject: [PATCH] Accepting request 961072 from home:susnux:branches:network

- Fix OVS location for python bindings (dirs.py), boo#1196978

OBS-URL: https://build.opensuse.org/request/show/961072
OBS-URL: https://build.opensuse.org/package/show/network/openvswitch?expand=0&rev=220
---
 openvswitch.changes |  6 ++++++
 openvswitch.spec    | 21 +++++++++++----------
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/openvswitch.changes b/openvswitch.changes
index ad4af05..1ff0fbc 100644
--- a/openvswitch.changes
+++ b/openvswitch.changes
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Fri Mar 11 11:33:18 UTC 2022 - Ferdinand Thiessen <rpm@fthiessen.de>
+
+- Fix OVS location for python bindings (dirs.py), boo#1196978
+  Make sure dirs.py is freshly generated
+
 -------------------------------------------------------------------
 Mon Mar  7 12:04:30 UTC 2022 - Dirk Müller <dmueller@suse.com>
 
diff --git a/openvswitch.spec b/openvswitch.spec
index a7b7a53..41513ea 100644
--- a/openvswitch.spec
+++ b/openvswitch.spec
@@ -389,25 +389,26 @@ rm -rf %{buildroot}%{_docdir}/%{name}/_build
 rm %{buildroot}%{_docdir}/%{name}/automake.mk
 rm %{buildroot}%{_docdir}/%{name}/conf.py
 
-# Tests
+# Python subpackage
+# Install python tests package
 mkdir -p %{buildroot}%{python3_sitelib}
 cp -a %{buildroot}%{_datadir}/openvswitch/python/ovstest \
-    %{buildroot}%{python3_sitelib}
-
-# Python subpackage
-# Some build files are in sources while others are generated directly on
-# buildroot as part of make_install (dirs.py). Copy them first.
-pushd python
-cp -an %{buildroot}%{_datadir}/openvswitch/python/* .
+      %{buildroot}%{python3_sitelib}
+# Remove non standard location python package
 rm -rf %{buildroot}%{_datadir}/openvswitch/python
-
+# Install python package, some files are generated by make install
+# make sure dirs.py is freshly generated
+rm -f python/ovs/dirs.py
+make python/ovs/dirs.py
+pushd python
 export LDFLAGS="${LDFLAGS} -L %{buildroot}%{_libdir}"
 export CPPFLAGS="-I ../../include"
-
 %python_build
 %python_install
 popd
 
+%python_expand %fdupes %{buildroot}%{$python_sitearch}
+
 %pre
 %service_add_pre ovsdb-server.service ovs-vswitchd.service openvswitch.service ovs-delete-transient-ports.service
 if [ "$1" -ge 1 ]; then