2019-09-24 15:50:44 +02:00
#
2021-07-21 03:52:20 +02:00
# spec file
2019-09-24 15:50:44 +02:00
#
2023-02-06 06:02:31 +01:00
# Copyright (c) 2023 SUSE LLC
2019-09-24 15:50:44 +02:00
#
# 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.
2019-10-09 14:38:25 +02:00
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
2023-11-06 09:24:27 +01:00
# 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
%global authheaders_min_version 0.15.2
%global authres_min_version 1.0.1
%global click_min_version 8.0.0
%global dnspython_min_version 1.14.0
%global falcon_min_version 3.0.0
%global flufl_bounce_min_version 4.0
%global flufl_i18n_min_version 3.2
%global flufl_lock_min_version 5.1
%global python_dateutil_min_version 2.0
%global sqlalchemy_min_version 1.4.0
%global zope_interface_min_version 5.0
2019-09-24 15:50:44 +02:00
2020-09-29 09:54:08 +02:00
%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}
%define mailman_spooldir %{_localstatedir}/spool/%{mailman_name}
%define mailman_rundir %{_rundir}/%{mailman_name}
%define mailman_lockdir %{_rundir}/lock/%{mailman_name}
2020-12-18 10:42:38 +01:00
%global mailman_services %{mailman_name} .service %{mailman_name} -digests.service %{mailman_name} -digests.timer %{mailman_name} -notify.service %{mailman_name} -notify.timer
2020-12-15 11:04:54 +01:00
2019-10-01 10:05:42 +02:00
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
2023-06-19 13:33:29 +02:00
%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150500
# Newest python supported by mailman is Python 3.11
# See https://gitlab.com/mailman/mailman/-/blob/master/src/mailman/docs/NEWS.rst
%define pythons python311
%define mypython python311
%define mypython_sitelib %{python311_sitelib}
2022-07-04 20:09:33 +02:00
%else
2021-05-04 20:34:22 +02:00
%{?!python_module:%define python_module() python3-%{**}}
%define pythons python3
2022-07-04 20:09:33 +02:00
%define mypython python3
%define mypython_sitelib %{python3_sitelib}
%endif
2019-11-05 20:06:23 +01:00
Name : python-mailman%{psuffix}
2023-11-03 10:09:14 +01:00
Version : 3.3.9
2019-09-24 15:50:44 +02:00
Release : 0
2022-01-18 22:34:18 +01:00
Summary : A Mailing List Manager
2021-11-19 22:32:21 +01:00
Group : Productivity/Networking/Email/Mailinglists
2019-10-09 14:38:25 +02:00
License : GPL-3.0-only
URL : https://www.list.org
2020-09-29 09:54:08 +02:00
Source0 : https://files.pythonhosted.org/packages/source/m/mailman/mailman-%{version} .tar.gz
#
Source10 : mailman.cfg
Source11 : mailman.service
Source12 : mailman-tmpfiles.conf
Source13 : mailman.logrotate
#
Source20 : mailman-digests.service
Source21 : mailman-digests.timer
2020-12-18 10:42:38 +01:00
Source22 : mailman-notify.service
Source23 : mailman-notify.timer
2020-09-29 09:54:08 +02:00
#
Source30 : README.SUSE.md
2021-11-19 22:32:21 +01:00
Source31 : python-mailman.rpmlintrc
2020-09-29 09:54:08 +02:00
#
2020-04-24 10:23:29 +02:00
Source100 : https://gitlab.com/mailman/mailman/-/raw/master/src/mailman/testing/ssl_test_cert.crt
Source101 : https://gitlab.com/mailman/mailman/-/raw/master/src/mailman/testing/ssl_test_key.key
2023-08-28 14:17:47 +02:00
#
2024-01-23 11:20:07 +01:00
# PATCH-FIX-OPENSUSE mmachova@suse.com based on upstream merge request https://gitlab.com/mailman/mailman/-/merge_requests/1123
# it won't be needed with new releases of flufl.lock and flufl.i18n, because the issue was fixed in pdm upstream https://github.com/pdm-project/pdm/pull/2057
Patch0 : find-flufl.patch
#
2019-09-24 15:50:44 +02:00
BuildRequires : %{python_module setuptools}
BuildRequires : fdupes
2022-07-04 20:09:33 +02:00
BuildRequires : python-rpm-macros
%if 0%{?suse_version} >= 1550
# use the real python3 primary for rpm pythondistdeps.py
BuildRequires : python3-packaging
%endif
2019-09-24 15:50:44 +02:00
BuildArch : noarch
2019-10-09 14:38:25 +02:00
%if %{with test}
BuildRequires : %{python_module flufl.testing}
BuildRequires : %{python_module nose2}
BuildRequires : %{python_module pytest}
2022-07-04 20:09:33 +02:00
BuildRequires : mailman3 = %{version}
2021-05-04 20:34:22 +02:00
%endif
2019-09-24 15:50:44 +02:00
%description
2021-02-04 08:21:19 +01:00
Mailman is a mailing list manager from the GNU project.
2019-09-24 15:50:44 +02:00
2022-01-18 22:34:18 +01:00
%package -n mailman3
Summary : A mailing list manager
2023-11-06 09:24:27 +01:00
Requires : %{mypython} -SQLAlchemy >= %{sqlalchemy_min_version}
Requires : %{mypython} -aiosmtpd >= %{aiosmtpd_min_version}
Requires : %{mypython} -alembic >= %{alembic_min_version}
2022-07-04 20:09:33 +02:00
Requires : %{mypython} -atpublic
2023-11-06 09:24:27 +01:00
Requires : %{mypython} -authheaders >= %{authheaders_min_version}
Requires : %{mypython} -authres >= %{authres_min_version}
Requires : %{mypython} -click >= %{click_min_version}
Requires : %{mypython} -dnspython >= %{dnspython_min_version}
Requires : %{mypython} -falcon > %{falcon_min_version}
Requires : %{mypython} -flufl.bounce >= %{flufl_bounce_min_version}
Requires : %{mypython} -flufl.i18n >= %{flufl_i18n_min_version}
Requires : %{mypython} -flufl.lock >= %{flufl_lock_min_version}
2022-07-04 20:09:33 +02:00
Requires : %{mypython} -gunicorn
Requires : %{mypython} -lazr.config
Requires : %{mypython} -passlib
2023-08-28 14:17:47 +02:00
Requires : %{mypython} -psycopg2
2023-11-06 09:24:27 +01:00
Requires : %{mypython} -python-dateutil >= %{python_dateutil_min_version}
2022-07-04 20:09:33 +02:00
Requires : %{mypython} -requests
Requires : %{mypython} -setuptools
Requires : %{mypython} -zope.component
Requires : %{mypython} -zope.configuration
Requires : %{mypython} -zope.event
2023-11-06 09:24:27 +01:00
Requires : %{mypython} -zope.interface >= %{zope_interface_min_version}
2022-02-21 07:33:58 +01:00
Requires : logrotate
2023-09-21 12:02:18 +02:00
Requires(pre) : /usr/sbin/groupadd
2022-02-21 07:33:58 +01:00
Requires(post) : update-alternatives
Requires(postun) : update-alternatives
Provides : mailman = %{version}
2022-07-04 20:09:33 +02:00
%if "%{expand:%%%{mypython}_provides}" == "python3"
Provides : python3-mailman = %{version} -%{release}
%endif
2024-01-23 11:20:07 +01:00
%if %{expand:%%%{mypython}_version_nodots} < 39
Requires : %{mypython} -importlib-resources >= 1.1.0
%endif
2022-07-04 20:09:33 +02:00
Obsoletes : python3-mailman < %{version} -%{release}
# help in replacing any previously installed multiflavor package back to the unprefixed package
Provides : %{mypython} -mailman = %{version} -%{release}
Obsoletes : %{mypython} -mailman < %{version} -%{release}
2022-01-18 22:34:18 +01:00
%description -n mailman3
Mailman is a mailing list manager from the GNU project.
2019-09-24 15:50:44 +02:00
%prep
2021-02-04 08:21:19 +01:00
%autosetup -p1 -n mailman-%{version}
2019-09-24 15:50:44 +02:00
2020-04-24 10:23:29 +02:00
# https://gitlab.com/mailman/mailman/-/issues/704
cp %{SOURCE100} src/mailman/testing/
cp %{SOURCE101} src/mailman/testing/
2020-09-29 09:54:08 +02:00
cp %{SOURCE30} .
2020-04-24 10:23:29 +02:00
2019-09-24 15:50:44 +02:00
%build
2019-12-02 12:04:53 +01:00
sed -i 's:/sbin:%{_prefix}/bin:' src/mailman/config/mailman.cfg
2020-01-17 15:44:30 +01:00
%if 0%{?suse_version} > 1500
2019-09-26 16:09:00 +02:00
pushd src/mailman
2019-10-09 14:38:25 +02:00
for i in $(grep -r '^from importlib_resources' | sed 's/\(.*\.py\):.*/\1/' ); do
2019-09-26 16:09:00 +02:00
line=$(grep '^from importlib_resources' $i)
what_import=$(echo $line | sed 's:.* import ::' )
sed -i " s @ ^ \ ( f r o m i m p o r t l i b _ r e s o u r c e s . * \ ) @ t r y : \n f r o m i m p o r t l i b . r e s o u r c e s i m p o r t $ w h a t _ i m p o r t \n e x c e p t I m p o r t E r r o r : \n \1 \n @ " $i;
done
popd
2019-10-01 10:05:42 +02:00
sed '/importlib_resources/d' -i src/mailman.egg-info/requires.txt setup.py
2020-01-17 15:44:30 +01:00
%endif
2019-09-24 15:50:44 +02:00
%python_build
2023-03-31 08:12:43 +02:00
./generate_mo.sh
2019-09-24 15:50:44 +02:00
%install
2019-10-01 10:05:42 +02:00
%if !%{with test}
2019-09-24 15:50:44 +02:00
%python_install
%python_expand %fdupes %{buildroot} %{$python_sitelib}
2020-09-29 09:54:08 +02:00
install -d -m 0755 \
%{buildroot} %{_sysconfdir} \
%{buildroot} %{_sysconfdir} /%{mailman_name} .d \
%{buildroot} %{_tmpfilesdir} \
2020-12-18 10:42:38 +01:00
%{buildroot} %{_sbindir} \
2020-09-29 09:54:08 +02:00
%{buildroot} %{_unitdir} \
%{buildroot} %{mailman_homedir} \
%{buildroot} %{mailman_homedir} /data \
%{buildroot} %{mailman_rundir} \
%{buildroot} %{mailman_lockdir} \
%{buildroot} %{mailman_logdir} \
%{buildroot} %{mailman_spooldir}
2022-09-01 11:53:21 +02:00
%if 0%{?suse_version} > 1500
install -d -m 0755 %{buildroot} %{_distconfdir} /logrotate.d
install -m 0644 %{SOURCE13} %{buildroot} %{_distconfdir} /logrotate.d/%{mailman_name}
sed -i 's,@LOGDIR@,%{mailman_logdir},g;s,@BINDIR@,%{_bindir},g' \
%{buildroot} %{_distconfdir} /logrotate.d/%{mailman_name}
%else
install -d -m 0755 %{buildroot} %{_sysconfdir} /logrotate.d
2020-09-29 09:54:08 +02:00
install -m 0644 %{SOURCE13} %{buildroot} %{_sysconfdir} /logrotate.d/%{mailman_name}
sed -i 's,@LOGDIR@,%{mailman_logdir},g;s,@BINDIR@,%{_bindir},g' \
%{buildroot} %{_sysconfdir} /logrotate.d/%{mailman_name}
2022-09-01 11:53:21 +02:00
%endif
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
2020-09-29 09:54:08 +02:00
install -m 0644 %{SOURCE20} %{buildroot} %{_unitdir} /%{mailman_name} -digests.service
install -m 0644 %{SOURCE21} %{buildroot} %{_unitdir} /%{mailman_name} -digests.timer
2020-12-18 10:42:38 +01:00
install -m 0644 %{SOURCE22} %{buildroot} %{_unitdir} /%{mailman_name} -notify.service
install -m 0644 %{SOURCE23} %{buildroot} %{_unitdir} /%{mailman_name} -notify.timer
ln -s /sbin/service %{buildroot} %{_sbindir} /rc%{mailman_name}
ln -s /sbin/service %{buildroot} %{_sbindir} /rc%{mailman_name} -digests
ln -s /sbin/service %{buildroot} %{_sbindir} /rc%{mailman_name} -notify
2021-11-19 22:32:21 +01:00
2019-10-01 10:05:42 +02:00
%endif
2019-09-24 15:50:44 +02:00
%check
2019-10-01 10:05:42 +02:00
%if %{with test}
2020-01-17 15:44:30 +01:00
export LANG=C.UTF-8
2020-01-23 16:18:10 +01:00
%if 0%{?suse_version} <= 1500
2020-01-17 15:44:30 +01:00
# mailman.rest.tests.test_wsgiapp.TestSupportedContentType
# AssertionError: 'application/json; charset=UTF-8' != 'application/json'
rm src/mailman/rest/tests/test_wsgiapp.py
%endif
2019-11-05 20:06:23 +01:00
# doctest fails miserably
find -name '*.rst' -exec rm {} \;
# used to have ports 902{4,5}
rm src/mailman/mta/tests/test_aliases.py
# PermissionError: [Errno 13] Permission denied: '/usr/bin/master'
2019-10-01 10:05:42 +02:00
rm src/mailman/core/tests/test_logging.py
2019-11-05 20:06:23 +01:00
# PermissionError: [Errno 13] Permission denied: '/usr/bin/master'
rm src/mailman/commands/tests/test_cli_control.py
2019-12-10 17:57:02 +01:00
# https://gitlab.com/mailman/mailman/issues/654
rm src/mailman/commands/tests/test_cli_create.py
2019-11-05 20:06:23 +01:00
# do not use well known ports 9024 and 9025
sed -i " s : \ ( 9 0 2 \ ) : 4 \1 : " src/mailman/testing/testing.cfg
#
2019-09-26 16:09:00 +02:00
%python_exec -m nose2 -v
2019-10-01 10:05:42 +02:00
%endif
2019-09-24 15:50:44 +02:00
2019-10-01 10:05:42 +02:00
%if !%{with test}
2022-01-18 22:34:18 +01:00
%pre -n mailman3
2020-09-29 09:54:08 +02:00
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 " m a i l m a n d a e m o n u s e r " -d %{mailman_homedir} %{mailman_user}
%{_sbindir} /usermod -g %{mailman_group} %{mailman_user} >/dev/null
2020-12-15 11:04:54 +01:00
%service_add_pre %{mailman_services}
2022-09-01 11:53:21 +02:00
%if 0%{?suse_version} > 1500
# Prepare for migration to /usr/etc; save any old .rpmsave
for i in logrotate.d/%{mailman_name} ; do
test -f %{_sysconfdir} /${i}.rpmsave && mv -v %{_sysconfdir} /${i}.rpmsave %{_sysconfdir} /${i}.rpmsave.old ||:
done
%endif
%if 0%{?suse_version} > 1500
%posttrans -n mailman3
# Migration to /usr/etc, restore just created .rpmsave
for i in logrotate.d/%{mailman_name} ; do
test -f %{_sysconfdir} /${i}.rpmsave && mv -v %{_sysconfdir} /${i}.rpmsave %{_sysconfdir} /${i} ||:
done
%endif
2020-09-29 09:54:08 +02:00
2022-01-18 22:34:18 +01:00
%post -n mailman3
2020-09-29 09:54:08 +02:00
%tmpfiles_create %{_tmpfilesdir} /%{mailman_name} .conf
2020-12-15 11:04:54 +01:00
%service_add_post %{mailman_services}
2020-09-29 09:54:08 +02:00
2022-01-18 22:34:18 +01:00
%preun -n mailman3
2020-12-15 11:04:54 +01:00
%service_del_preun %{mailman_services}
2020-05-25 10:14:38 +02:00
2022-01-18 22:34:18 +01:00
%postun -n mailman3
2020-12-15 11:04:54 +01:00
%service_del_postun %{mailman_services}
2020-05-25 10:14:38 +02:00
2022-01-18 22:34:18 +01:00
%files -n mailman3
2023-11-03 10:09:14 +01:00
%doc README.rst README.SUSE.md src/mailman/docs/NEWS.rst
2019-09-24 15:50:44 +02:00
%license COPYING
2020-12-18 10:42:38 +01:00
%{_sbindir} /rc%{mailman_name} *
2021-05-04 20:34:22 +02:00
%{_bindir} /runner
%{_bindir} /mailman
%{_bindir} /master
2022-07-04 20:09:33 +02:00
%{mypython_sitelib} /mailman
%{mypython_sitelib} /mailman-%{version} *-info
2020-09-29 09:54:08 +02:00
%{_unitdir} /%{mailman_name} .service
%{_unitdir} /%{mailman_name} -digests.service
%{_unitdir} /%{mailman_name} -digests.timer
2020-12-18 10:42:38 +01:00
%{_unitdir} /%{mailman_name} -notify.service
%{_unitdir} /%{mailman_name} -notify.timer
2020-09-29 09:54:08 +02:00
%{_tmpfilesdir} /%{mailman_name} .conf
%config (noreplace) %attr (640,root,mailman) %{_sysconfdir} /mailman.cfg
2022-09-01 11:53:21 +02:00
%if 0%{?suse_version} > 1500
%{_distconfdir} /logrotate.d/%{mailman_name}
%else
2020-09-29 09:54:08 +02:00
%config (noreplace) %{_sysconfdir} /logrotate.d/%{mailman_name}
2022-09-01 11:53:21 +02:00
%endif
2020-09-29 09:54:08 +02:00
%dir %attr (750,root,mailman) %{_sysconfdir} /%{mailman_name} .d
%dir %attr (750,mailman,mailman) %{mailman_homedir}
2023-08-28 14:17:47 +02:00
%dir %attr (770,mailman,mail) %{mailman_homedir} /data
2020-09-29 09:54:08 +02:00
%dir %attr (750,mailman,mailman) %{mailman_spooldir}
%dir %attr (750,mailman,mailman) %{mailman_logdir}
%ghost %dir %{mailman_rundir}
%ghost %dir %{_rundir} /lock
%ghost %dir %{mailman_lockdir}
2019-10-01 10:05:42 +02:00
%endif
2019-09-24 15:50:44 +02:00
%changelog