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 <juerg.haefliger@canonical.com>
Acked-by: Kevin Becker <kevin.becker@canonical.com>
Acked-by: Agathe Porte <agathe.porte@canonical.com>
Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
This commit is contained in:
Juerg Haefliger
2025-01-23 17:06:35 +01:00
committed by Mehmet Basaran
parent 1ecc312721
commit 94f464fdee
+4 -1
View File
@@ -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)