From nobody Mon May 8 08:27:44 2023 X-Original-To: dev-commits-ports-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QFDtn0CWhz49ZZt; Mon, 8 May 2023 08:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QFDtm6kj2z3p8Z; Mon, 8 May 2023 08:27:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683534464; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/eo2fp00Mer0rVYXsquCfgmdBvs/GFOik/tRajW9JEg=; b=DKgdpuh/ieHoSBBbdQ4TA2S2KyxrdD9iRmpQBAQbjMx8Dg02pYC4JOOWH/Bo4vqmPSry+2 4991Xw2IRoaVl21HR7sc56h/+FQPltRd65/D5atLIus2Mo9UYP1QE/IxEqPL1/j5BnRNVv kT5MqvFMvxP19rmxId/IfnT4t+8uS8cvs/8EK5JLUv27oR+8b0Tn2Ysk+sqktY3EXRfsd2 bfGqBvonxrTQk5hAmWxf1QclvdRf3gkPQ3e9tQOD5aj2NiOSJawfxDqvbVVxWSgkTiU7Hm AGEWVrsowH+X1JUst/Si4NBo45fyGKyEva//OKTo+gT2WXHM+b1u0MDmQ1qJjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683534464; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/eo2fp00Mer0rVYXsquCfgmdBvs/GFOik/tRajW9JEg=; b=Ko3ZfqjqDcXhOw4K+4ffL3d507r6bg5H9mo4/oD5O2fzjkpph8zXXu1BpXk9acoAETp0Uo zOV5jUKdwpNM3z2blcHF4VzgZ0tI1uAZdjJxO+KTGamwzj1mQgZ6yuQ7q59V5tckcTaZ4F dGuYbPYDFqE5q7RXep53dr4oNzMcqM1+xQyYyJcn5hzSKyYgo8DISYhzIG8ffWcMwwchn8 pzZ5cCq8Dj78WpEF5GtgT5QYtqJzgPR9vppqkFII9CpWgtPSKUeMRmNdw117/JVqAMAlui 6QDIw7nPU0k7QUNt+4P/zSDXiu46PYUsTRg0tZWcatDDP3yEbJAKuVFEIogPhQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683534464; a=rsa-sha256; cv=none; b=M06QSF4d4+/egqEhjXB1tce8dutDbLwfPwPDNvjL1hlYtxa4KxPhNBrR2W7TQDPbL4pecI l5f63iX9iVP6iyKNocVAgQy6wf0ntYsZFK4zfXgEXvpYM1XwRzDOtSSfGPMV3wuJp6xuK5 Q9ypBIwVHyrPcyf7VBgxPmpJWud0PJeK0cTE4iy89gIodEKbF1FzLJ4iwLhGuoCb5oEea4 SN/OEb6oEJaGtWeihdMK9p9k0PwHJ5lnhdv71WnPQGeqQ/Z7//S/VyIM37soCmSJlqK/uh FlehX1xZZXLS4qw2KdqVcWEQzqzBlzPZt2MH96hlImnD01g/HvbOddVAl6Ho7g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QFDtm5pPzztPQ; Mon, 8 May 2023 08:27:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 3488RiVA051685; Mon, 8 May 2023 08:27:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3488RiCo051684; Mon, 8 May 2023 08:27:44 GMT (envelope-from git) Date: Mon, 8 May 2023 08:27:44 GMT Message-Id: <202305080827.3488RiCo051684@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org From: Robert Clausecker Subject: git: b08c440c2118 - 2023Q2 - mail/queue-repair: fix with Python 3 List-Id: Commits to the quarterly branches of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-branches@freebsd.org X-BeenThere: dev-commits-ports-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: ports X-Git-Refname: refs/heads/2023Q2 X-Git-Reftype: branch X-Git-Commit: b08c440c2118564c2b1acfb7dc5bf5d41e8c3f17 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch 2023Q2 has been updated by fuz: URL: https://cgit.FreeBSD.org/ports/commit/?id=b08c440c2118564c2b1acfb7dc5bf5d41e8c3f17 commit b08c440c2118564c2b1acfb7dc5bf5d41e8c3f17 Author: Jeff Schmidt AuthorDate: 2023-05-07 10:46:56 +0000 Commit: Robert Clausecker CommitDate: 2023-05-08 08:27:29 +0000 mail/queue-repair: fix with Python 3 Submitter becomes maintainer. Obtained from: https://notes.sagredo.eu/en/qmail-notes-185/queue-repair-21.html PR: 271273 MFH: 2023Q2 (cherry picked from commit 809ff8bfc9d4b3221ed5c5329d70d40ba3c8e900) --- mail/queue-repair/Makefile | 4 +- mail/queue-repair/files/patch-queue__repair.py | 250 +++++++++++++++++++++++++ 2 files changed, 252 insertions(+), 2 deletions(-) diff --git a/mail/queue-repair/Makefile b/mail/queue-repair/Makefile index d1f87269d25c..451c4b9f79fe 100644 --- a/mail/queue-repair/Makefile +++ b/mail/queue-repair/Makefile @@ -1,10 +1,10 @@ PORTNAME= queue-repair PORTVERSION= 0.9.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= mail python MASTER_SITES= http://pyropus.ca/software/${PORTNAME}/ -MAINTAINER= ports@FreeBSD.org +MAINTAINER= jeff.jschmidt@gmail.com COMMENT= Qmail queue diagnostic and repair tool WWW= http://pyropus.ca/software/queue-repair/ diff --git a/mail/queue-repair/files/patch-queue__repair.py b/mail/queue-repair/files/patch-queue__repair.py new file mode 100644 index 000000000000..e6bbfde3be65 --- /dev/null +++ b/mail/queue-repair/files/patch-queue__repair.py @@ -0,0 +1,250 @@ +https://bz-attachments.freebsd.org/attachment.cgi?id=242009 + +--- queue_repair.py.orig 2003-10-22 15:54:13 UTC ++++ queue_repair.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/local/bin/python3.9 + '''queue_repair.py - qmail tools in Python. + Copyright (C) 2001 Charles Cazabon + +@@ -58,7 +58,7 @@ users = { + + groups = { + 'qmail' : None, +- 'nofiles' : None, ++ 'qnofiles' : None, + } + + dirs = { +@@ -66,24 +66,24 @@ dirs = { + # key: pathname - all paths are relative to conf-qmail + # data: (user, group, mode, split) + # split is: 0 : no, 1 : yes, -1 : only with big-todo +- 'queue' : ('qmailq', 'qmail', 0750, 0), +- 'queue/bounce' : ('qmails', 'qmail', 0700, 0), +- 'queue/info' : ('qmails', 'qmail', 0700, 1), +- 'queue/intd' : ('qmailq', 'qmail', 0700, -1), +- 'queue/local' : ('qmails', 'qmail', 0700, 1), +- 'queue/lock' : ('qmailq', 'qmail', 0750, 0), +- 'queue/mess' : ('qmailq', 'qmail', 0750, 1), +- 'queue/pid' : ('qmailq', 'qmail', 0700, 0), +- 'queue/remote' : ('qmails', 'qmail', 0700, 1), +- 'queue/todo' : ('qmailq', 'qmail', 0750, -1), ++ 'queue' : ('qmailq', 'qmail', 0o750, 0), ++ 'queue/bounce' : ('qmails', 'qmail', 0o700, 0), ++ 'queue/info' : ('qmails', 'qmail', 0o700, 1), ++ 'queue/intd' : ('qmailq', 'qmail', 0o700, -1), ++ 'queue/local' : ('qmails', 'qmail', 0o700, 1), ++ 'queue/lock' : ('qmailq', 'qmail', 0o750, 0), ++ 'queue/mess' : ('qmailq', 'qmail', 0o750, 1), ++ 'queue/pid' : ('qmailq', 'qmail', 0o700, 0), ++ 'queue/remote' : ('qmails', 'qmail', 0o700, 1), ++ 'queue/todo' : ('qmailq', 'qmail', 0o750, -1), + } + + nondirs = { + # Files to check; format is: + # key: pathname - all paths are relative to conf-qmail + # data: (user, group, mode) +- 'queue/lock/sendmutex' : ('qmails', 'qmail', 0600), +- 'queue/lock/tcpto' : ('qmailr', 'qmail', 0644), ++ 'queue/lock/sendmutex' : ('qmails', 'qmail', 0o600), ++ 'queue/lock/tcpto' : ('qmailr', 'qmail', 0o644), + } + + +@@ -105,7 +105,7 @@ def primes(min, max): + while i <= max: + for p in primelist: + if (i % p == 0) or (p * p > i): break +- if (i % p <> 0): ++ if (i % p != 0): + primelist.append(i) + if i >= min: + result.append(i) +@@ -151,8 +151,8 @@ def determine_users(): + ''' + global users, groups + msg('finding qmail UIDs/GIDs...') +- us = users.keys() +- gs = groups.keys() ++ us = list(users.keys()) ++ gs = list(groups.keys()) + for u in us: + if users[u]: + # Handle case of someone else determining UIDs for us +@@ -182,7 +182,7 @@ def check_dir(path, user, group, mode): + that it has octal mode mode. If testmode is set, create path if it + doesn't exist. + ''' +- if checked_dir.has_key(path): ++ if path in checked_dir: + return + msg(' checking directory %s...' % path) + if not os.path.exists(path): +@@ -208,7 +208,7 @@ def chown(path, user, group): + + Verify path is owned by user:group, and make it so if testmode is not set. + ''' +- if checked_owner.has_key(path): ++ if path in checked_owner: + return + uid = users[user] + gid = groups[group] +@@ -223,7 +223,7 @@ def chown(path, user, group): + msg(' fixed, %s ownership %i:%i' % (path, s[ST_UID], s[ST_GID])) + else: + msg(' testmode, not fixing') +- except OSError, o: ++ except OSError as o: + err(o or '[no error message]') + checked_owner[path] = None + +@@ -233,7 +233,7 @@ def chmod(path, mode): + + Verify path has mode mode, and make it so if testmode is not set. + ''' +- if checked_mode.has_key(path): ++ if path in checked_mode: + return + try: + s = os.stat(path) +@@ -247,7 +247,7 @@ def chmod(path, mode): + msg(' changed %s mode to %o' % (path, newmode)) + else: + msg(' testmode, not fixing') +- except OSError, o: ++ except OSError as o: + err(o or '[no error message]') + checked_mode[path] = None + +@@ -259,7 +259,7 @@ def determine_split(): + ''' + splits = [] + msg('determining conf-split...') +- for (path, (user, group, mode, is_split)) in dirs.items(): ++ for (path, (user, group, mode, is_split)) in list(dirs.items()): + if is_split != 1: + continue + highest = 0 +@@ -311,7 +311,7 @@ def determine_bigtodo(split): + else: + msg(' found unexpected direntry %s' % p) + +- if splits == range(split): ++ if splits == list(range(split)): + # big-todo apparently in use + bigtodo = 1 + msg(' big-todo found') +@@ -330,14 +330,14 @@ def check_dirs(paths, split, bigtodo): + Verify ownership, mode, and contents of each queue directory in paths. + ''' + msg('checking main queue directories...') +- _dirs = paths.keys() ++ _dirs = list(paths.keys()) + _dirs.sort() + for path in _dirs: + (user, group, mode, is_split) = paths[path] + check_dir(path, user, group, mode) + + msg('checking split sub-directories...') +- for (path, (user, group, mode, is_split)) in paths.items(): ++ for (path, (user, group, mode, is_split)) in list(paths.items()): + if path in ('queue', 'queue/lock'): + # Nothing in these directories to check at this point + continue +@@ -345,7 +345,7 @@ def check_dirs(paths, split, bigtodo): + if not this_split: + splits = [] + else: +- splits = range(split) ++ splits = list(range(split)) + for i in splits: + splitpath = os.path.join(path, str(i)) + check_dir(splitpath, user, group, mode) +@@ -428,7 +428,7 @@ def check_files(paths): + Verify ownership and mode of each queue file in paths. + ''' + msg('checking files...') +- for (path, (user, group, mode)) in paths.items(): ++ for (path, (user, group, mode)) in list(paths.items()): + if os.path.exists(path): + if not os.path.isfile(path): + msg(' %s is not a file' % path) +@@ -467,7 +467,7 @@ def check_trigger(): + if not os.path.exists(path) and not testmode: + os.mkfifo(path) + chown(path, user, group) +- chmod(path, 0622) ++ chmod(path, 0o622) + + ####################################### + def check_messages(path, split): +@@ -516,7 +516,7 @@ def fix_inode_names(paths, split, bigtodo, misnamed): + check_messages(). Correct split sub-directory location as well. + ''' + msg('fixing misnamed messages...') +- for (path, (user, junk, junk, is_split)) in paths.items(): ++ for (path, (user, junk, junk, is_split)) in list(paths.items()): + for (oldhash, oldno, newno) in misnamed: + if not is_splitdir(is_split, bigtodo): + old_p = os.path.join(path, str(oldno)) +@@ -544,17 +544,17 @@ def check_hash_and_ownership(paths, split, bigtodo): + of all files found. + ''' + msg('checking split locations...') +- for (path, (user, group, junk, is_split)) in paths.items(): ++ for (path, (user, group, junk, is_split)) in list(paths.items()): + if path in ('queue', 'queue/lock'): + # Nothing in these directories to check at this point + continue + elif path in ('queue/mess', 'queue/todo'): +- mode = 0644 ++ mode = 0o644 + else: +- mode = 0600 ++ mode = 0o600 + this_split = is_splitdir(is_split, bigtodo) + if this_split: +- splits = range(split) ++ splits = list(range(split)) + else: + splits = [''] + for splitval in splits: +@@ -635,7 +635,7 @@ def check_queue(qmaildir=confqmail, test=1, force_spli + wd = os.getcwd() + try: + os.chdir(qmaildir) +- except StandardError: ++ except Exception: + err('failed to chdir to %s' % qmaildir) + + if testmode: +@@ -747,7 +747,7 @@ def main(): + if force_split < 1: + raise ValueError + except ValueError: +- raise getopt.error, 'split value must be a positive integer (%s)' % value ++ raise getopt.error('split value must be a positive integer (%s)' % value) + elif option in ('-n', '--no-bigtodo'): + force_bigtodo = -1 + elif option in ('-b', '--bigtodo'): +@@ -765,10 +765,10 @@ def main(): + create = 1 + if args: + if len(args) > 1: +- raise getopt.error, 'conf-qmail must be a single argument (%s)' % string.join(args) ++ raise getopt.error('conf-qmail must be a single argument (%s)' % string.join(args)) + qmaildir = args[0] + +- except getopt.error, o: ++ except getopt.error as o: + err('Error: %s' % o, showhelp=1) + + check_queue(qmaildir, test, force_split, force_bigtodo, create, mathishard) +@@ -776,3 +776,4 @@ def main(): + ####################################### + if __name__ == '__main__': + main() ++