From 94f464fdee0f8ed4a89ace2e54891c9e4603b348 Mon Sep 17 00:00:00 2001 From: Juerg Haefliger Date: Thu, 23 Jan 2025 17:06:35 +0100 Subject: [PATCH] UBUNTU: [Packaging] linux-tools: Fall back to old python perf path BugLink: https://bugs.launchpad.net/bugs/2089411 linux-tools from older kernels without these patches provide the perf python library in a different/broken path, so we have to look there as well. Sigh. Signed-off-by: Juerg Haefliger Acked-by: Kevin Becker Acked-by: Agathe Porte Signed-off-by: Koichiro Den --- debian/tools/python-perf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/tools/python-perf.py b/debian/tools/python-perf.py index d1991d677dcb..960c71baa9ef 100644 --- a/debian/tools/python-perf.py +++ b/debian/tools/python-perf.py @@ -20,7 +20,10 @@ class KernelNotFoundError(Exception): _kernel_version = os.uname().release _perf_dir = f"/usr/lib/linux-tools/{_kernel_version}/lib" if not os.path.exists(_perf_dir): - raise KernelNotFoundError() + _abi_version = "-".join(_kernel_version.split("-")[0:2]) + _perf_dir = f"/usr/lib/python3/dist-packages/linux-tools-{_abi_version}" + if not os.path.exists(_perf_dir): + raise KernelNotFoundError() _perf_lib = glob(os.path.join(_perf_dir, "perf.*.so"))[-1] _spec = importlib.util.spec_from_file_location("perf", _perf_lib)