!4 【Mainline】add python3-cracklib package

Merge pull request !4 from yixiangzhike/master
This commit is contained in:
openeuler-ci-bot 2020-09-07 12:49:45 +08:00 committed by Gitee
commit d11b865876

View File

@ -1,9 +1,12 @@
%bcond_without python2
%bcond_without python3
%define dictdir %{_datadir}/cracklib %define dictdir %{_datadir}/cracklib
%define dictpath %{dictdir}/pw_dict %define dictpath %{dictdir}/pw_dict
Name: cracklib Name: cracklib
Version: 2.9.7 Version: 2.9.7
Release: 2 Release: 3
Summary: A password-checking library Summary: A password-checking library
License: LGPLv2+ 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 Patch9000: fix-problem-of-error-message-about-simplistic-passwo.patch
BuildRequires: gcc, words, gettext, gettext-autopoint, zlib-devel BuildRequires: gcc, words, gettext, gettext-autopoint, zlib-devel
%if %{with python2}
BuildRequires: python2-devel BuildRequires: python2-devel
%endif
%if %{with python3}
BuildRequires: python3-devel
%endif
Conflicts: cracklib-dicts < 2.8 Conflicts: cracklib-dicts < 2.8
Requires: gzip Requires: gzip
@ -42,6 +50,7 @@ for compiling applications which use cracklib.
%package_help %package_help
%if %{with python2}
%package -n python2-cracklib %package -n python2-cracklib
Summary: Python 2 bindings for applications which use cracklib Summary: Python 2 bindings for applications which use cracklib
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
@ -49,6 +58,17 @@ Requires: %{name} = %{version}-%{release}
%description -n python2-cracklib %description -n python2-cracklib
The python2-cracklib package contains a module which permits applications The python2-cracklib package contains a module which permits applications
written in the Python 2 programming language to use cracklib. 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 %prep
%autosetup -n %{name}-%{version} -p1 %autosetup -n %{name}-%{version} -p1
@ -60,8 +80,15 @@ do
done done
chmod +x util/cracklib-format chmod +x util/cracklib-format
%if %{with python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build %build
%if %{with python2}
sed -i 's,util/cracklib-check <,util/cracklib-check $(DESTDIR)/$(DEFAULT_CRACKLIB_DICT) <,' Makefile.in sed -i 's,util/cracklib-check <,util/cracklib-check $(DESTDIR)/$(DEFAULT_CRACKLIB_DICT) <,' Makefile.in
export PYTHON=%{__python2}
%configure \ %configure \
--disable-static \ --disable-static \
--with-pic \ --with-pic \
@ -69,10 +96,39 @@ sed -i 's,util/cracklib-check <,util/cracklib-check $(DESTDIR)/$(DEFAULT_CRACKLI
--with-default-dict=%{dictpath} --with-default-dict=%{dictpath}
make -C po update-gmo make -C po update-gmo
make 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 %install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
%if %{with python2}
make install DESTDIR=$RPM_BUILD_ROOT 'pythondir=${pyexecdir}' 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-format cracklib-dicts/* | \
./util/cracklib-packer $RPM_BUILD_ROOT/%{dictpath} ./util/cracklib-packer $RPM_BUILD_ROOT/%{dictpath}
./util/cracklib-format $RPM_BUILD_ROOT/%{dictdir}/cracklib-small | \ ./util/cracklib-format $RPM_BUILD_ROOT/%{dictdir}/cracklib-small | \
@ -125,11 +181,23 @@ make test
%files help %files help
%doc README README-WORDS NEWS %doc README README-WORDS NEWS
%if %{with python2}
%files -n python2-cracklib %files -n python2-cracklib
%{_libdir}/python*/site-packages/_cracklib*.so %{_libdir}/python2*/site-packages/_cracklib*.so
%{_libdir}/python*/site-packages/*.py* %{_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 %changelog
* Thu Sep 3 2020 zhangxingliang <zhangxingliang3@huawei.com> - 2.9.7-3
- Add python3-cracklib package
* Sat Jan 18 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.9.7-2 * Sat Jan 18 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.9.7-2
- fix problem of error message about simplistic password - fix problem of error message about simplistic password