[packages/python-cracklib] - extracted from cracklib.spec, adjusted to build against system cracklib

qboosh qboosh at pld-linux.org
Wed Nov 18 05:34:06 CET 2026


commit 232b555f730c3ab6625f708e50aabf63247ab98a
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Wed Nov 18 05:33:53 2026 +0100

    - extracted from cracklib.spec, adjusted to build against system cracklib

 cracklib-system-lib.patch | 43 ++++++++++++++++++++++++++++++++++
 python-cracklib.spec      | 59 +++++++++++++++++++++++++++++++++++++++++++++++
 python-flags.patch        | 46 ++++++++++++++++++++++++++++++++++++
 3 files changed, 148 insertions(+)
---
diff --git a/python-cracklib.spec b/python-cracklib.spec
new file mode 100644
index 0000000..d9614b6
--- /dev/null
+++ b/python-cracklib.spec
@@ -0,0 +1,59 @@
+Summary:	Python 2 binding for cracklib
+Summary(pl.UTF-8):	Wiązanie Pythona 2 do crackliba
+Name:		python-cracklib
+# keep 2.10.3 here, it's the last version with python2 support
+Version:	2.10.3
+Release:	1
+License:	LGPL v2.1+
+Group:		Libraries
+#Source0Download: https://github.com/cracklib/cracklib/releases
+Source0:	https://github.com/cracklib/cracklib/releases/download/v%{version}/cracklib-%{version}.tar.xz
+# Source0-md5:	e8ea2b86de774fc09fdd0f2829680b19
+Patch0:		python-flags.patch
+Patch1:		cracklib-system-lib.patch
+URL:		https://github.com/cracklib/cracklib
+BuildRequires:	cracklib-devel >= %{version}
+BuildRequires:	python-devel >= 1:2.5
+BuildRequires:	python-modules >= 1:2.5
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+BuildRequires:	tar >= 1:1.22
+BuildRequires:	xz
+Requires:	cracklib%{?_isa} >= %{version}
+Requires:	python-libs%{?_isa} >= 1:2.5
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Python 2 binding for cracklib.
+
+%description -l pl.UTF-8
+Wiązanie Pythona 2 do crackliba.
+
+%prep
+%setup -q -n cracklib-%{version}
+%patch -P0 -p1
+%patch -P1 -p1
+
+%{__sed} -e 's/@VERSION@/%{version}/' python/setup.py.in >python/setup.py
+
+%build
+cd python
+%py_build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+cd python
+%py_install
+
+%py_postclean
+%{__rm} $RPM_BUILD_ROOT%{py_sitedir}/test_cracklib.py*
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%{py_sitedir}/_cracklib.so
+%{py_sitedir}/cracklib.py[co]
+%{py_sitedir}/cracklib-%{version}-py*.egg-info
diff --git a/cracklib-system-lib.patch b/cracklib-system-lib.patch
new file mode 100644
index 0000000..6eac0f3
--- /dev/null
+++ b/cracklib-system-lib.patch
@@ -0,0 +1,43 @@
+--- cracklib-2.10.4/python/setup.py.in.orig	2023-04-02 20:15:05.000000000 +0200
++++ cracklib-2.10.4/python/setup.py.in	2026-11-17 21:35:06.549289006 +0100
+@@ -21,10 +21,9 @@ from setuptools import setup, Extension
+ 
+ extensions = [
+     Extension("_cracklib",
+-        ["@srcdir@/_cracklib.c"],
+-        include_dirs = ["@top_builddir@", "@top_srcdir@/lib"],
++        ["_cracklib.c"],
+         libraries = ["crack"],
+-        library_dirs = ["@top_builddir@/lib/.libs"]),
++        ),
+ ]
+ 
+ setup(
+@@ -41,7 +40,7 @@ convenience functions.
+     url="http://cracklib.sourceforge.net/",
+     license="GPLv2+",
+     py_modules=['cracklib', 'test_cracklib'],
+-    package_dir={'': '@srcdir@'},
++    package_dir={'': '.'},
+     ext_modules=extensions,
+     zip_safe=False,
+     classifiers=[
+--- cracklib-2.10.3/python/_cracklib.c.orig	2023-03-16 14:38:03.000000000 +0100
++++ cracklib-2.10.3/python/_cracklib.c	2026-11-17 22:15:13.469582932 +0100
+@@ -23,7 +23,15 @@
+  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+  */
+ 
+-#include "config.h"
++#define HAVE_PTHREAD_H 1
++#define HAVE_SYS_STAT_H 1
++#define HAVE_LIBINTL_H 1
++#define HAVE_PTHREAD_H 1
++#define HAVE_ZLIB_H 1
++#define ENABLE_NLS 1
++#define PACKAGE "cracklib"
++#define LOCALEDIR "/usr/share/locale"
++
+ #ifdef PYTHON_H
+ #include PYTHON_H
+ #else
diff --git a/python-flags.patch b/python-flags.patch
new file mode 100644
index 0000000..7ad1b08
--- /dev/null
+++ b/python-flags.patch
@@ -0,0 +1,46 @@
+--- cracklib-2.10.2/configure.ac.orig	2024-07-27 16:01:33.000000000 +0200
++++ cracklib-2.10.2/configure.ac	2025-03-14 23:19:05.715368741 +0100
+@@ -76,19 +76,23 @@
+                       AC_MSG_ERROR([python was required but not found])
+                    fi])
+    if test "$build_python" != no ; then
+-      AC_CHECK_HEADERS(python${PYTHON_VERSION}/Python.h,,
+-		       [if test "$build_python" != yes ; then
+-		           AC_MSG_WARN([python headers not found, continuing])
+-			   build_python=no
+-			else
+-		           AC_MSG_ERROR([python headers not found])
+-			fi])
++       if command -v $PYTHON-config > /dev/null; then
++           PYTHON_CFLAGS=`$PYTHON-config --cflags`
++       else
++           if test "$build_python" != yes ; then
++               AC_MSG_WARN([$PYTHON-config not found, continuing])
++               build_python=no
++	   else
++               AC_MSG_ERROR([$PYTHON-config not found])
++           fi
++       fi
+    fi
+    if test "$build_python" != no ; then
+       build_python=yes
+    fi
+ fi
+ AM_CONDITIONAL(BUILD_PYTHON,[test "$build_python" = "yes"])
++AC_SUBST(PYTHON_CFLAGS)
+ 
+ dnl Handle local dict compiling properly
+ AC_SUBST(CROSS_COMPILING, $cross_compiling)
+--- cracklib-2.10.2/python/Makefile.am.orig	2023-03-16 14:38:03.000000000 +0100
++++ cracklib-2.10.2/python/Makefile.am	2025-03-14 23:18:25.303271452 +0100
+@@ -2,9 +2,8 @@
+ python_PYTHON = cracklib.py test_cracklib.py
+ pyexec_LTLIBRARIES = _cracklib.la
+ AM_CFLAGS = -I$(top_srcdir)/lib -Wall
+-AM_CPPFLAGS = '-DLOCALEDIR="$(localedir)"'
++AM_CPPFLAGS = '-DLOCALEDIR="$(localedir)"' $(PYTHON_CFLAGS)
+ _cracklib_la_LDFLAGS = -module -avoid-version $(top_builddir)/lib/libcrack.la
+ DEFS += '-DDEFAULT_CRACKLIB_DICT="$(DEFAULT_CRACKLIB_DICT)"'
+-DEFS += '-DPYTHON_H="python at PYTHON_VERSION@/Python.h"'
+ endif
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-cracklib.git/commitdiff/232b555f730c3ab6625f708e50aabf63247ab98a



More information about the pld-cvs-commit mailing list