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 <github@seichter.de>
Closes: https://github.com/gentoo/gentoo/pull/35469
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Ralph Seichter
2024-02-21 16:57:07 +01:00
committed by Sam James
parent 49b492cfbb
commit f156eefc5d
4 changed files with 168 additions and 0 deletions

View File

@@ -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

View File

@@ -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 <<EOT
[options.packages.find]
exclude =
tests
tests.*
EOT
distutils-r1_python_prepare_all
}
python_install_all() {
insinto /etc
doins "${FILESDIR}/${PN}.conf"
insinto /etc/cron.d
newins "${FILESDIR}/${PN}.cron" "${PN}"
exeinto /etc
doexe "${FILESDIR}/${PN}-has-news.sh"
systemd_dounit "${FILESDIR}/${PN}.service"
systemd_dounit "${FILESDIR}/${PN}.timer"
distutils-r1_python_install_all
readme.gentoo_create_doc
}
pkg_postinst() {
FORCE_PRINT_ELOG=1 readme.gentoo_print_elog
}

View File

@@ -0,0 +1,82 @@
#!/usr/bin/env bash
# vim: ts=4 sw=4 noet ft=sh
#
# Example script to process Fangfrisch News.
declare -r MAILFROM="noreply"
declare -r MAILTO="alice@example.com"
declare -r SUBJECT="Fangfrisch News are available"
# Pick one of the following options and uncomment the 'declare'
# statements. Otherwise, the script will not run otherwise.
# Option 1: Mutt
#declare -r MAILAPP="mutt"
#declare -r MAILAPP_OPT=( "-s" "$SUBJECT" "$MAILTO" )
# Option 2: sendmail
#declare -r MAILAPP="sendmail"
#declare -r MAILAPP_OPT=( "-t" )
#export PATH="$PATH:/usr/sbin"
# Option 3: swaks
#declare -r MAILAPP="swaks"
#declare -r MAILAPP_OPT=( "-d" "-" "-f" "$MAILFROM" "-t" "$MAILTO" )
### No changes required below this line ###
set -euo pipefail
die() {
echo >&2 "$@"
exit 1
}
usage() {
die "Usage: $(basename "$0") {directory}"
}
gen_header() {
cat <<EOT
From: Fangfrisch News <$MAILFROM>
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 "$@"

View File

@@ -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