File PyPAM.spec of Package PyPAM
Summary: PAM bindings for Python
Name: PyPAM
Version: 0.5.0
Release: 50%{?dist}
# Note that the upstream site is dead.
Source0: http://www.pangalactic.org/PyPAM/%{name}-%{version}.tar.gz
Url: http://www.pangalactic.org/PyPAM
# PATCH-FIX-OPENSUSE PyPAM-dlopen.patch -- Open libpam.so.0 instead of generic libpam.so.
Patch0: PyPAM-dlopen.patch
# PATCH-FIX-OPENSUSE PyPAM-0.5.0-dealloc.patch -- Fix memory cleanup. Should go upstream, but upstream is dead...
Patch1: PyPAM-0.5.0-dealloc.patch
# PATCH-FIX-OPENSUSE PyPAM-0.5.0-nofree.patch tmraz@redhat.com -- Only free response data in case of errors, fixing a segfault (rh#679557).
Patch2: PyPAM-0.5.0-nofree.patch
# PATCH-FIX-OPENSUSE PyPAM-0.5.0-memory-errors.patch tmraz@redhat.com -- Fix memory manipulation errors (leaks, doublefree CVE-2012-1502).
Patch3: PyPAM-0.5.0-memory-errors.patch
# PATCH-FIX-OPENSUSE PyPAM-0.5.0-return-value.patch tmraz@redhat.com -- Always return the error code in exceptions (rh#819244).
Patch4: PyPAM-0.5.0-return-value.patch
# PATCH-FIX-OPENSUSE PyPAM-python3-support.patch bkabrda@redhat.com -- Add Python 3 support (rh#1112732).
Patch5: PyPAM-python3-support.patch
# PATCH-FIX-OPENSUSE PyPAM-0.5.0-missing-headers.patch ionic@ionic.de -- strdup() is not part of C99, enable POSIX support to fix broken binaries.
Patch6: PyPAM-0.5.0-missing-headers.patch
License: LGPL-2.1-only
BuildRequires: pam-devel
BuildRequires: gcc
%global _description\
PAM (Pluggable Authentication Module) bindings for Python.
%description %_description
%package -n python3-PyPAM
Summary: PAM bindings for Python 3
BuildRequires: python3-devel
%description -n python3-PyPAM
PAM (Pluggable Authentication Module) bindings for Python 3.
%prep
%setup -q
%patch0 -p1 -b .dlopen
%patch1 -p1 -b .dealloc
%patch2 -p1 -b .nofree
%patch3 -p1 -b .memory
%patch4 -p1 -b .retval
%patch5 -p0 -b .python3
%patch6 -p1 -b .headers
# remove prebuild rpm and others binaries
rm -rf build dist
%build
%if (0%{?suse_version} < 1550 && 0%{?sle_version} < 150400)
# We don't want to actually run configure, but get the flags exported only.
%define _configure :
%configure
%else
%set_build_flags
%endif
CFLAGS="$CFLAGS -fno-strict-aliasing" %{__python3} setup.py build
%install
%{__python3} setup.py install --root=$RPM_BUILD_ROOT
# Make sure we don't include binary files in the docs
chmod 644 examples/pamtest.py
rm -f examples/pamexample
%check
PYTHONPATH=build/lib.linux-`uname -m`-%{python3_version}/ %{__python3} tests/PamTest.py
%files -n python3-PyPAM
%{python3_sitearch}/PAM*.so
%{python3_sitearch}/*.egg-info
%license COPYING
%doc AUTHORS NEWS README ChangeLog INSTALL
%doc examples
%changelog