Skip to content

Commit 822c01a

Browse files
committed
app-antivirus/clamav: rev bump
- Migrate to EAPI 7. - Fix USE=libclamav-only. - Set proper REQUIRED_USE to indicate that USE=libclamav-only will really only install libs. - Install HTML docs only when USE=doc is set. Closes: https://bugs.gentoo.org/709616 Package-Manager: Portage-2.3.94, Repoman-2.3.21 Signed-off-by: Thomas Deutschmann <[email protected]>
1 parent 073803e commit 822c01a

File tree

2 files changed

+123
-81
lines changed

2 files changed

+123
-81
lines changed

app-antivirus/clamav/clamav-0.102.2.ebuild app-antivirus/clamav/clamav-0.102.2-r1.ebuild

+97-81
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Copyright 1999-2020 Gentoo Authors
22
# Distributed under the terms of the GNU General Public License v2
33

4-
EAPI=6
4+
EAPI=7
55

6-
inherit autotools eutils flag-o-matic ltprune systemd
6+
inherit autotools flag-o-matic systemd
77

88
DESCRIPTION="Clam Anti-Virus Scanner"
99
HOMEPAGE="https://www.clamav.net/"
@@ -13,44 +13,43 @@ LICENSE="GPL-2"
1313
SLOT="0"
1414
KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ppc ppc64 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
1515
IUSE="bzip2 doc clamdtop clamsubmit iconv ipv6 libclamav-only libressl milter metadata-analysis-api selinux static-libs test uclibc xml"
16+
17+
REQUIRED_USE="libclamav-only? ( !clamdtop !clamsubmit !milter !metadata-analysis-api )"
18+
1619
RESTRICT="!test? ( test )"
1720

1821
# Require acct-{user,group}/clamav at build time so that we can set
1922
# the permissions on /var/lib/clamav in src_install rather than in
2023
# pkg_postinst; calling "chown" on the live filesystem scares me.
2124
CDEPEND="acct-group/clamav
2225
acct-user/clamav
26+
dev-libs/libltdl
27+
dev-libs/libmspack
28+
|| ( dev-libs/libpcre2 >dev-libs/libpcre-6 )
29+
>=sys-libs/zlib-1.2.2:=
2330
bzip2? ( app-arch/bzip2 )
2431
clamdtop? ( sys-libs/ncurses:0 )
32+
clamsubmit? ( net-misc/curl dev-libs/json-c:= )
33+
elibc_musl? ( sys-libs/fts-standalone )
2534
iconv? ( virtual/libiconv )
26-
metadata-analysis-api? ( dev-libs/json-c:= )
27-
milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )
28-
>=sys-libs/zlib-1.2.2:=
35+
!libclamav-only? ( net-misc/curl )
2936
!libressl? ( dev-libs/openssl:0= )
3037
libressl? ( dev-libs/libressl:0= )
31-
dev-libs/libltdl
32-
|| ( dev-libs/libpcre2 >dev-libs/libpcre-6 )
33-
dev-libs/libmspack
34-
xml? ( dev-libs/libxml2 )
35-
elibc_musl? ( sys-libs/fts-standalone )
36-
!libclamav-only? ( net-misc/curl )
37-
clamsubmit? ( net-misc/curl dev-libs/json-c:= )"
38-
REQUIRED_USE="
39-
libclamav-only? ( !clamsubmit )
40-
clamsubmit? ( !libclamav-only )
41-
"
38+
milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )
39+
xml? ( dev-libs/libxml2 )"
40+
41+
BDEPEND="virtual/pkgconfig"
4242

4343
DEPEND="${CDEPEND}
44-
virtual/pkgconfig
44+
metadata-analysis-api? ( dev-libs/json-c:* )
4545
test? ( dev-libs/check )"
4646
RDEPEND="${CDEPEND}
4747
selinux? ( sec-policy/selinux-clamav )"
4848

49-
HTML_DOCS=( docs/html/. )
50-
5149
PATCHES=(
5250
"${FILESDIR}/${PN}-0.101.2-tinfo.patch" #670729
5351
"${FILESDIR}/${PN}-0.102.1-libxml2_pkgconfig.patch" #661328
52+
"${FILESDIR}/${PN}-0.102.2-fix-curl-detection.patch" #709616
5453
)
5554

