From 90aeb519ef7a445dd9651939711b8f49c29d4ca3 Mon Sep 17 00:00:00 2001 From: 06kellyjac Date: Wed, 13 Nov 2024 12:13:06 +0000 Subject: [PATCH 1/2] libpwquality: format Format to match the new standards in nixpkgs --- .../libraries/libpwquality/default.nix | 41 ++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/pkgs/development/libraries/libpwquality/default.nix b/pkgs/development/libraries/libpwquality/default.nix index dd610989617b..0f3c3cc9209e 100644 --- a/pkgs/development/libraries/libpwquality/default.nix +++ b/pkgs/development/libraries/libpwquality/default.nix @@ -1,14 +1,15 @@ -{ stdenv -, lib -, fetchFromGitHub -, fetchpatch -, autoreconfHook -, perl -, cracklib -, enablePAM ? stdenv.hostPlatform.isLinux -, pam -, enablePython ? false -, python +{ + stdenv, + lib, + fetchFromGitHub, + fetchpatch, + autoreconfHook, + perl, + cracklib, + enablePAM ? stdenv.hostPlatform.isLinux, + pam, + enablePython ? false, + python, }: # python binding generates a shared library which are unavailable with musl build @@ -18,7 +19,12 @@ stdenv.mkDerivation rec { pname = "libpwquality"; version = "1.4.5"; - outputs = [ "out" "dev" "lib" "man" ] ++ lib.optionals enablePython [ "py" ]; + outputs = [ + "out" + "dev" + "lib" + "man" + ] ++ lib.optionals enablePython [ "py" ]; src = fetchFromGitHub { owner = "libpwquality"; @@ -38,7 +44,10 @@ stdenv.mkDerivation rec { }) ]; - nativeBuildInputs = [ autoreconfHook perl ] ++ lib.optionals enablePython [ (python.withPackages (ps: with ps; [ distutils ])) ]; + nativeBuildInputs = [ + autoreconfHook + perl + ] ++ lib.optionals enablePython [ (python.withPackages (ps: with ps; [ distutils ])) ]; buildInputs = [ cracklib ] ++ lib.optionals enablePAM [ pam ]; configureFlags = lib.optionals (!enablePython) [ "--disable-python-bindings" ]; @@ -57,7 +66,11 @@ stdenv.mkDerivation rec { function and PAM module that can be used instead of pam_cracklib. The module supports all the options of pam_cracklib. ''; - license = with licenses; [ bsd3 /* or */ gpl2Plus ]; + license = with licenses; [ + bsd3 + # or + gpl2Plus + ]; maintainers = with maintainers; [ jk ]; platforms = platforms.unix; }; From 77bb2a4e7960cfb4589d85d46f1cf468a3563581 Mon Sep 17 00:00:00 2001 From: 06kellyjac Date: Sat, 23 Nov 2024 13:26:25 +0000 Subject: [PATCH 2/2] python312Packages.libpwquality: fix build fix build on python 3.12+ Have some old config to remove in the future via staging --- .../libraries/libpwquality/default.nix | 53 ++++++++++++++----- .../libpwquality/python-binding-root.patch | 13 +++++ 2 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 pkgs/development/libraries/libpwquality/python-binding-root.patch diff --git a/pkgs/development/libraries/libpwquality/default.nix b/pkgs/development/libraries/libpwquality/default.nix index 0f3c3cc9209e..d80f4c8ab318 100644 --- a/pkgs/development/libraries/libpwquality/default.nix +++ b/pkgs/development/libraries/libpwquality/default.nix @@ -33,24 +33,53 @@ stdenv.mkDerivation rec { sha256 = "sha256-YjvHzd4iEBvg+qHOVJ7/y9HqyeT+QDalNE/jdNM9BNs="; }; - patches = [ - # ensure python site-packages goes in $py output - ./python-binding-prefix.patch - - (fetchpatch { - name = "musl.patch"; - url = "https://github.com/libpwquality/libpwquality/commit/b0fcd96954be89e8c318e5328dd27c40b401de96.patch"; - hash = "sha256-ykN1hcRKyX3QAqWTH54kUjOxN6+IwRpqQVsujTd9XWs="; - }) - ]; + patches = + lib.optionals (!enablePython) [ + # this patch isn't useful but keeping it to avoid rebuilds on !enablePython + # before 24.11 fully lands + ./python-binding-prefix.patch + ] + ++ [ + # remove next release + (fetchpatch { + name = "musl.patch"; + url = "https://github.com/libpwquality/libpwquality/commit/b0fcd96954be89e8c318e5328dd27c40b401de96.patch"; + hash = "sha256-ykN1hcRKyX3QAqWTH54kUjOxN6+IwRpqQVsujTd9XWs="; + }) + ] + ++ lib.optionals enablePython [ + # remove next release + (fetchpatch { + name = "pr-74-use-setuptools-instead-of-distutils.patch"; + url = "https://github.com/libpwquality/libpwquality/commit/509b0a744adf533b524daaa65f25dda144a6ff40.patch"; + hash = "sha256-AxiynPVxv/gONujyj8y6b1XlsNkKszzW5TT9oINR/oo="; + }) + # remove next release + (fetchpatch { + name = "pr-80-respect-pythonsitedir.patch"; + url = "https://github.com/libpwquality/libpwquality/commit/f92351b3998542e33d2b243fc446a4dd852dc972.patch"; + hash = "sha256-1lmigZX/UiEFe9b0JXmlfw/371UYT4PF7Ev2Hv66v74="; + }) + # ensure python site-packages goes in $py output + ./python-binding-root.patch + ]; nativeBuildInputs = [ autoreconfHook perl - ] ++ lib.optionals enablePython [ (python.withPackages (ps: with ps; [ distutils ])) ]; + ] ++ lib.optionals enablePython [ (python.withPackages (ps: with ps; [ setuptools ])) ]; buildInputs = [ cracklib ] ++ lib.optionals enablePAM [ pam ]; - configureFlags = lib.optionals (!enablePython) [ "--disable-python-bindings" ]; + configureFlags = + if enablePython then + [ + "--enable-python-bindings=yes" + "--with-pythonsitedir=\"${python.sitePackages}\"" + ] + else + # change to `--enable-python-bindings=no` in the future + # leave for now to avoid rebuilds on !enablePython before 24.11 fully lands + [ "--disable-python-bindings" ]; meta = with lib; { homepage = "https://github.com/libpwquality/libpwquality"; diff --git a/pkgs/development/libraries/libpwquality/python-binding-root.patch b/pkgs/development/libraries/libpwquality/python-binding-root.patch new file mode 100644 index 000000000000..9c789bf2d07d --- /dev/null +++ b/pkgs/development/libraries/libpwquality/python-binding-root.patch @@ -0,0 +1,13 @@ +diff --git a/python/Makefile.am b/python/Makefile.am +index 64d3892..365dc8e 100644 +--- a/python/Makefile.am ++++ b/python/Makefile.am +@@ -14,7 +14,7 @@ all-local: + CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV) + + install-exec-local: +- CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV) install --root ${DESTDIR} --prefix=${prefix} --install-lib=$(pythonsitedir) ++ CFLAGS="${CFLAGS} -fno-strict-aliasing" @PYTHONBINARY@ setup.py build --build-base py$(PYTHONREV) install --root ${py} --install-lib=$(pythonsitedir) + + clean-local: + rm -rf py$(PYTHONREV)