From 50d2bb48d09d5b6ae23185e8f916152e2371d04a Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Wed, 3 Mar 2021 12:10:20 -0500 Subject: [PATCH] Python agent lib soname major bump Make the python agent library follow the main library soname for co-installability with previous versions. Also use the value provided by the build system instead of manually synchronizing it. Change-Id: Ieef9b9ca6dcfd08b7834e5faafef3935a6a1a232 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- .gitignore | 2 +- configure.ac | 5 ++++- liblttng-ust-python-agent/Makefile.am | 3 +++ python-lttngust/Makefile.am | 1 + python-lttngust/lttngust/{__init__.py.in => __init__.py} | 6 +++--- python-lttngust/lttngust/loghandler.py | 3 ++- python-lttngust/lttngust/version.py.in | 8 ++++++++ 7 files changed, 22 insertions(+), 6 deletions(-) rename python-lttngust/lttngust/{__init__.py.in => __init__.py} (78%) create mode 100644 python-lttngust/lttngust/version.py.in diff --git a/.gitignore b/.gitignore index 15d19b64..78ecf88f 100644 --- a/.gitignore +++ b/.gitignore @@ -100,7 +100,7 @@ org_lttng_ust_agent_jul_LttngJulApi.h org_lttng_ust_agent_log4j_LttngLog4jApi.h # Python agent -python-lttngust/lttngust/__init__.py +python-lttngust/lttngust/version.py python-lttngust/**/*.pyc python-lttngust/build python-lttngust/setup.py diff --git a/configure.ac b/configure.ac index 09ba4ed0..5c060fb5 100644 --- a/configure.ac +++ b/configure.ac @@ -489,6 +489,9 @@ AM_CONDITIONAL([HAVE_PERF_EVENT], [test "x$ac_cv_header_linux_perf_event_h" = "x AC_SUBST([LTTNG_UST_LIBRARY_VERSION], ust_lib_version) AC_SUBST([LTTNG_UST_CTL_LIBRARY_VERSION], ust_ctl_lib_version) +# Major soname for python-lttngust +AC_SUBST([LTTNG_UST_LIB_SONAME_MAJOR], [ust_lib_version_current]) + AM_CFLAGS="-Wall $URCU_CFLAGS $PTHREAD_CFLAGS" AC_SUBST(AM_CFLAGS) @@ -541,7 +544,7 @@ AC_CONFIG_FILES([ liblttng-ust-python-agent/Makefile python-lttngust/Makefile python-lttngust/setup.py - python-lttngust/lttngust/__init__.py + python-lttngust/lttngust/version.py tools/Makefile tests/Makefile tests/compile/Makefile diff --git a/liblttng-ust-python-agent/Makefile.am b/liblttng-ust-python-agent/Makefile.am index 2b316a7b..e5de2e0b 100644 --- a/liblttng-ust-python-agent/Makefile.am +++ b/liblttng-ust-python-agent/Makefile.am @@ -8,3 +8,6 @@ lib_LTLIBRARIES = liblttng-ust-python-agent.la liblttng_ust_python_agent_la_SOURCES = lttng_ust_python.c lttng_ust_python.h liblttng_ust_python_agent_la_LIBADD = -lc \ $(top_builddir)/liblttng-ust/liblttng-ust.la + +# Follow the main library soname for co-installability +liblttng_ust_python_agent_la_LDFLAGS = -version-info $(LTTNG_UST_LIBRARY_VERSION) diff --git a/python-lttngust/Makefile.am b/python-lttngust/Makefile.am index 33a968f5..f95482d3 100644 --- a/python-lttngust/Makefile.am +++ b/python-lttngust/Makefile.am @@ -3,6 +3,7 @@ INSTALLED_FILES=$(builddir)/installed_files.txt STATIC_BINDINGS_DEPS = \ + lttngust/__init__.py \ lttngust/agent.py \ lttngust/cmd.py \ lttngust/compat.py \ diff --git a/python-lttngust/lttngust/__init__.py.in b/python-lttngust/lttngust/__init__.py similarity index 78% rename from python-lttngust/lttngust/__init__.py.in rename to python-lttngust/lttngust/__init__.py index 6aae1002..22d3e09c 100644 --- a/python-lttngust/lttngust/__init__.py.in +++ b/python-lttngust/lttngust/__init__.py @@ -6,8 +6,8 @@ from __future__ import unicode_literals +from .version import __version__ +from .version import __soname_major__ + # this creates the daemon threads and registers the application import lttngust.agent - - -__version__ = '@PACKAGE_VERSION@' diff --git a/python-lttngust/lttngust/loghandler.py b/python-lttngust/lttngust/loghandler.py index 406cc58b..745d9637 100644 --- a/python-lttngust/lttngust/loghandler.py +++ b/python-lttngust/lttngust/loghandler.py @@ -9,9 +9,10 @@ from __future__ import unicode_literals import logging import ctypes +from .version import __soname_major__ class _Handler(logging.Handler): - _LIB_NAME = 'liblttng-ust-python-agent.so.0' + _LIB_NAME = 'liblttng-ust-python-agent.so.' + __soname_major__ def __init__(self): super(self.__class__, self).__init__(level=logging.NOTSET) diff --git a/python-lttngust/lttngust/version.py.in b/python-lttngust/lttngust/version.py.in new file mode 100644 index 00000000..d3a904bc --- /dev/null +++ b/python-lttngust/lttngust/version.py.in @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +# +# SPDX-License-Identifier: LGPL-2.1-only +# +# Copyright (C) 2021 Michael Jeanson + +__version__ = '@PACKAGE_VERSION@' +__soname_major__ = '@LTTNG_UST_LIB_SONAME_MAJOR@' -- 2.34.1