From 6930616dd9403f59729efcfa110ac18d46457ff9 Mon Sep 17 00:00:00 2001 From: yixiangzhike Date: Mon, 7 Sep 2020 14:23:57 +0800 Subject: [PATCH] add python3-cracklib package --- cracklib.spec | 74 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/cracklib.spec b/cracklib.spec index 952ba1f..01d1e10 100644 --- a/cracklib.spec +++ b/cracklib.spec @@ -1,9 +1,12 @@ +%bcond_without python2 +%bcond_without python3 + %define dictdir %{_datadir}/cracklib %define dictpath %{dictdir}/pw_dict Name: cracklib Version: 2.9.7 -Release: 2 +Release: 3 Summary: A password-checking library License: LGPLv2+ @@ -13,7 +16,12 @@ Source1: https://github.com/cracklib/cracklib/releases/download/cracklib-%{versi Patch9000: fix-problem-of-error-message-about-simplistic-passwo.patch BuildRequires: gcc, words, gettext, gettext-autopoint, zlib-devel +%if %{with python2} BuildRequires: python2-devel +%endif +%if %{with python3} +BuildRequires: python3-devel +%endif Conflicts: cracklib-dicts < 2.8 Requires: gzip @@ -42,6 +50,7 @@ for compiling applications which use cracklib. %package_help +%if %{with python2} %package -n python2-cracklib Summary: Python 2 bindings for applications which use cracklib Requires: %{name} = %{version}-%{release} @@ -49,6 +58,17 @@ Requires: %{name} = %{version}-%{release} %description -n python2-cracklib The python2-cracklib package contains a module which permits applications written in the Python 2 programming language to use cracklib. +%endif + +%if %{with python3} +%package -n python3-cracklib +Summary: Python 3 bindings for applications which use cracklib +Requires: %{name} = %{version}-%{release} + +%description -n python3-cracklib +The python3-cracklib package contains a module which permits applications +written in the Python 3 programming language to use cracklib. +%endif %prep %autosetup -n %{name}-%{version} -p1 @@ -60,8 +80,15 @@ do done chmod +x util/cracklib-format +%if %{with python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +%endif + %build +%if %{with python2} sed -i 's,util/cracklib-check <,util/cracklib-check $(DESTDIR)/$(DEFAULT_CRACKLIB_DICT) <,' Makefile.in +export PYTHON=%{__python2} %configure \ --disable-static \ --with-pic \ @@ -69,10 +96,39 @@ sed -i 's,util/cracklib-check <,util/cracklib-check $(DESTDIR)/$(DEFAULT_CRACKLI --with-default-dict=%{dictpath} make -C po update-gmo make +%endif + +%if %{with python3} +pushd %{py3dir} +sed -i 's,util/cracklib-check <,util/cracklib-check $(DESTDIR)/$(DEFAULT_CRACKLIB_DICT) <,' Makefile.in +py3include=`python3-config --includes | awk -F' ' '{print $1;}'` +export PYTHON=%{__python3} +export CFLAGS="%{optflags} $py3include" +abiflags=`python3-config --abiflags` +py_version="%{python3_version}$abiflags" +%configure \ + am_cv_python_version="$py_version" \ + --disable-static \ + --with-pic \ + --with-python \ + --with-default-dict=%{dictpath} +make -C po update-gmo +make +popd +%endif %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT +%if %{with python2} make install DESTDIR=$RPM_BUILD_ROOT 'pythondir=${pyexecdir}' +%endif + +%if %{with python3} +pushd %{py3dir} +make install DESTDIR=$RPM_BUILD_ROOT 'pythondir=${pyexecdir}' +popd +%endif + ./util/cracklib-format cracklib-dicts/* | \ ./util/cracklib-packer $RPM_BUILD_ROOT/%{dictpath} ./util/cracklib-format $RPM_BUILD_ROOT/%{dictdir}/cracklib-small | \ @@ -125,11 +181,23 @@ make test %files help %doc README README-WORDS NEWS +%if %{with python2} %files -n python2-cracklib -%{_libdir}/python*/site-packages/_cracklib*.so -%{_libdir}/python*/site-packages/*.py* +%{_libdir}/python2*/site-packages/_cracklib*.so +%{_libdir}/python2*/site-packages/*.py* +%endif + +%if %{with python3} +%files -n python3-cracklib +%{_libdir}/python3*/site-packages/_cracklib*.so +%{_libdir}/python3*/site-packages/*.py* +%{_libdir}/python3*/site-packages/__pycache__/* +%endif %changelog +* Mon Sep 7 2020 zhangxingliang - 2.9.7-3 +- Add python3-cracklib package + * Sat Jan 18 2020 openEuler Buildteam - 2.9.7-2 - fix problem of error message about simplistic password -- Gitee