[ovs-dev] [RFC ovn 3/5] ovn-detrace: rename ovn-detrace to ovn_detrace.py
Adrian Moreno
amorenoz at redhat.com
Thu Oct 14 16:41:28 UTC 2021
For external python programs to be able to load ovn-detrace as a python
module easily, it should end in .py and should have underscores.
Move ovn-detrace to ovn-detrac.py and create a symlink with the old name
for backwards compatibility.
Signed-off-by: Adrian Moreno <amorenoz at redhat.com>
---
debian/ovn-common.install | 2 +-
debian/ovn-common.postinst | 1 +
debian/ovn-common.postrm | 1 +
rhel/ovn-fedora.spec.in | 9 +++++++++
utilities/automake.mk | 14 ++++++++++++--
utilities/{ovn-detrace.in => ovn_detrace.py.in} | 0
6 files changed, 24 insertions(+), 3 deletions(-)
rename utilities/{ovn-detrace.in => ovn_detrace.py.in} (100%)
diff --git a/debian/ovn-common.install b/debian/ovn-common.install
index 8e5915724..050d1c63a 100644
--- a/debian/ovn-common.install
+++ b/debian/ovn-common.install
@@ -4,7 +4,7 @@ usr/bin/ovn-sbctl
usr/bin/ovn-ic-nbctl
usr/bin/ovn-ic-sbctl
usr/bin/ovn-trace
-usr/bin/ovn-detrace
+usr/bin/ovn_detrace.py
usr/share/ovn/scripts/ovn-ctl
usr/share/ovn/scripts/ovndb-servers.ocf
usr/share/ovn/scripts/ovn-lib
diff --git a/debian/ovn-common.postinst b/debian/ovn-common.postinst
index 15f3c7577..dfddb1f08 100644
--- a/debian/ovn-common.postinst
+++ b/debian/ovn-common.postinst
@@ -9,6 +9,7 @@ case "$1" in
configure)
mkdir -p /usr/lib/ocf/resource.d/ovn
ln -sf /usr/share/ovn/scripts/ovndb-servers.ocf /usr/lib/ocf/resource.d/ovn/ovndb-servers
+ ln -sf /usr/bin/ovn_detrace.py /usr/bin/ovn-detrace
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
diff --git a/debian/ovn-common.postrm b/debian/ovn-common.postrm
index 9face726b..d607a66d5 100644
--- a/debian/ovn-common.postrm
+++ b/debian/ovn-common.postrm
@@ -8,6 +8,7 @@ set -e
case "$1" in
purge|remove)
rm -rf /usr/lib/ocf/resource.d/ovn
+ rm -f /usr/bin/ovn-detrace
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in
index 9c8647b5a..fc0992263 100644
--- a/rhel/ovn-fedora.spec.in
+++ b/rhel/ovn-fedora.spec.in
@@ -264,6 +264,12 @@ if [ $1 -eq 1 ] ; then
fi
fi
+%preun
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ rm %{_bindir}/ovn-detrace
+fi
+
%preun central
%if 0%{?systemd_preun:1}
%systemd_preun ovn-northd.service
@@ -318,6 +324,8 @@ fi
%endif
%post
+ln -sf ovn_detrace.py %{_bindir}/ovn-detrace
+
%if %{with libcapng}
if [ $1 -eq 1 ]; then
sed -i 's:^#OVN_USER_ID=:OVN_USER_ID=:' %{_sysconfdir}/sysconfig/ovn
@@ -462,6 +470,7 @@ fi
%{_bindir}/ovn-nbctl
%{_bindir}/ovn-sbctl
%{_bindir}/ovn-trace
+%{_bindir}/ovn_detrace.py
%{_bindir}/ovn-detrace
%{_bindir}/ovn-appctl
%{_bindir}/ovn-ic-nbctl
diff --git a/utilities/automake.mk b/utilities/automake.mk
index a03892f20..67b04cbff 100644
--- a/utilities/automake.mk
+++ b/utilities/automake.mk
@@ -20,7 +20,7 @@ MAN_ROOTS += \
bin_SCRIPTS += \
utilities/ovn-docker-overlay-driver \
utilities/ovn-docker-underlay-driver \
- utilities/ovn-detrace
+ utilities/ovn_detrace.py
EXTRA_DIST += \
utilities/ovn-ctl \
@@ -34,7 +34,7 @@ EXTRA_DIST += \
utilities/ovn-ic-sbctl.8.xml \
utilities/ovn-appctl.8.xml \
utilities/ovn-trace.8.xml \
- utilities/ovn-detrace.in \
+ utilities/ovn_detrace.py.in \
utilities/ovndb-servers.ocf \
utilities/checkpatch.py \
utilities/docker/Makefile \
@@ -60,6 +60,7 @@ CLEANFILES += \
utilities/ovn-trace.8 \
utilities/ovn-detrace.1 \
utilities/ovn-detrace \
+ utilities/ovn_detrace.py \
utilities/ovn-appctl.8 \
utilities/ovn-appctl \
utilities/ovn-sim
@@ -105,4 +106,13 @@ bin_PROGRAMS += utilities/ovn-appctl
utilities_ovn_appctl_SOURCES = utilities/ovn-appctl.c
utilities_ovn_appctl_LDADD = lib/libovn.la $(OVSDB_LIBDIR)/libovsdb.la $(OVS_LIBDIR)/libopenvswitch.la
+# ovn-detrace
+INSTALL_DATA_LOCAL += ovn-detrace-install
+ovn-detrace-install:
+ ln -sf ovn_detrace.py $(DESTDIR)$(bindir)/ovn-detrace
+
+UNINSTALL_LOCAL += ovn-detrace-uninstall
+ovn-detrace-uninstall:
+ rm -f $(DESTDIR)$(bindir)/ovn-detrace
+
include utilities/bugtool/automake.mk
diff --git a/utilities/ovn-detrace.in b/utilities/ovn_detrace.py.in
similarity index 100%
rename from utilities/ovn-detrace.in
rename to utilities/ovn_detrace.py.in
--
2.31.1
More information about the dev
mailing list