Notification time stamped 2023-05-13 21:59:32 UTC
From 8d0bb40e42f218bf24fb3e867d2856690861163e Mon Sep 17 00:00:00 2001 From: Neal Gompa ngompa@fedoraproject.org Date: May 13 2023 19:35:36 +0000 Subject: Revert "Retired: Fails to install with Python 3.11"
This reverts commit cb382c5e443e4e36e4363eb93a6df09743119c61.
---
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..99b3b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/mailman-3.2.2.tar.gz +/mailman-3.3.2rc2.tar.gz +/mailman-3.3.4.tar.gz diff --git a/README.md b/README.md new file mode 100644 index 0000000..cea3471 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# mailman3 + +The mailman3 package \ No newline at end of file diff --git a/dead.package b/dead.package deleted file mode 100644 index 48203dc..0000000 --- a/dead.package +++ /dev/null @@ -1,4 +0,0 @@ -Retired: Fails to install with Python 3.11 - -See https://bugzilla.redhat.com/show_bug.cgi?id=2098746 -And https://pagure.io/fesco/issue/2876 diff --git a/mailman3-click8.patch b/mailman3-click8.patch new file mode 100644 index 0000000..91fcf76 --- /dev/null +++ b/mailman3-click8.patch @@ -0,0 +1,107 @@ +From 465c2ff847d462c1a9cf8f548093ba4b5be84c3b Mon Sep 17 00:00:00 2001 +From: Mark Sapiro mark@msapiro.net +Date: Tue, 11 May 2021 18:14:59 -0700 +Subject: [PATCH] Require click >=8.0.0 and fix the tests it breaks. + +--- + setup.py | 2 +- + src/mailman/commands/docs/import.rst | 1 + + src/mailman/commands/tests/test_cli_addmembers.py | 8 ++++---- + src/mailman/commands/tests/test_cli_delmembers.py | 4 ++-- + src/mailman/commands/tests/test_cli_syncmembers.py | 8 ++++---- + 5 files changed, 12 insertions(+), 11 deletions(-) + +diff --git a/setup.py b/setup.py +index cd36456..ad04e77 100644 +--- a/setup.py ++++ b/setup.py +@@ -115,7 +115,7 @@ case second 'm'. Any other spelling is incorrect.""", + 'atpublic', + 'authheaders>=0.9.2', + 'authres>=1.0.1', +- 'click>=7.0.0', ++ 'click>=8.0.0', + 'dnspython>=1.14.0', + 'falcon>1.0.0', + 'flufl.bounce', +diff --git a/src/mailman/commands/docs/import.rst b/src/mailman/commands/docs/import.rst +index 947d932..66f72be 100644 +--- a/src/mailman/commands/docs/import.rst ++++ b/src/mailman/commands/docs/import.rst +@@ -58,5 +58,6 @@ import, the mailing list's "real name" will change. + Import + + >>> command('mailman import21 import@example.com ' + pickle_file) ++ Importing ... + >>> print(mlist.display_name) + Test +diff --git a/src/mailman/commands/tests/test_cli_addmembers.py b/src/mailman/commands/tests/test_cli_addmembers.py +index e257da5..95f8542 100644 +--- a/src/mailman/commands/tests/test_cli_addmembers.py ++++ b/src/mailman/commands/tests/test_cli_addmembers.py +@@ -57,8 +57,8 @@ class TestCLIAddMembers(unittest.TestCase): + result.output, + 'Usage: addmembers [OPTIONS] FILENAME LISTSPEC\n' + 'Try 'addmembers --help' for help.\n\n' +- 'Error: Invalid value for 'FILENAME': Could not open ' +- 'file: bad: No such file or directory\n') ++ 'Error: Invalid value for 'FILENAME': ' ++ ''bad': No such file or directory\n') + + def test_already_subscribed_with_display_name(self): + subscribe(self._mlist, 'Anne') +@@ -265,8 +265,8 @@ class TestCLIAddMembers(unittest.TestCase): + 'Usage: addmembers [OPTIONS] FILENAME LISTSPEC\n' + 'Try 'addmembers --help' for help.\n\n' + 'Error: Invalid value for '--delivery' / '-d': ' +- 'invalid choice: bogus. (choose from regular, mime, ' +- 'plain, summary, disabled)\n') ++ ''bogus' is not one of 'regular', 'mime', ' ++ ''plain', 'summary', 'disabled'.\n') + + def test_invite_member(self): + with NamedTemporaryFile('w', buffering=1, encoding='utf-8') as infp: +diff --git a/src/mailman/commands/tests/test_cli_delmembers.py b/src/mailman/commands/tests/test_cli_delmembers.py +index cf24b54..e34c22a 100644 +--- a/src/mailman/commands/tests/test_cli_delmembers.py ++++ b/src/mailman/commands/tests/test_cli_delmembers.py +@@ -56,8 +56,8 @@ class TestCLIDelMembers(unittest.TestCase): + result.output, + 'Usage: delmembers [OPTIONS]\n' + 'Try 'delmembers --help' for help.\n\n' +- 'Error: Invalid value for '--file' / '-f': Could not open ' +- 'file: bad: No such file or directory\n') ++ 'Error: Invalid value for '--file' / '-f': ' ++ ''bad': No such file or directory\n') + + def test_not_subscribed_without_display_name(self): + with NamedTemporaryFile('w', buffering=1, encoding='utf-8') as infp: +diff --git a/src/mailman/commands/tests/test_cli_syncmembers.py b/src/mailman/commands/tests/test_cli_syncmembers.py +index 658b867..faed507 100644 +--- a/src/mailman/commands/tests/test_cli_syncmembers.py ++++ b/src/mailman/commands/tests/test_cli_syncmembers.py +@@ -58,8 +58,8 @@ class TestCLISyncMembers(unittest.TestCase): + result.output, + 'Usage: syncmembers [OPTIONS] FILENAME LISTSPEC\n' + 'Try 'syncmembers --help' for help.\n\n' +- 'Error: Invalid value for 'FILENAME': Could not open ' +- 'file: bad: No such file or directory\n') ++ 'Error: Invalid value for 'FILENAME': ' ++ ''bad': No such file or directory\n') + + def test_sync_invalid_email(self): + with NamedTemporaryFile('w', buffering=1, encoding='utf-8') as infp: +@@ -374,8 +374,8 @@ class TestCLISyncMembers(unittest.TestCase): + 'Usage: syncmembers [OPTIONS] FILENAME LISTSPEC\n' + 'Try 'syncmembers --help' for help.\n\n' + 'Error: Invalid value for '--delivery' / '-d': ' +- 'invalid choice: bogus. (choose from regular, mime, ' +- 'plain, summary, disabled)\n') ++ ''bogus' is not one of 'regular', 'mime', ' ++ ''plain', 'summary', 'disabled'.\n') + + def test_override_no_welcome(self): + self._mlist.send_welcome_message = False +-- +2.32.0 + diff --git a/mailman3-digests.service b/mailman3-digests.service new file mode 100644 index 0000000..d6b018f --- /dev/null +++ b/mailman3-digests.service @@ -0,0 +1,8 @@ +[Unit] +Description=Sends Mailman digests + +[Service] +Type=oneshot +ExecStart=/usr/bin/mailman3 digests --send +User=mailman +Group=mailman diff --git a/mailman3-digests.timer b/mailman3-digests.timer new file mode 100644 index 0000000..02b6420 --- /dev/null +++ b/mailman3-digests.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Run mailman3-digests.service every day + +[Timer] +OnCalendar=*-*-* 04:00:00 +RandomizedDelaySec=3600 +Persistent=true + +[Install] +WantedBy=basic.target diff --git a/mailman3-do-not-assume-sapce-in-banner.patch b/mailman3-do-not-assume-sapce-in-banner.patch new file mode 100644 index 0000000..95c42d5 --- /dev/null +++ b/mailman3-do-not-assume-sapce-in-banner.patch @@ -0,0 +1,13 @@ +diff --git a/src/mailman/utilities/tests/test_interact.py b/src/mailman/utilities/tests/test_interact.py +index 24c186c..dca1866 100644 +--- a/src/mailman/utilities/tests/test_interact.py ++++ b/src/mailman/utilities/tests/test_interact.py +@@ -67,7 +67,7 @@ class TestInteract(unittest.TestCase): + self._enter(hackenv('PYTHONSTARTUP', None)) + interact() + stderr = self._stderr.getvalue().splitlines() +- banner = 'Python {} on {} '.format(sys.version, sys.platform) ++ banner = 'Python {} on {}'.format(sys.version, sys.platform) + self.assertEqual(stderr[0], banner.splitlines()[0]) + + def test_interact_custom_banner(self): diff --git a/mailman3-subject-prefix.patch b/mailman3-subject-prefix.patch new file mode 100644 index 0000000..261d777 --- /dev/null +++ b/mailman3-subject-prefix.patch @@ -0,0 +1,224 @@ +From d3dbbbfe7e660e2f5f3fe953c434f9cb163cd423 Mon Sep 17 00:00:00 2001 +From: Neal Gompa ngompa13@gmail.com +Date: Thu, 15 Oct 2020 10:30:07 -0400 +Subject: [PATCH] Cover some subject prefix use cases +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The subject_prefix handler has many bugs and was mostly not covered +for lists with a non-ascii charset. + +Co-authored-by: Aurélien Bompard aurelien@bompard.org +Signed-off-by: Neal Gompa ngompa13@gmail.com +--- + src/mailman/handlers/subject_prefix.py | 19 +++-- + .../handlers/tests/test_subject_prefix.py | 81 +++++++++++++++++-- + 2 files changed, 87 insertions(+), 13 deletions(-) + +diff --git a/src/mailman/handlers/subject_prefix.py b/src/mailman/handlers/subject_prefix.py +index 0f0180563..7f1761b53 100644 +--- a/src/mailman/handlers/subject_prefix.py ++++ b/src/mailman/handlers/subject_prefix.py +@@ -39,13 +39,12 @@ def ascii_header(mlist, msgdata, subject, prefix, prefix_pattern, ws): + if charset not in ASCII_CHARSETS: + return None + subject_text = EMPTYSTRING.join(str(subject).splitlines()) ++ subject_text = re.sub(prefix_pattern, '', subject_text) + # At this point, the subject may become null if someone posted mail + # with "Subject: [subject prefix]". + if subject_text.strip() == '': + with _.using(mlist.preferred_language.code): + subject_text = _('(no subject)') +- else: +- subject_text = re.sub(prefix_pattern, '', subject_text) + msgdata['stripped_subject'] = subject_text + rematch = re.match(RE_PATTERN, subject_text, re.I) + if rematch: +@@ -83,13 +82,12 @@ def all_same_charset(mlist, msgdata, subject, prefix, prefix_pattern, ws): + if charset != list_charset: + return None + subject_text = EMPTYSTRING.join(chunks) ++ subject_text = re.sub(prefix_pattern, '', subject_text) + # At this point, the subject may become null if someone posted mail + # with "Subject: [subject prefix]". + if subject_text.strip() == '': +- with _.push(mlist.preferred_language.code): ++ with _.using(mlist.preferred_language.code): + subject_text = _('(no subject)') +- else: +- subject_text = re.sub(prefix_pattern, '', subject_text) + msgdata['stripped_subject'] = subject_text + rematch = re.match(RE_PATTERN, subject_text, re.I) + if rematch: +@@ -114,7 +112,7 @@ def mixed_charsets(mlist, msgdata, subject, prefix, prefix_pattern, ws): + list_charset = mlist.preferred_language.charset + chunks = decode_header(subject.encode()) + if len(chunks) == 0: +- with _.push(mlist.preferred_language.code): ++ with _.using(mlist.preferred_language.code): + subject_text = _('(no subject)') + chunks = [(prefix, list_charset), + (subject_text, list_charset), +@@ -134,13 +132,20 @@ def mixed_charsets(mlist, msgdata, subject, prefix, prefix_pattern, ws): + chunks.insert(0, ('', 'us-ascii')) + first_text = '' + first_text = re.sub(prefix_pattern, '', first_text).lstrip() ++ if not first_text.strip() and len(chunks) <= 1: ++ with _.using(mlist.preferred_language.code): ++ subject_text = _('(no subject)') ++ chunks = [(prefix.strip(), list_charset), ++ (subject_text, list_charset), ++ ] ++ return make_header(chunks, continuation_ws=ws) + rematch = re.match(RE_PATTERN, first_text, re.I) + if rematch: + first_text = 'Re: ' + first_text[rematch.end():] + chunks[0] = (first_text, chunk_charset) + # The subject text stripped of the prefix, for use in the NNTP gateway. + msgdata['stripped_subject'] = str(make_header(chunks, continuation_ws=ws)) +- chunks.insert(0, (prefix, list_charset)) ++ chunks.insert(0, (prefix.strip(), list_charset)) + return make_header(chunks, continuation_ws=ws) + + +diff --git a/src/mailman/handlers/tests/test_subject_prefix.py b/src/mailman/handlers/tests/test_subject_prefix.py +index fe6f57643..916e201ca 100644 +--- a/src/mailman/handlers/tests/test_subject_prefix.py ++++ b/src/mailman/handlers/tests/test_subject_prefix.py +@@ -33,6 +33,13 @@ class TestSubjectPrefix(unittest.TestCase): + def setUp(self): + self._mlist = create_list('test@example.com') + self._process = config.handlers['subject-prefix'].process ++ language_manager = getUtility(ILanguageManager) ++ if 'xx' not in language_manager: ++ language_manager.add('xx', 'utf-8', 'Freedonia') ++ ++ def tearDown(self): ++ # The LanguageManager may need a 'remove' method. ++ del getUtility(ILanguageManager)._languages['xx'] + + def test_isdigest(self): + # If the message is destined for the digest, the Subject header does +@@ -114,6 +121,14 @@ class TestSubjectPrefix(unittest.TestCase): + self._process(self._mlist, msg, {}) + self.assertEqual(str(msg['subject']), '[Test] A test message') + ++ def test_multiline_subject_non_ascii_list(self): ++ # The subject appears on multiple lines on a non-ascii list. ++ self._mlist.preferred_language = 'xx' ++ msg = Message() ++ msg['Subject'] = '\n A test message' ++ self._process(self._mlist, msg, {}) ++ self.assertEqual(str(msg['subject']), '[Test] A test message') ++ + def test_i18n_prefix(self): + # The Subject header is encoded, but the prefix is still added. + msg = Message() +@@ -130,7 +145,7 @@ class TestSubjectPrefix(unittest.TestCase): + msg['Subject'] = '[Test] ' + self._process(self._mlist, msg, {}) + subject = msg['subject'] +- self.assertEqual(str(subject), '[Test] ') ++ self.assertEqual(str(subject), '[Test] (no subject)') + + def test_prefix_only_all_same(self): + # Incoming subject is only the prefix. +@@ -141,7 +156,7 @@ class TestSubjectPrefix(unittest.TestCase): + self._process(self._mlist, msg, {}) + self._mlist.preferred_language.charset = old_charset + subject = msg['subject'] +- self.assertEqual(str(subject), '[Test] ') ++ self.assertEqual(str(subject), '[Test] (no subject)') + + def test_prefix_only_mixed(self): + # Incoming subject is only the prefix. +@@ -149,7 +164,7 @@ class TestSubjectPrefix(unittest.TestCase): + msg['Subject'] = '=?utf-8?Q?[Test]_?=' + self._process(self._mlist, msg, {}) + subject = msg['subject'] +- self.assertEqual(str(subject), '[Test] ') ++ self.assertEqual(str(subject), '[Test] (no subject)') + + def test_re_only(self): + # Incoming subject is only Re:. +@@ -198,15 +213,13 @@ class TestSubjectPrefix(unittest.TestCase): + def test_decode_header_returns_string(self): + # Under some circumstances, email.header.decode_header() returns a + # string value. Ensure we can handle that. +- manager = getUtility(ILanguageManager) +- manager.add('xx', 'iso-8859-1', 'Xlandia') + self._mlist.preferred_language = 'xx' + msg = Message() + msg['Subject'] = 'Plain text' + self._process(self._mlist, msg, {}) + subject = msg['subject'] + self.assertEqual(subject.encode(), +- '=?iso-8859-1?q?=5BTest=5D_?= Plain text') ++ '=?utf-8?b?W1Rlc3Rd?= Plain text') + + def test_unknown_encoded_subject(self): + msg = Message() +@@ -215,3 +228,59 @@ class TestSubjectPrefix(unittest.TestCase): + subject = msg['subject'] + self.assertEqual(str(subject), + '[Test] Non-ascii subject - fran�ais') ++ ++ def test_non_ascii_list(self): ++ # The mailing list has a non-ascii language ++ self._mlist.preferred_language = 'xx' ++ msg = Message() ++ msg['Subject'] = 'A test message' ++ self._process(self._mlist, msg, {}) ++ self.assertEqual(str(msg['subject']), '[Test] A test message') ++ ++ def test_no_subject(self): ++ # The email has no subject ++ msg = Message() ++ msg['Subject'] = '' ++ self._process(self._mlist, msg, {}) ++ self.assertEqual(str(msg['subject']), '[Test] (no subject)') ++ ++ def test_no_subject_non_ascii_list(self): ++ # The email has no subject on a non-ascii list ++ self._mlist.preferred_language = 'xx' ++ msg = Message() ++ msg['Subject'] = '' ++ self._process(self._mlist, msg, {}) ++ self.assertEqual(str(msg['subject']), '[Test] (no subject)') ++ ++ def test_no_real_subject(self): ++ # The email has no subject ++ msg = Message() ++ msg['Subject'] = '[Test] ' ++ self._process(self._mlist, msg, {}) ++ self.assertEqual(str(msg['subject']), '[Test] (no subject)') ++ ++ def test_no_real_subject_non_ascii_list(self): ++ # The email has no subject on a non-ascii list ++ self._mlist.preferred_language = 'xx' ++ msg = Message() ++ msg['Subject'] = '[Test] ' ++ self._process(self._mlist, msg, {}) ++ self.assertEqual(str(msg['subject']), '[Test] (no subject)') ++ ++ def test_non_ascii_subject_and_list(self): ++ # The mailing list has a non-ascii language and the subject is ++ # non-ascii with the same encoding. ++ self._mlist.preferred_language = 'xx' ++ msg = Message() ++ msg['Subject'] = '=?utf-8?q?d=C3=A9sirable?=' ++ self._process(self._mlist, msg, {}) ++ self.assertEqual(str(msg['subject']), '[Test] d\xe9sirable') ++ ++ def test_non_ascii_empty_subject_and_non_ascii_list(self): ++ # The mailing list has a non-ascii language and the subject is ++ # non-ascii with the same encoding, but actually empty. ++ self._mlist.preferred_language = 'xx' ++ msg = Message() ++ msg['Subject'] = '=?utf-8?q?[Test]_?=' ++ self._process(self._mlist, msg, {}) ++ self.assertEqual(str(msg['subject']), '[Test] (no subject)') +-- +2.30.1 + diff --git a/mailman3-tmpfiles.conf b/mailman3-tmpfiles.conf new file mode 100644 index 0000000..750231e --- /dev/null +++ b/mailman3-tmpfiles.conf @@ -0,0 +1,2 @@ +d /var/lock/mailman3 0755 mailman mailman +d /var/run/mailman3 0755 mailman mailman diff --git a/mailman3-use-either-importlib_resources-or-directly-importlib.patch b/mailman3-use-either-importlib_resources-or-directly-importlib.patch new file mode 100644 index 0000000..ce1f158 --- /dev/null +++ b/mailman3-use-either-importlib_resources-or-directly-importlib.patch @@ -0,0 +1,73 @@ +From 0eced2d273535577645493340c7319ebf27a559c Mon Sep 17 00:00:00 2001 +From: Neal Gompa ngompa13@gmail.com +Date: Fri, 16 Oct 2020 03:47:38 -0400 +Subject: [PATCH] Use importlib.resources for Python 3.9+ and + importlib_resources otherwise + +This makes it possible to use Mailman 3 in environments where importlib_resources +is not available. + +Signed-off-by: Neal Gompa ngompa13@gmail.com +--- + setup.py | 2 +- + src/mailman/__init__.py | 5 +++++ + src/mailman/testing/__init__.py | 23 +++++++++++++++++++++++ + 3 files changed, 29 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index cd3645611..6d871fbfd 100644 +--- a/setup.py ++++ b/setup.py +@@ -121,7 +121,7 @@ case second 'm'. Any other spelling is incorrect.""", + 'flufl.bounce', + 'flufl.i18n>=2.0', + 'flufl.lock>=3.1', +- 'importlib_resources>=1.1.0', ++ 'importlib_resources>=1.1.0 ; python_version<"3.9"', + 'gunicorn', + 'lazr.config', + 'python-dateutil>=2.0', +diff --git a/src/mailman/__init__.py b/src/mailman/__init__.py +index 2d94288e0..1c760008d 100644 +--- a/src/mailman/__init__.py ++++ b/src/mailman/__init__.py +@@ -37,3 +37,8 @@ if 'build_sphinx' not in sys.argv: # pragma: nocover + else: + from mailman.core.i18n import initialize + initialize() ++ ++# Switch over to the internal importlib.resources module on Python 3.9+ ++if sys.version_info >= (3, 9, 0): ++ import importlib.resources ++ sys.modules['importlib_resources'] = importlib.resources +diff --git a/src/mailman/testing/__init__.py b/src/mailman/testing/__init__.py +index e69de29bb..2b2ed536a 100644 +--- a/src/mailman/testing/__init__.py ++++ b/src/mailman/testing/__init__.py +@@ -0,0 +1,23 @@ ++# Copyright (C) 2009-2020 by the Free Software Foundation, Inc. ++# ++# This file is part of GNU Mailman. ++# ++# GNU Mailman is free software: you can redistribute it and/or modify it under ++# the terms of the GNU General Public License as published by the Free ++# Software Foundation, either version 3 of the License, or (at your option) ++# any later version. ++# ++# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT ++# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++# more details. ++# ++# You should have received a copy of the GNU General Public License along with ++# GNU Mailman. If not, see https://www.gnu.org/licenses/. ++ ++import sys ++ ++# Switch over to the internal importlib.resources module on Python 3.9+ ++if sys.version_info >= (3, 9, 0): ++ import importlib.resources ++ sys.modules['importlib_resources'] = importlib.resources +-- +2.30.1 + diff --git a/mailman3.cfg b/mailman3.cfg new file mode 100644 index 0000000..2fd5df6 --- /dev/null +++ b/mailman3.cfg @@ -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 + +# The local URL part to the administration interface (Postorius). +# The full URL will be constructed by prepending the domain URL set in the +# list's domain properties. +#listinfo_url = /postorius/ + + +# Set the paths to be Fedora-compliant +layout: fhs +[paths.fhs] +bin_dir: /usr/libexec/mailman3 +var_dir: /var/lib/mailman3 +queue_dir: /var/spool/mailman3 +log_dir: /var/log/mailman3 +lock_dir: /run/lock/mailman3 +ext_dir: /etc/mailman3.d +pid_file: /run/mailman3/master.pid diff --git a/mailman3.logrotate b/mailman3.logrotate new file mode 100644 index 0000000..644530d --- /dev/null +++ b/mailman3.logrotate @@ -0,0 +1,11 @@ +@LOGDIR@/*.log { + missingok + sharedscripts + su mailman mailman + postrotate + /bin/kill -HUP `cat /run/mailman3/master.pid 2>/dev/null` 2>/dev/null || true + # Don't run "mailman3 reopen" with SELinux on here in the logrotate + # context, it will be blocked + #@BINDIR@/mailman3 reopen >/dev/null 2>&1 || true + endscript +} diff --git a/mailman3.service b/mailman3.service new file mode 100644 index 0000000..4ee57d9 --- /dev/null +++ b/mailman3.service @@ -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_... + + +[Unit] +Description=GNU Mailing List Manager +After=syslog.target network.target + +[Service] +Type=forking +PIDFile=/run/mailman3/master.pid +User=mailman +Group=mailman +ExecStart=/usr/bin/mailman3 start --force +ExecReload=/usr/bin/mailman3 restart +ExecStop=/usr/bin/mailman3 stop + +[Install] +WantedBy=multi-user.target diff --git a/mailman3.spec b/mailman3.spec new file mode 100644 index 0000000..725557a --- /dev/null +++ b/mailman3.spec @@ -0,0 +1,421 @@ +%global pypi_name mailman + +%global baseversion 3.3.4 +#global prerelease rc2 + +# The user and group Mailman will run as, same values as in the mailman 2 RPM +%global mmuser mailman +%global mmuserid 41 +%global mmgroup mailman +%global mmgroupid 41 + +%{?python_enable_dependency_generator} + + +Name: mailman3 +Version: %{baseversion}%{?prerelease:~%{prerelease}} +Release: 7%{?dist} +Summary: The GNU mailing list manager + +License: GPLv3 +URL: http://www.list.org +Source0: https://pypi.python.org/packages/source/m/%%7Bpypi_name%7D/%%7Bpypi_name%7D-... +Source1: mailman3.cfg +Source2: mailman3-tmpfiles.conf +Source3: mailman3.service +Source4: mailman3.logrotate +Source5: mailman3-digests.service +Source6: mailman3-digests.timer + +# https://gitlab.com/mailman/mailman/-/merge_requests/860 +Patch01: %{name}-click8.patch +# https://gitlab.com/mailman/mailman/merge_requests/721 +Patch11: %{name}-subject-prefix.patch +# https://gitlab.com/mailman/mailman/merge_requests/722 +Patch14: %{name}-use-either-importlib_resources-or-directly-importlib.patch + +# Fix a test failure that only fails becasue of an extra/missing space +# No idea how severe this is, but it does not appear to be +# See https://bugzilla.redhat.com/show_bug.cgi?id=1900668#c9 +Patch15: %{name}-do-not-assume-sapce-in-banner.patch + +BuildArch: noarch + +%if 0%{?fedora} || 0%{?rhel} >= 8 +# Ensure that tests will work... +BuildRequires: glibc-langpack-en +%endif + +BuildRequires: python%{python3_pkgversion}-devel >= 3.5 +BuildRequires: python%{python3_pkgversion}-setuptools + +%if %{undefined python_enable_dependency_generator} +Requires: python%{python3_pkgversion} >= 3.5 +Requires: python%{python3_pkgversion}-setuptools +Requires: python%{python3_pkgversion}-aiosmtpd >= 1.4.1 +Requires: python%{python3_pkgversion}-alembic +Requires: python%{python3_pkgversion}-atpublic +Requires: python%{python3_pkgversion}-authheaders >= 0.9.2 +Requires: python%{python3_pkgversion}-authres >= 1.0.1 +Requires: python%{python3_pkgversion}-click >= 8.0 +Requires: python%{python3_pkgversion}-dateutil >= 2.0 +Requires: python%{python3_pkgversion}-dns >= 1.14.0 +Requires: python%{python3_pkgversion}-falcon > 1.0.0 +Requires: python%{python3_pkgversion}-flufl-bounce +Requires: python%{python3_pkgversion}-flufl-i18n >= 2.0.1 +Requires: python%{python3_pkgversion}-flufl-lock >= 3.1 +Requires: python%{python3_pkgversion}-gunicorn +Requires: python%{python3_pkgversion}-lazr-config +# Versionned dep on python-passlib, or else it fails with AttributeError in +# mailman/utilities/passwords.py", line 43: 'CryptContext' has no attribute 'from_string' +Requires: python%{python3_pkgversion}-passlib >= 1.6.0 +Requires: python%{python3_pkgversion}-requests +Requires: python%{python3_pkgversion}-sqlalchemy1.3 >= 1.2.3 +Requires: python%{python3_pkgversion}-zope-component +Requires: python%{python3_pkgversion}-zope-configuration +Requires: python%{python3_pkgversion}-zope-event +Requires: python%{python3_pkgversion}-zope-interface >= 5.0 +%if (%{defined fedora} && 0%{?fedora} < 29) || (%{defined rhel} && 0%{?rhel} < 9) +Requires: python%{python3_pkgversion}-importlib-resources +%endif +%endif + +# To run the test suite: +BuildRequires: python%{python3_pkgversion}-aiosmtpd >= 1.4.1 +BuildRequires: python%{python3_pkgversion}-alembic +BuildRequires: python%{python3_pkgversion}-atpublic +BuildRequires: python%{python3_pkgversion}-authheaders >= 0.9.2 +BuildRequires: python%{python3_pkgversion}-authres >= 1.0.1 +BuildRequires: python%{python3_pkgversion}-click >= 8.0 +BuildRequires: python%{python3_pkgversion}-dateutil >= 2.0 +BuildRequires: python%{python3_pkgversion}-dns >= 1.14.0 +BuildRequires: python%{python3_pkgversion}-falcon > 1.0.0 +BuildRequires: python%{python3_pkgversion}-flufl-bounce +BuildRequires: python%{python3_pkgversion}-flufl-i18n >= 2.0.1 +BuildRequires: python%{python3_pkgversion}-flufl-lock >= 3.1 +BuildRequires: python%{python3_pkgversion}-flufl-testing +BuildRequires: python%{python3_pkgversion}-gunicorn +BuildRequires: python%{python3_pkgversion}-lazr-config +BuildRequires: python%{python3_pkgversion}-lazr-smtptest +BuildRequires: python%{python3_pkgversion}-mock +BuildRequires: python%{python3_pkgversion}-nose2 +BuildRequires: python%{python3_pkgversion}-passlib >= 1.6.0 +BuildRequires: python%{python3_pkgversion}-psycopg2 +BuildRequires: python%{python3_pkgversion}-requests +BuildRequires: python%{python3_pkgversion}-sqlalchemy1.3 >= 1.2.3 +BuildRequires: python%{python3_pkgversion}-zope-component +BuildRequires: python%{python3_pkgversion}-zope-configuration +BuildRequires: python%{python3_pkgversion}-zope-event +BuildRequires: python%{python3_pkgversion}-zope-interface >= 5.0 +%if (%{defined fedora} && 0%{?fedora} < 29) || (%{defined rhel} && 0%{?rhel} < 9) +BuildRequires: python%{python3_pkgversion}-importlib-resources +%endif + +# SELinux https://fedoraproject.org/wiki/SELinux/IndependentPolicy#Creating_the_Spec_F... +Provides: %{name}-selinux == %{version}-%{release} +%global selinux_variants mls targeted +Requires: selinux-policy >= %{_selinux_policy_version} +BuildRequires: git +BuildRequires: pkgconfig(systemd) +BuildRequires: selinux-policy +BuildRequires: selinux-policy-devel +Requires(post): selinux-policy-base >= %{_selinux_policy_version} +Requires(post): libselinux-utils +Requires(post): policycoreutils +%if 0%{?fedora} || 0%{?rhel} >= 8 +Requires(post): policycoreutils-python-utils +%else +Requires(post): policycoreutils-python +%endif +# SELinux https://fedoraproject.org/wiki/SELinux_Policy_Modules_Packaging_Draft +BuildRequires: checkpolicy, selinux-policy-devel +BuildRequires: hardlink + +# Scriptlets +%{?systemd_requires} +BuildRequires: systemd +Requires(pre): shadow-utils + + +%description +This is GNU Mailman, a mailing list management system distributed under the +terms of the GNU General Public License (GPL) version 3 or later. The name of +this software is spelled 'Mailman' with a leading capital 'M' but with a lower +case second `m'. Any other spelling is incorrect. + + +%prep +%autosetup -p1 -n %{pypi_name}-%{baseversion}%{?prerelease} + +# SELinux +mkdir SELinux +echo '%{_localstatedir}/lib/%{name}/data(/.*)? gen_context(system_u:object_r:etc_mail_t,s0)' \ + > SELinux/%{name}.fc +# remember to bump the following version if the policy is updated +cat > SELinux/%{name}.te << EOF +policy_module(%{name}, 1.4) +EOF + + +%build +%py3_build + +cd SELinux +for selinuxvariant in %{selinux_variants}; do + make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile + mv %{name}.pp %{name}.pp.${selinuxvariant} + make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean +done +cd - + + +%install +%py3_install + +# move scripts away from _bindir to avoid conflicts and create a wrapper script +mkdir -p %{buildroot}%{_libexecdir}/%{name} +mv %{buildroot}%{_bindir}/* %{buildroot}%{_libexecdir}/%{name}/ +cat > %{buildroot}%{_bindir}/%{name} << EOF +#!/bin/sh +if [ "$(whoami)" != "mailman" ]; then + echo "This command must be run under the mailman user." + exit 1 +fi +%{_libexecdir}/%{name}/mailman $@ +EOF +chmod +x %{buildroot}%{_bindir}/%{name} + +# service files +install -D -m 0640 %{SOURCE1} %{buildroot}%{_sysconfdir}/mailman.cfg +install -D -m 0644 %{SOURCE2} %{buildroot}%{_prefix}/lib/tmpfiles.d/%{name}.conf +install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service +mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d/ +sed -e 's,@LOGDIR@,%{_localstatedir}/log/%{name},g;s,@BINDIR@,%{_bindir},g' \ + %{SOURCE4} > %{buildroot}%{_sysconfdir}/logrotate.d/%{name} +# periodic task +install -D -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}/%{name}-digests.service +install -D -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/%{name}-digests.timer + +mkdir -p %{buildroot}%{_localstatedir}/{lib,spool,log}/%{name} +mkdir -p %{buildroot}/run/%{name} %{buildroot}/run/lock/%{name} +mkdir -p %{buildroot}%{_sysconfdir}/%{name}.d +# Mailman will auto-create the following dir, but not with the correct group +# owner (MTAs such as Postfix must read and write to it). Set it here in RPM's +# file listing. +mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/data + +# SELinux +for selinuxvariant in %{selinux_variants}; do + install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant} + install -p -m 644 SELinux/%{name}.pp.${selinuxvariant} \ + %{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{name}.pp +done +hardlink -cv %{buildroot}%{_datadir}/selinux + + +%check +# tests need a proper locale +export LANG=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 +# Mailman3 can only be tested when its installed (it starts runners and won't +# find the buildroot), so we use a venv +%{__python3} -m venv --system-site-packages --without-pip --clear venv +venv/bin/python setup.py develop +venv/bin/python -m nose2 -v + + +%pre +# User & Group +getent group %{mmgroup} >/dev/null || \ + groupadd -g %{mmgroupid} %{mmgroup} >/dev/null +getent passwd %{mmuser} >/dev/null || \ + useradd -r -u %{mmuserid} -g %{mmgroupid} -d %{_localstatedir}/lib/%{name} -s /sbin/nologin \ + -c "Mailman, the mailing-list manager" %{mmuser} >/dev/null +# SELinux +for selinuxvariant in %{selinux_variants}; do + %selinux_relabel_pre -s ${selinuxvariant} +done + +%post +# Service +%systemd_post %{name}.service %{name}-digests.timer +# SELinux +for selinuxvariant in %{selinux_variants}; do + %selinux_modules_install -s ${selinuxvariant} %{_datadir}/selinux/${selinuxvariant}/%{name}.pp || : +done + +%preun +# Service +%systemd_preun %{name}.service %{name}-digests.timer + +%postun +# Service +%systemd_postun_with_restart %{name}.service %{name}-digests.timer +# SELinux +if [ $1 -eq 0 ] ; then + for selinuxvariant in %{selinux_variants}; do + %selinux_modules_uninstall -s ${selinuxvariant} %{_datadir}/selinux/${selinuxvariant}/%{name}.pp || : + done +fi + +%posttrans +# SELinux +for selinuxvariant in %{selinux_variants}; do + %selinux_relabel_post -s ${selinuxvariant} +done + + +%files +%doc README.rst +%license COPYING +%{_bindir}/%{name} +%{_libexecdir}/%{name} +%{python3_sitelib}/%{pypi_name} +%{python3_sitelib}/%{pypi_name}-*-py%{python3_version}.egg-info +%{_unitdir}/*.service +%{_unitdir}/*.timer +%{_prefix}/lib/tmpfiles.d/%{name}.conf +%config(noreplace) %attr(640,mailman,mailman) %{_sysconfdir}/mailman.cfg +%dir %{_sysconfdir}/%{name}.d +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%dir %attr(755,mailman,mailman) %{_localstatedir}/lib/%{name} +%dir %attr(2775,mailman,mail) %{_localstatedir}/lib/%{name}/data +%dir %attr(755,mailman,mailman) %{_localstatedir}/spool/%{name} +%dir %attr(755,mailman,mailman) %{_localstatedir}/log/%{name} +%dir %attr(755,mailman,mailman) /run/%{name} +%dir %attr(755,mailman,mailman) /run/lock/%{name} +# SELinux +%doc SELinux/* +%{_datadir}/selinux/*/%{name}.pp + + +%changelog +* Thu Jul 21 2022 Fedora Release Engineering releng@fedoraproject.org - 3.3.4-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu Jan 20 2022 Fedora Release Engineering releng@fedoraproject.org - 3.3.4-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Fri Sep 17 2021 Neal Gompa ngompa@fedoraproject.org - 3.3.4-5 +- Backport fix for click >= 8.0 + +* Fri Sep 17 2021 Neal Gompa ngompa@fedoraproject.org - 3.3.4-4 +- Fix sqlalchemy dependency to < 1.4 + +* Thu Jul 22 2021 Fedora Release Engineering releng@fedoraproject.org - 3.3.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri Jun 04 2021 Python Maint python-maint@redhat.com - 3.3.4-2 +- Rebuilt for Python 3.10 + +* Tue Mar 30 2021 Neal Gompa ngompa13@gmail.com - 3.3.4-1 +- Update to 3.3.4 to fix build +- Refresh patch set + +* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek zbyszek@in.waw.pl - 3.3.2~rc2-3 +- Rebuilt for updated systemd-rpm-macros + See https://pagure.io/fesco/issue/2583. + +* Tue Jan 26 2021 Fedora Release Engineering releng@fedoraproject.org - 3.3.2~rc2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Fri Oct 16 2020 Neal Gompa ngompa13@gmail.com - 3.3.2~rc2-1 +- Update to 3.3.2rc2 to fix build +- Refresh and clean up patch set + +* Sat Aug 01 2020 Fedora Release Engineering releng@fedoraproject.org - 3.2.2-5 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering releng@fedoraproject.org - 3.2.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Thu Jun 18 2020 Marc Dequènes (Duck) duck@redhat.com - 3.2.2-3 +- backport patch to use new Python 3.9 files API, fixes tests hang, + adapted for older importlib_resources library +- backport patch to fix tests failing due to quote comparison +- remove obsolete tweaking of Python macros + +* Tue May 26 2020 Miro Hrončok mhroncok@redhat.com - 3.2.2-2 +- Rebuilt for Python 3.9 + +* Thu Mar 19 2020 Marc Dequènes (Duck) duck@redhat.com - 3.2.2-1 +- NUR +- remove Python 3.7 support patch, applied upstream +- refreshed/adapted patches +- don't hardcode the path to `hardlink` +- update and tighten dependencies +- adapt tests after changes in mailman3-subject-prefix.patch +- backport content-type fix for tests +- use importlib.resources instead of importlib_resources is available +- fix stale lock preventing mailman3.service from starting + (see Debian#919160) +- add upstream patch to fix compatibility with Python 3.7.4 and + Python 3.8b4 +- ported upstream patch to fix compatibility with Python 3.8 +- upstream patch to fix model deletion and template init + +* Wed Jan 29 2020 Fedora Release Engineering releng@fedoraproject.org - 3.2.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Mon Sep 30 2019 Aurelien Bompard abompard@fedoraproject.org - 3.2.0-5 +- Fix hardlink + +* Mon Aug 19 2019 Miro Hrončok mhroncok@redhat.com - 3.2.0-4 +- Rebuilt for Python 3.8 + +* Thu Jul 25 2019 Fedora Release Engineering releng@fedoraproject.org - 3.2.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Fri Feb 01 2019 Fedora Release Engineering releng@fedoraproject.org - 3.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Aug 03 2018 Aurelien Bompard abompard@fedoraproject.org - 3.2.0-1 +- Version 3.2.0 +- Update dependencies +- Merge the -selinux subpackage +- Use the SELinux macros + +* Tue Mar 06 2018 Aurelien Bompard abompard@fedoraproject.org - 3.1.1-0.7 +- Rebuild + +* Tue Feb 13 2018 Aurelien Bompard abompard@fedoraproject.org - 3.1.1-0.6 +- git update to 8207caa09 + +* Mon May 29 2017 Aurelien Bompard abompard@fedoraproject.org - 3.1.1-0.1 +- version 3.1.0 final + +* Thu Feb 09 2017 Aurelien Bompard abompard@fedoraproject.org - 3.1.0-0.30 +- add a cron job to send digests daily + +* Wed Apr 29 2015 Aurelien Bompard abompard@fedoraproject.org - 3.0.0-1 +- version 3.0.0 final + +* Fri Jul 18 2014 Aurelien Bompard abompard@fedoraproject.org - 3.0.0-0.18.bzr7251 +- add Patch11 (missing PostgreSQL upgrade file) + +* Mon Nov 25 2013 Aurelien Bompard abompard@fedoraproject.org - 3.0.0-0.11.bzr7226 +- add SELinux policy module, according to: + http://fedoraproject.org/wiki/SELinux_Policy_Modules_Packaging_Draft + +* Sun Oct 27 2013 Aurelien Bompard abompard@fedoraproject.org - 3.0.0-0.10.bzr7226 +- update to BZR snapshot (rev7226) + +* Thu Aug 29 2013 Aurelien Bompard abompard@fedoraproject.org - 3.0.0-0.6.bzr7218 +- update to BZR snapshot (rev7218) + +* Wed Aug 28 2013 Aurelien Bompard abompard@fedoraproject.org - 3.0.0-0.6.bzr7217 +- update to BZR snapshot (rev7217) +- drop patch 0 +- rename to mailman3 and make it parallel-installable with Mailman 2 + +* Wed Jul 24 2013 Aurelien Bompard abompard@fedoraproject.org - 3:3.0.0-0.6 +- update to BZR snapshot (rev7215) +- drop patch 1 + +* Thu Mar 07 2013 Aurelien Bompard abompard@fedoraproject.org - 3:3.0.0-0.2.b3 +- update to beta3 +- add a systemd service and a default config file + +* Wed Nov 28 2012 Aurelien Bompard abompard@fedoraproject.org - 3.0.0b2-1 +- Initial package. diff --git a/sources b/sources new file mode 100644 index 0000000..9355f9b --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (mailman-3.3.4.tar.gz) = 52d7e8355744730f608605b05bc9c977c3e4daf22a78267b1ea6cd3922b2826d3f70dd61a591f13633fc7cbcc536b6d56a2076c00752a6590964cbd4e1aec3cc
https://src.fedoraproject.org/rpms/mailman3/c/8d0bb40e42f218bf24fb3e867d2856...
scm-commits@lists.fedoraproject.org