5655
src_prepare() {
@@ -106,79 +105,94 @@ src_install() {
106105
default
107106

108107
rm -rf "${ED}"/var/lib/clamav || die
109-
newinitd "${FILESDIR}"/clamd.initd-r6 clamd
110-
newconfd "${FILESDIR}"/clamd.conf-r1 clamd
111-
112-
systemd_dotmpfilesd "${FILESDIR}/tmpfiles.d/clamav.conf"
113-
systemd_newunit "${FILESDIR}/clamd_at.service" "[email protected]"
114-
systemd_dounit "${FILESDIR}/clamd.service"
115-
systemd_dounit "${FILESDIR}/freshclamd.service"
116-
117-
insinto /etc/logrotate.d
118-
newins "${FILESDIR}"/clamav.logrotate clamav
119-
120-
# Modify /etc/{clamd,freshclam}.conf to be usable out of the box
121-
sed -i -e "s:^\(Example\):\# \1:" \
122-
-e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.pid:" \
123-
-e "s:.*\(LocalSocket\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.sock:" \
124-
-e "s:.*\(User\) .*:\1 clamav:" \
125-
-e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \
126-
-e "s:^\#\(LogTime\).*:\1 yes:" \
127-
-e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
128-
-e "s:^\#\(DatabaseDirectory\).*:\1 /var/lib/clamav:" \
129-
"${ED}"/etc/clamd.conf.sample || die
130-
sed -i -e "s:^\(Example\):\# \1:" \
131-
-e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/freshclam.pid:" \
132-
-e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \
133-
-e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \
134-
-e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamd.conf:" \
135-
-e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
136-
-e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
137-
-e "s:^\#\(DatabaseDirectory\).*:\1 /var/lib/clamav:" \
138-
"${ED}"/etc/freshclam.conf.sample || die
139108

140-
if use milter ; then
141-
# MilterSocket one to include ' /' because there is a 2nd line for
142-
# inet: which we want to leave
143-
##dodoc "${FILESDIR}"/clamav-milter.README.gentoo
109+
if ! use libclamav-only ; then
110+
newinitd "${FILESDIR}"/clamd.initd-r6 clamd
111+
newconfd "${FILESDIR}"/clamd.conf-r1 clamd
112+
113+
systemd_dotmpfilesd "${FILESDIR}/tmpfiles.d/clamav.conf"
114+
systemd_newunit "${FILESDIR}/clamd_at.service" "[email protected]"
115+
systemd_dounit "${FILESDIR}/clamd.service"
116+
systemd_dounit "${FILESDIR}/freshclamd.service"
117+
118+
insinto /etc/logrotate.d
119+
newins "${FILESDIR}"/clamav.logrotate clamav
120+
121+
# Modify /etc/{clamd,freshclam}.conf to be usable out of the box
144122
sed -i -e "s:^\(Example\):\# \1:" \
145-
-e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamav-milter.pid:" \
146-
-e "s+^\#\(ClamdSocket\) .*+\1 unix:${EPREFIX}/var/run/clamav/clamd.sock+" \
123+
-e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.pid:" \
124+
-e "s:.*\(LocalSocket\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.sock:" \
147125
-e "s:.*\(User\) .*:\1 clamav:" \
148-
-e "s+^\#\(MilterSocket\) /.*+\1 unix:${EPREFIX}/var/run/clamav/clamav-milter.sock+" \
126+
-e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \
127+
-e "s:^\#\(LogTime\).*:\1 yes:" \
149128
-e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
150-
-e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:" \
151-
"${ED}"/etc/clamav-milter.conf.sample || die
152-
cat >> "${ED}"/etc/conf.d/clamd <<-EOF
153-
MILTER_NICELEVEL=19
154-
START_MILTER=no
155-
EOF
156-
157-
systemd_newunit "${FILESDIR}/clamav-milter.service-r1" clamav-milter.service
158-
fi
129+
-e "s:^\#\(DatabaseDirectory\).*:\1 /var/lib/clamav:" \
130+
"${ED}"/etc/clamd.conf.sample || die
159131

160-
if use doc; then
161-
einstalldocs
162-
doman docs/man/*.[1-8]
132+
sed -i -e "s:^\(Example\):\# \1:" \
133+
-e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/freshclam.pid:" \
134+
-e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \
135+
-e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \
136+
-e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamd.conf:" \
137+
-e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
138+
-e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
139+
-e "s:^\#\(DatabaseDirectory\).*:\1 /var/lib/clamav:" \
140+
"${ED}"/etc/freshclam.conf.sample || die
141+
142+
if use milter ; then
143+
# MilterSocket one to include ' /' because there is a 2nd line for
144+
# inet: which we want to leave
145+
##dodoc "${FILESDIR}"/clamav-milter.README.gentoo
146+
sed -i -e "s:^\(Example\):\# \1:" \
147+
-e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamav-milter.pid:" \
148+
-e "s+^\#\(ClamdSocket\) .*+\1 unix:${EPREFIX}/var/run/clamav/clamd.sock+" \
149+
-e "s:.*\(User\) .*:\1 clamav:" \
150+
-e "s+^\#\(MilterSocket\) /.*+\1 unix:${EPREFIX}/var/run/clamav/clamav-milter.sock+" \
151+
-e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
152+
-e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:" \
153+
"${ED}"/etc/clamav-milter.conf.sample || die
154+
155+
cat >> "${ED}"/etc/conf.d/clamd <<-EOF
156+
MILTER_NICELEVEL=19
157+
START_MILTER=no
158+
EOF
159+
160+
systemd_newunit "${FILESDIR}/clamav-milter.service-r1" clamav-milter.service
161+
fi
162+
163+
local i
164+
for i in clamd freshclam clamav-milter
165+
do
166+
if [[ -f "${ED}"/etc/"${i}".conf.sample ]]; then
167+
mv "${ED}"/etc/"${i}".conf{.sample,} || die
168+
fi
169+
done
170+
171+
# These both need to be writable by the clamav user.
172+
# TODO: use syslog by default; that's what it's for.
173+
diropts -o clamav -g clamav
174+
keepdir /var/lib/clamav
175+
keepdir /var/log/clamav
163176
fi
164177

165-
for i in clamd freshclam clamav-milter
166-
do
167-
if [[ -f "${D}"/etc/"${i}".conf.sample ]]; then
168-
mv "${D}"/etc/"${i}".conf{.sample,} || die
169-
fi
170-
done
178+
if use doc ; then
179+
local HTML_DOCS=( docs/html/. )
180+
einstalldocs
171181

172-
prune_libtool_files --all
182+
if ! use libclamav-only ; then
183+
doman docs/man/*.[1-8]
184+
fi
185+
fi
173186

174-
# These both need to be writable by the clamav user.
175-
# TODO: use syslog by default; that's what it's for.
176-
diropts -o clamav -g clamav
177-
keepdir /var/lib/clamav
178-
keepdir /var/log/clamav
187+
find "${ED}" -name '*.la' -delete || die
179188
}
180189

181190
src_test() {
191+
if use libclamav-only ; then
192+
ewarn "Test target not available when USE=libclamav-only is set, skipping tests ..."
193+
return 0
194+
fi
195+
182196
emake quick-check
183197
}
184198

@@ -187,11 +201,13 @@ pkg_postinst() {
187201
elog "For simple instructions how to setup the clamav-milter read the"
188202
elog "clamav-milter.README.gentoo in /usr/share/doc/${PF}"
189203
fi
190-
local databases=( "${ROOT}"var/lib/clamav/main.c[lv]d )
204+
205+
local databases=( "${EROOT}"/var/lib/clamav/main.c[lv]d )
191206
if [[ ! -f "${databases}" ]] ; then
192207
ewarn "You must run freshclam manually to populate the virus database"
193208
ewarn "before starting clamav for the first time."
194209
fi
210+
195211
elog "For instructions on how to use clamonacc, see"
196212
elog
197213
elog " https://www.clamav.net/documents/on-access-scanning"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
https://bugs.gentoo.org/709616
2+
3+
--- a/configure.ac
4+
+++ b/configure.ac
5+
@@ -197,6 +197,10 @@ AC_CONFIG_FILES([
6+
clamav-types.h
7+
clamav-version.h])
8+
if test "x$enable_libclamav_only" != "xyes"; then
9+
+ if test "$have_curl" = "no"; then
10+
+ AC_MSG_ERROR([libcurl not found. libcurl (e.g. libcurl-devel) is required in order to build freshclam and clamsubmit.])
11+
+ fi
12+
+
13+
AC_CONFIG_FILES([
14+
clamscan/Makefile
15+
database/Makefile
16+
--- a/m4/reorganization/libs/curl.m4
17+
+++ b/m4/reorganization/libs/curl.m4
18+
@@ -92,8 +92,6 @@ if test "X$have_curl" = "Xyes"; then
19+
)
20+
21+
LDFLAGS="$save_LDFLAGS"
22+
-else
23+
- AC_MSG_ERROR([libcurl not found. libcurl (e.g. libcurl-devel) is required in order to build freshclam and clamsubmit.])
24+
fi
25+
26+
AC_SUBST([CLAMSUBMIT_LIBS])

0 commit comments

Comments
 (0)