diff options
author | Sam James <sam@gentoo.org> | 2021-05-14 12:51:59 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2021-05-14 17:22:22 +0000 |
commit | 592ea98a632c53260a6358ce42280cd3076c3d34 (patch) | |
tree | e92f26625bd1293d3698ffb2557c3287973df8f7 /net-analyzer/fail2ban | |
parent | sys-kernel/gentoo-sources: Linux patch 5.11.21 (diff) | |
download | gentoo-592ea98a632c53260a6358ce42280cd3076c3d34.tar.gz gentoo-592ea98a632c53260a6358ce42280cd3076c3d34.tar.bz2 gentoo-592ea98a632c53260a6358ce42280cd3076c3d34.zip |
net-analyzer/fail2ban: run tests
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net-analyzer/fail2ban')
-rw-r--r-- | net-analyzer/fail2ban/fail2ban-0.11.2.ebuild | 12 | ||||
-rw-r--r-- | net-analyzer/fail2ban/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 8f57fd666aa7..1c47a71b51d9 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 000000000000..36193b181933 --- /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 <info@sebres.de> +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() + |