From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 00DCC1382C5 for ; Fri, 14 May 2021 17:23:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2E116E086A; Fri, 14 May 2021 17:23:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 11723E086A for ; Fri, 14 May 2021 17:23:02 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A73D4340DFC for ; Fri, 14 May 2021 17:23:00 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 135C8644 for ; Fri, 14 May 2021 17:22:59 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1621012942.592ea98a632c53260a6358ce42280cd3076c3d34.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/fail2ban/files/, net-analyzer/fail2ban/ X-VCS-Repository: repo/gentoo X-VCS-Files: net-analyzer/fail2ban/fail2ban-0.11.2.ebuild net-analyzer/fail2ban/files/fail2ban-0.11.2-fix-tests-for-2021.patch X-VCS-Directories: net-analyzer/fail2ban/files/ net-analyzer/fail2ban/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 592ea98a632c53260a6358ce42280cd3076c3d34 X-VCS-Branch: master Date: Fri, 14 May 2021 17:22:59 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 248b3643-916a-4edb-93d9-12e425af529b X-Archives-Hash: 6fa7ccd050c008d0aedd7bd8f67188f7 commit: 592ea98a632c53260a6358ce42280cd3076c3d34 Author: Sam James gentoo org> AuthorDate: Fri May 14 12:51:59 2021 +0000 Commit: Sam James gentoo org> CommitDate: Fri May 14 17:22:22 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=592ea98a net-analyzer/fail2ban: run tests Signed-off-by: Sam James gentoo.org> net-analyzer/fail2ban/fail2ban-0.11.2.ebuild | 12 ++++-- .../files/fail2ban-0.11.2-fix-tests-for-2021.patch | 50 ++++++++++++++++++++++ 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/net-analyzer/fail2ban/fail2ban-0.11.2.ebuild b/net-analyzer/fail2ban/fail2ban-0.11.2.ebuild index 8f57fd666aa..1c47a71b51d 100644 --- a/net-analyzer/fail2ban/fail2ban-0.11.2.ebuild +++ b/net-analyzer/fail2ban/fail2ban-0.11.2.ebuild @@ -16,8 +16,6 @@ LICENSE="GPL-2" SLOT="0" KEYWORDS="~alpha amd64 arm ~arm64 hppa ppc ppc64 sparc x86" IUSE="selinux systemd" -# Needs some work to enable them right now -RESTRICT="test" RDEPEND=" virtual/logger @@ -34,9 +32,11 @@ RDEPEND=" DOCS=( ChangeLog DEVELOP README.md THANKS TODO doc/run-rootless.txt ) -python_prepare_all() { - default +PATCHES=( + "${FILESDIR}"/${P}-fix-tests-for-2021.patch +) +python_prepare_all() { # Replace /var/run with /run, but not in the top source directory find . -mindepth 2 -type f -exec \ sed -i -e 's|/var\(/run/fail2ban\)|\1|g' {} + || die @@ -51,6 +51,10 @@ python_compile() { distutils-r1_python_compile } +python_test() { + bin/fail2ban-testcases -n -g --verbosity=4 || die "Tests failed with ${EPYTHON}" +} + python_install_all() { distutils-r1_python_install_all diff --git a/net-analyzer/fail2ban/files/fail2ban-0.11.2-fix-tests-for-2021.patch b/net-analyzer/fail2ban/files/fail2ban-0.11.2-fix-tests-for-2021.patch new file mode 100644 index 00000000000..36193b18193 --- /dev/null +++ b/net-analyzer/fail2ban/files/fail2ban-0.11.2-fix-tests-for-2021.patch @@ -0,0 +1,50 @@ +https://github.com/fail2ban/fail2ban/issues/2904 + +From 747d4683221b5584f9663695fb48145689b42ceb Mon Sep 17 00:00:00 2001 +From: sebres +Date: Mon, 4 Jan 2021 02:42:38 +0100 +Subject: [PATCH] fixes century selector of %ExY and %Exy in datepattern for + tests, considering interval from 2005 (alternate now) to now; + better + grouping algorithm for resulting century RE + +--- + fail2ban/server/strptime.py | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + +diff --git a/fail2ban/server/strptime.py b/fail2ban/server/strptime.py +index 1464a96d1f..39fc795865 100644 +--- a/fail2ban/server/strptime.py ++++ b/fail2ban/server/strptime.py +@@ -36,10 +36,30 @@ def _getYearCentRE(cent=(0,3), distance=3, now=(MyTime.now(), MyTime.alternateNo + Thereby respect possible run in the test-cases (alternate date used there) + """ + cent = lambda year, f=cent[0], t=cent[1]: str(year)[f:t] ++ def grp(exprset): ++ c = None ++ if len(exprset) > 1: ++ for i in exprset: ++ if c is None or i[0:-1] == c: ++ c = i[0:-1] ++ else: ++ c = None ++ break ++ if not c: ++ for i in exprset: ++ if c is None or i[0] == c: ++ c = i[0] ++ else: ++ c = None ++ break ++ if c: ++ return "%s%s" % (c, grp([i[len(c):] for i in exprset])) ++ return ("(?:%s)" % "|".join(exprset) if len(exprset[0]) > 1 else "[%s]" % "".join(exprset)) \ ++ if len(exprset) > 1 else "".join(exprset) + exprset = set( cent(now[0].year + i) for i in (-1, distance) ) + if len(now) and now[1]: +- exprset |= set( cent(now[1].year + i) for i in (-1, distance) ) +- return "(?:%s)" % "|".join(exprset) if len(exprset) > 1 else "".join(exprset) ++ exprset |= set( cent(now[1].year + i) for i in xrange(-1, now[0].year-now[1].year+1, distance) ) ++ return grp(sorted(list(exprset))) + + timeRE = TimeRE() +