From f3ce0f26fed1b5052dd81fe248f565bf27f79907 Mon Sep 17 00:00:00 2001 From: Travis Athougies Date: Tue, 29 Oct 2024 08:44:41 -0700 Subject: [PATCH] linuxPackages_5_x.perf: fix build with Python 3.12 Python 3.12 removed the distutils library, but perf < 6.0 depends on it. This also disables the dmesg path patch for version 5.4 because it does not apply there. --- pkgs/os-specific/linux/kernel/perf/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/perf/default.nix b/pkgs/os-specific/linux/kernel/perf/default.nix index 0d639531e840..b1f1f4e203b2 100644 --- a/pkgs/os-specific/linux/kernel/perf/default.nix +++ b/pkgs/os-specific/linux/kernel/perf/default.nix @@ -59,7 +59,7 @@ stdenv.mkDerivation { pname = "perf-linux"; inherit (kernel) version src; - patches = [ + patches = lib.optionals (lib.versionAtLeast kernel.version "5.10") [ # fix wrong path to dmesg ./fix-dmesg-path.diff ] ++ lib.optionals (lib.versions.majorMinor kernel.version == "6.10") [ @@ -143,7 +143,12 @@ stdenv.mkDerivation { ++ lib.optional withZstd zstd ++ lib.optional withLibcap libcap ++ lib.optional (lib.versionAtLeast kernel.version "5.8") libpfm - ++ lib.optional (lib.versionAtLeast kernel.version "6.0") python3.pkgs.setuptools; + ++ lib.optional (lib.versionAtLeast kernel.version "6.0") python3.pkgs.setuptools + # Python 3.12 no longer includes distutils, not needed for 6.0 and newer. + ++ lib.optional (!(lib.versionAtLeast kernel.version "6.0") && lib.versionAtLeast python3.version "3.12") [ + python3.pkgs.distutils + python3.pkgs.packaging + ]; env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=cpp"