[SRU][O][N][PATCH v2 3/3] UBUNTU: [Packaging] linux-tools: Fall back to old python perf path

Juerg Haefliger juerg.haefliger at canonical.com
Thu Jan 23 16:06:35 UTC 2025


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 <juerg.haefliger at canonical.com>
---
 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)
-- 
2.43.0




More information about the kernel-team mailing list