Accepting request 840224 from devel:languages:python:mailman

OBS-URL: https://build.opensuse.org/request/show/840224
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mailman?expand=0&rev=6
This commit is contained in:
Dominique Leuenberger 2020-10-08 11:11:59 +00:00 committed by Git OBS Bridge
commit 5ef61085eb
9 changed files with 194 additions and 2 deletions

15
README.SUSE.md Normal file
View File

@ -0,0 +1,15 @@
Mailman on SUSE
===============
To run the mailman command use:
sudo -u mailman mailman info
## Configuration
The main config file can be found at `/etc/mailman.cfg`. It is important to add
new sections only below the [path.fhs] section!
## Plugins
The directory for mailman plugins is `/etc/mailman.d`.

8
mailman-digests.service Normal file
View File

@ -0,0 +1,8 @@
[Unit]
Description=Sends Mailman digests
[Service]
Type=oneshot
ExecStart=/usr/bin/mailman digests --send
User=mailman
Group=mailman

10
mailman-digests.timer Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Run mailman-digests.service every day
[Timer]
OnCalendar=*-*-* 04:00:00
RandomizedDelaySec=3600
Persistent=true
[Install]
WantedBy=basic.target

2
mailman-tmpfiles.conf Normal file
View File

@ -0,0 +1,2 @@
d /run/lock/mailman 0755 mailman mailman
d /run/mailman 0755 mailman mailman

26
mailman.cfg Normal file
View File

@ -0,0 +1,26 @@
# This is the absolute bare minimum base configuration file. User supplied
# configurations are pushed onto this.
[mailman]
# This address is the "site owner" address. Certain messages which must be
# delivered to a human, but which can't be delivered to a list owner (e.g. a
# bounce from a list owner), will be sent to this address. It should point to
# a human.
site_owner: root@localhost
# Set the paths to be fhs compliant
layout: fhs
[paths.fhs]
ext_dir: /etc/mailman.d
bin_dir: /usr/bin
var_dir: /var/lib/mailman
queue_dir: /var/spool/mailman
log_dir: /var/log/mailman
lock_dir: /run/lock/mailman
pid_file: /run/mailman/master.pid
### ADD NEW SECTIONS AFTER THIS LINE ###
# [webservice]
# admin_user: restadmin
# admin_pass: secret

9
mailman.logrotate Normal file
View File

@ -0,0 +1,9 @@
@LOGDIR@/*.log {
missingok
sharedscripts
su mailman mailman
postrotate
/bin/kill -HUP $(</run/mailman/master.pid) 2>/dev/null || true
@BINDIR@/mailman reopen >/dev/null 2>&1 || true
endscript
}

25
mailman.service Normal file
View File

@ -0,0 +1,25 @@
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to create a file "/etc/systemd/system/mailman3.service",
# containing
# .include /usr/lib/systemd/system/mailman3.service
# ...make your changes here...
# For more info about custom unit files, see
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
[Unit]
Description=GNU Mailing List Manager
After=syslog.target network.target
[Service]
Type=forking
PIDFile=/run/mailman/master.pid
User=mailman
Group=mailman
ExecStart=/usr/bin/mailman start --force
ExecReload=/usr/bin/mailman restart
ExecStop=/usr/bin/mailman stop
[Install]
WantedBy=multi-user.target

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Wed Oct 7 05:46:29 UTC 2020 - Andreas Schneider <asn@cryptomilk.org>
- Remove suid bit from /var/lib/mailman/data
-------------------------------------------------------------------
Wed Sep 30 07:18:40 UTC 2020 - pgajdos@suse.com
- remove systemd (build)requires
-------------------------------------------------------------------
Sat Sep 26 10:38:00 UTC 2020 - Andreas Schneider <asn@cryptomilk.org>
- Create mailman user and group
- Create directories for mailman and use FHS directory layout
- Create initial /etc/mailman.cfg
- Create /etc/mailman.d/ directory for extensions
- Add systemd files
-------------------------------------------------------------------
Mon May 25 06:50:41 UTC 2020 - Petr Gajdos <pgajdos@suse.com>

View File

@ -16,6 +16,16 @@
#
%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}
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
@ -32,7 +42,18 @@ Release: 0
Summary: Mailman -- the GNU mailing list manager
License: GPL-3.0-only
URL: https://www.list.org
Source: https://files.pythonhosted.org/packages/source/m/mailman/mailman-%{version}.tar.gz
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
#
Source30: README.SUSE.md
#
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
# whitespace fix
@ -108,6 +129,7 @@ Mailman -- the GNU mailing list manager
# https://gitlab.com/mailman/mailman/-/issues/704
cp %{SOURCE100} src/mailman/testing/
cp %{SOURCE101} src/mailman/testing/
cp %{SOURCE30} .
%build
sed -i 's:/sbin:%{_prefix}/bin:' src/mailman/config/mailman.cfg
@ -130,6 +152,29 @@ sed '/importlib_resources/d' -i src/mailman.egg-info/requires.txt setup.py
%python_clone -a %{buildroot}%{_bindir}/mailman
%python_clone -a %{buildroot}%{_bindir}/runner
%python_expand %fdupes %{buildroot}%{$python_sitelib}
install -d -m 0755 \
%{buildroot}%{_sysconfdir} \
%{buildroot}%{_sysconfdir}/logrotate.d \
%{buildroot}%{_sysconfdir}/%{mailman_name}.d \
%{buildroot}%{_tmpfilesdir} \
%{buildroot}%{_unitdir} \
%{buildroot}%{mailman_homedir} \
%{buildroot}%{mailman_homedir}/data \
%{buildroot}%{mailman_rundir} \
%{buildroot}%{mailman_lockdir} \
%{buildroot}%{mailman_logdir} \
%{buildroot}%{mailman_spooldir}
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 -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}
install -m 0644 %{SOURCE20} %{buildroot}%{_unitdir}/%{mailman_name}-digests.service
install -m 0644 %{SOURCE21} %{buildroot}%{_unitdir}/%{mailman_name}-digests.timer
%endif
%check
@ -157,23 +202,56 @@ sed -i "s:\(902\):4\1:" src/mailman/testing/testing.cfg
%endif
%if !%{with test}
%pre
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_name}.service
%post
%python_install_alternative master
%python_install_alternative mailman
%python_install_alternative runner
%tmpfiles_create %{_tmpfilesdir}/%{mailman_name}.conf
%service_add_post %{mailman_name}.service
%preun
%service_del_preun %{mailman_name}.service
%postun
%service_del_postun %{mailman_name}.service
%python_uninstall_alternative master
%python_uninstall_alternative mailman
%python_uninstall_alternative runner
%files %{python_files}
%doc README.rst
%doc README.rst README.SUSE.md
%license COPYING
%python_alternative %{_bindir}/runner
%python_alternative %{_bindir}/mailman
%python_alternative %{_bindir}/master
%{python_sitelib}/*
%{_unitdir}/%{mailman_name}.service
%{_unitdir}/%{mailman_name}-digests.service
%{_unitdir}/%{mailman_name}-digests.timer
%{_tmpfilesdir}/%{mailman_name}.conf
%config(noreplace) %attr(640,root,mailman) %{_sysconfdir}/mailman.cfg
%config(noreplace) %{_sysconfdir}/logrotate.d/%{mailman_name}
%dir %attr(750,root,mailman) %{_sysconfdir}/%{mailman_name}.d
%dir %attr(750,mailman,mailman) %{mailman_homedir}
%dir %attr(750,mailman,mailman) %{mailman_homedir}/data
%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}
%endif
%changelog