From f156eefc5d2c6fbae85d0c2472dc80ceef030808 Mon Sep 17 00:00:00 2001 From: Ralph Seichter Date: Wed, 21 Feb 2024 16:57:07 +0100 Subject: [PATCH] app-antivirus/fangfrisch: Bump to version 1.9.0 Upstream feature release with improved unit tests. The ebuild now also performs a subset of these tests, i.e. the ones which don't require network access. Closes: https://bugs.gentoo.org/923651 Signed-off-by: Ralph Seichter Closes: https://github.com/gentoo/gentoo/pull/35469 Signed-off-by: Sam James --- app-antivirus/fangfrisch/Manifest | 1 + .../fangfrisch/fangfrisch-1.9.0.ebuild | 78 ++++++++++++++++++ .../fangfrisch/files/fangfrisch-has-news.sh | 82 +++++++++++++++++++ .../fangfrisch/files/fangfrisch.conf | 7 ++ 4 files changed, 168 insertions(+) create mode 100644 app-antivirus/fangfrisch/fangfrisch-1.9.0.ebuild create mode 100644 app-antivirus/fangfrisch/files/fangfrisch-has-news.sh diff --git a/app-antivirus/fangfrisch/Manifest b/app-antivirus/fangfrisch/Manifest index 0555add138a4e..751f0940857ea 100644 --- a/app-antivirus/fangfrisch/Manifest +++ b/app-antivirus/fangfrisch/Manifest @@ -1 +1,2 @@ DIST fangfrisch-1.6.1.gh.tar.gz 113497 BLAKE2B a37b5b29b31a1d0166112b8939e691acc1721a91bda9e364a90c0c8d4ea7b7d3e1a24b8849c9ef4f0632996ed7bbdfc7985ab04c44c8ca4d57df21294867fd32 SHA512 a16b39b6520d80f69c561bc2d56fef28acaca35a9da214be920cdd907f76d3d6674ed4aa1290ad11a9364ede11472594d7e331ecd21924fe23e005ef9501d4ac +DIST fangfrisch-1.9.0.tar.gz 127572 BLAKE2B c05c68f904a6e7c7d9f9c5b82bb63366f86653cd13a94276108f52e9c523280320c8aa55ba94ecf079ba938a77e11ca7dc557f4c8fd1b1c7f37179c087dd8605 SHA512 08cc36f20884fedb553de905b8faafce99fcef80e3bce7c0b264691b1a8d83b91a582c095b684f6f7a6af77fd4ed0405fa771a74bbeee3f1b255ff74a161d37e diff --git a/app-antivirus/fangfrisch/fangfrisch-1.9.0.ebuild b/app-antivirus/fangfrisch/fangfrisch-1.9.0.ebuild new file mode 100644 index 0000000000000..fa8da097c4c36 --- /dev/null +++ b/app-antivirus/fangfrisch/fangfrisch-1.9.0.ebuild @@ -0,0 +1,78 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{10..12} ) + +inherit distutils-r1 readme.gentoo-r1 systemd + +DESCRIPTION="Update and verify unofficial Clam Anti-Virus signatures" +HOMEPAGE="https://github.com/rseichter/fangfrisch https://pypi.org/project/fangfrisch/" +SRC_URI="https://github.com/rseichter/fangfrisch/archive/${PV}.tar.gz -> ${P}.tar.gz" + +MY_CONF="/etc/${PN}.conf" +MY_DBDIR="/var/lib/${PN}" +DISABLE_AUTOFORMATTING=1 +DOC_CONTENTS="See https://rseichter.github.io/fangfrisch/ for the official +documentation. + +### Fresh installations: + +Modify ${MY_CONF} according to your preferences. +Assuming you place the database into ${MY_DBDIR} +(recommended), execute the following commands in a root shell: + +mkdir -m 0770 ${MY_DBDIR} +chgrp clamav ${MY_DBDIR} +sudo -u clamav -- fangfrisch -c ${MY_CONF} initdb + +You can now enable /etc/cron.d/${PN} for periodic updates. + +### Updating from a previous release: + +Either create a fresh database or manually delete all existing +database tables, then run the initdb command as shown above." + +LICENSE="GPL-3+" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +DEPEND=" + >=dev-python/requests-2.22.0[${PYTHON_USEDEP}] + >=dev-python/sqlalchemy-1.4.0[${PYTHON_USEDEP}] +" +RDEPEND="${DEPEND}" + +distutils_enable_tests unittest + +python_prepare_all() { + sed -i -e '/SQLAlchemy/d' setup.cfg || die + # Mitigate build system warnings, see + # https://projects.gentoo.org/python/guide/qawarn.html#stray-top-level-files-in-site-packages + cat >>setup.cfg <&2 "$@" + exit 1 +} + +usage() { + die "Usage: $(basename "$0") {directory}" +} + +gen_header() { + cat < +To: $MAILTO +Subject: $SUBJECT + +EOT +# Mail header must end with an empty line! +} + +declare -a NEWSITEMS=() + +report_news() { + local dir=$1 ni + [ -d "$dir" ] || die "$dir is not a directory" + while IFS= read -r -d '' ni; do + if [ ${#NEWSITEMS[*]} -eq 0 ] && [ "$MAILAPP" != mutt ]; then + # Mutt does not need the header, others do. + gen_header + fi + NEWSITEMS+=( "$ni" ) + echo -e "\n### $(basename "$ni"):\n" + cat "$ni" + done < <(find "$dir" -maxdepth 1 -type f -name "fangfrisch*.txt" -print0) +} + +main() { + local t + [ -n "$MAILAPP" ] || die "MAILAPP is undefined, exiting." + if tty -s; then + # Running in a terminal session + t=$(mktemp) + # shellcheck disable=SC2064 + trap "rm $t" EXIT + report_news "$@" | tee "$t" || exit 1 + [ ! -s "$t" ] || "$MAILAPP" "${MAILAPP_OPT[@]}" >/dev/null <"$t" + else + report_news "$@" 2>&1 | "$MAILAPP" "${MAILAPP_OPT[@]}" >/dev/null + [ ${#NEWSITEMS[*]} -eq 0 ] || rm -v "${NEWSITEMS[@]}" + fi +} + +[ $# -ge 1 ] || usage +main "$@" diff --git a/app-antivirus/fangfrisch/files/fangfrisch.conf b/app-antivirus/fangfrisch/files/fangfrisch.conf index ded86b9cc9816..0fbc71ec16dca 100644 --- a/app-antivirus/fangfrisch/files/fangfrisch.conf +++ b/app-antivirus/fangfrisch/files/fangfrisch.conf @@ -7,6 +7,13 @@ log_method = syslog log_target = /dev/log on_update_exec = clamdscan --reload +[fangfrischnews] +enabled = yes +# Uncomment/adapt the following to trigger a script in case of news. +# The bundled example script needs to be manually modified before +# it can be used! +# script = /etc/fangfrisch-has-news.sh + [malwarepatrol] enabled = yes # Replace with your personal Malwarepatrol receipt