File pam-python.spec of Package pam-python
#
# spec file for package pam-python
#
# Copyright (c) 2022 SUSE Software Solutions Germany GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# We need elevated access for the tests.
# needsrootforbuild
%{!?_pam_moduledir: %define _pam_moduledir /%{_lib}/security}
%define pythons python3
%define base_ver 1.0.8
%define deb_ver 1
%define git_inc 19
%define git_short_sha ec2d2d2
%define git_full_sha ec2d2d2fdf97d1dc73d570e333eb85d7cf9c120f
Name: pam-python
Version: %{base_ver}.%{deb_ver}+git%{git_inc}.g%{git_short_sha}
Release: 0
Summary: PAM module that allows PAM modules to be written in Python
License: AGPL-3.0-only
Group: Productivity/Security
URL: https://pam-python.sourceforge.net/
Source0: https://github.com/Ionic/%{name}/archive/%{git_full_sha}.tar.gz#/%{name}-%{version}.tar.gz
Source1: baselibs.conf
# PATCH-FIX-OPENSUSE pam-python-intersphinx-localmapping.diff pere@debian.org -- Build documentation without requiring network access.
Patch0: %{name}-intersphinx-localmapping.diff
Patch1: werror.patch
# PATCH-FIX-OPENSUSE pam-python-use-lpython-ABI-tag.patch ionic@ionic.de -- Newer Python distutils (3.8+) no longer link libpython by default and PEP3149 modified libraries to include their ABI tag, so make sure to append the proper ABI tag.
Patch2: %{name}-use-lpython-ABI-tag.patch
Patch3: %{name}-debug-tests.patch
BuildRequires: gcc
BuildRequires: pam-devel
BuildRequires: python-doc
BuildRequires: %{python_module devel}
BuildRequires: %{python_module Sphinx}
# For testing only.
BuildRequires: %{python_module PyPAM}
BuildRequires: sudo
Provides: pam-modules:%{_pam_moduledir}/pam-python.so
%description
pam_python is a PAM module that runs the Python interpreter, and so
allows PAM modules to be written in Python.
%prep
%setup -n %{name}-%{git_full_sha}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
# XX: the build system overrides CFLAGS, but flags for the preprocessor are passed to the C compiler
export CPPFLAGS='-DDEFAULT_SECURITY_DIR=\"%{_pam_moduledir}\" %{optflags}'
make PYTHON="$(basename "%{__python3}")"
%install
export LIBDIR=%{buildroot}/%{_pam_moduledir}
make install-lib
%check
# The tests here require elevated access, and this needs
# "BuildFlags: allowrootforbuild" in the prjconf, as well as a comment stating
# "needsrootforbuild" somewhere at the top of the spec file.
make PYTHON="$(basename "%{__python3}")" test
%files
%license agpl-3.0.txt
%{_pam_moduledir}/pam_python.so
%changelog