Accepting request 1146863 from home:mcalabkova:branches:devel:languages:python:mailman

- Adapt to new RPM 4.19 and properly create mailman user/group (boo#1219674)
- Build on Python 3.12 for the Factory

OBS-URL: https://build.opensuse.org/request/show/1146863
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:mailman/python-mailman?expand=0&rev=91
This commit is contained in:
Matej Cepl 2024-02-16 14:50:09 +00:00 committed by Git OBS Bridge
parent bdb98f9fc5
commit d63b42b854
3 changed files with 40 additions and 16 deletions

3
mailman-user.conf Normal file
View File

@ -0,0 +1,3 @@
#Type Name ID GECOS Home directory Shell
u mailman - "mailman daemon user" /var/lib/mailman -
m mailman lock - - -

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Feb 15 10:53:34 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Adapt to new RPM 4.19 and properly create mailman user/group (boo#1219674)
- Build on Python 3.12 for the Factory
-------------------------------------------------------------------
Tue Jan 23 09:56:40 UTC 2024 - Markéta Machová <mmachova@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file
# spec file for package python-mailman
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -15,7 +15,7 @@
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# keep in sync with setup.py
%global aiosmtpd_min_version 1.4.3
# normally it would be 1.6.2,!=1.7.0 but to avoid super comlex constructs in the spec file ... lets go with the version that we have in TW
%global alembic_min_version 1.12
@ -31,8 +31,6 @@
%global sqlalchemy_min_version 1.4.0
%global zope_interface_min_version 5.0
%define mailman_user mailman
%define mailman_group mailman
%define mailman_name mailman
%define mailman_homedir %{_localstatedir}/lib/%{mailman_name}
%define mailman_logdir %{_localstatedir}/log/%{mailman_name}
@ -49,9 +47,14 @@
%define psuffix %{nil}
%bcond_with test
%endif
%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150500
# Newest python supported by mailman is Python 3.11
%if 0%{?suse_version} >= 1600
# Newest python supported by mailman is Python 3.12, but we have just Python 3.11 in SLE
# See https://gitlab.com/mailman/mailman/-/blob/master/src/mailman/docs/NEWS.rst
%define pythons python312
%define mypython python312
%define mypython_sitelib %{python312_sitelib}
%else
%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150500
%define pythons python311
%define mypython python311
%define mypython_sitelib %{python311_sitelib}
@ -61,6 +64,7 @@
%define mypython python3
%define mypython_sitelib %{python3_sitelib}
%endif
%endif
Name: python-mailman%{psuffix}
Version: 3.3.9
Release: 0
@ -74,6 +78,7 @@ Source10: mailman.cfg
Source11: mailman.service
Source12: mailman-tmpfiles.conf
Source13: mailman.logrotate
Source14: mailman-user.conf
#
Source20: mailman-digests.service
Source21: mailman-digests.timer
@ -93,6 +98,7 @@ Patch0: find-flufl.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: sysuser-tools
%if 0%{?suse_version} >= 1550
# use the real python3 primary for rpm pythondistdeps.py
BuildRequires: python3-packaging
@ -128,7 +134,6 @@ Requires: %{mypython}-passlib
Requires: %{mypython}-psycopg2
Requires: %{mypython}-python-dateutil >= %{python_dateutil_min_version}
Requires: %{mypython}-requests
Requires: %{mypython}-setuptools
Requires: %{mypython}-zope.component
Requires: %{mypython}-zope.configuration
Requires: %{mypython}-zope.event
@ -136,12 +141,12 @@ Requires: %{mypython}-zope.interface >= %{zope_interface_min_version}
Requires: logrotate
Requires(pre): /usr/sbin/groupadd
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires(postun): update-alternatives
Provides: mailman = %{version}
%if "%{expand:%%%{mypython}_provides}" == "python3"
Provides: python3-mailman = %{version}-%{release}
%endif
%if %{expand:%%%{mypython}_version_nodots} < 39
%if 0%{?suse_version} < 1550
Requires: %{mypython}-importlib-resources >= 1.1.0
%endif
Obsoletes: python3-mailman < %{version}-%{release}
@ -152,6 +157,13 @@ Obsoletes: %{mypython}-mailman < %{version}-%{release}
%description -n mailman3
Mailman is a mailing list manager from the GNU project.
%package -n system-user-%{mailman_name}
Summary: System user and group mailman
%sysusers_requires
%description -n system-user-%{mailman_name}
System user for use by the mailman client.
%prep
%autosetup -p1 -n mailman-%{version}
@ -175,6 +187,8 @@ sed '/importlib_resources/d' -i src/mailman.egg-info/requires.txt setup.py
%python_build
./generate_mo.sh
%sysusers_generate_pre %{SOURCE14} mailman system-user-%{mailman_name}.conf
%install
%if !%{with test}
%python_install
@ -209,6 +223,8 @@ install -m 0640 %{SOURCE10} %{buildroot}%{_sysconfdir}/%{mailman_name}.cfg
install -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}/%{mailman_name}.service
install -m 0644 %{SOURCE12} %{buildroot}%{_tmpfilesdir}/%{mailman_name}.conf
install -D -m 0644 %{SOURCE14} %{buildroot}%{_sysusersdir}/system-user-%{mailman_name}.conf
install -m 0644 %{SOURCE20} %{buildroot}%{_unitdir}/%{mailman_name}-digests.service
install -m 0644 %{SOURCE21} %{buildroot}%{_unitdir}/%{mailman_name}-digests.timer
install -m 0644 %{SOURCE22} %{buildroot}%{_unitdir}/%{mailman_name}-notify.service
@ -245,13 +261,9 @@ sed -i "s:\(902\):4\1:" src/mailman/testing/testing.cfg
%endif
%if !%{with test}
%pre -n system-user-%{mailman_name} -f mailman.pre
%pre -n mailman3
getent group %{mailman_group} >/dev/null || \
%{_sbindir}/groupadd -r %{mailman_group}
getent passwd %{mailman_user} >/dev/null || \
%{_sbindir}/useradd -r -g %{mailman_group} -s /sbin/nologin \
-c "mailman daemon user" -d %{mailman_homedir} %{mailman_user}
%{_sbindir}/usermod -g %{mailman_group} %{mailman_user} >/dev/null
%service_add_pre %{mailman_services}
%if 0%{?suse_version} > 1500
# Prepare for migration to /usr/etc; save any old .rpmsave
@ -307,6 +319,9 @@ done
%ghost %dir %{mailman_rundir}
%ghost %dir %{_rundir}/lock
%ghost %dir %{mailman_lockdir}
%files -n system-user-%{mailman_name}
%{_sysusersdir}/system-user-%{mailman_name}.conf
%endif
%changelog