Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-antivirus/clamav/
Date: Mon, 21 Jun 2021 22:17:24
Message-Id: 1624313793.6658e4189b1a4aacb6eb831b6b8b9007e6c0f4da.mjo@gentoo
1 commit: 6658e4189b1a4aacb6eb831b6b8b9007e6c0f4da
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jun 21 22:09:11 2021 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Mon Jun 21 22:16:33 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6658e418
7
8 app-antivirus/clamav: new upstream version 0.103.3.
9
10 Package-Manager: Portage-3.0.18, Repoman-3.0.2
11 Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
12
13 app-antivirus/clamav/Manifest | 1 +
14 app-antivirus/clamav/clamav-0.103.3.ebuild | 234 +++++++++++++++++++++++++++++
15 2 files changed, 235 insertions(+)
16
17 diff --git a/app-antivirus/clamav/Manifest b/app-antivirus/clamav/Manifest
18 index 54a011c86e3..caae96b7ffe 100644
19 --- a/app-antivirus/clamav/Manifest
20 +++ b/app-antivirus/clamav/Manifest
21 @@ -1 +1,2 @@
22 DIST clamav-0.103.2.tar.gz 13387954 BLAKE2B de0ececd2fe4486d2e8194dbeb45bfb74086ab3eb45fcab7590e75aa5a2242981066a4e8fa99b571cf7278f4516d986ad1a24254a8fe2c5caf4c870b3179c4b6 SHA512 87d47c4529a57da0b47b3744a279996ca24fa74ce10d7e27a53c19c1e13098af680e0e48ed767122bb2bbd3f927302451da84ccf51a933e7e3556ef43cbe9f45
23 +DIST clamav-0.103.3.tar.gz 13389239 BLAKE2B 1846cceed39fbd48fcf973d05a57901cf6f9ccdbb4d7eae501e712d84ab4d0a662e4477696aa6a1446116db85a89603428d7092a55e18f7acb805016d3cd5431 SHA512 c2ee24a6f63735c064140aa5baa347d51e8240b2f7eced3480d05435202aedd481fa7057fd40ecbc2e93a62fe8b0cefb574d8accdf9acede643ffbe0d396686f
24
25 diff --git a/app-antivirus/clamav/clamav-0.103.3.ebuild b/app-antivirus/clamav/clamav-0.103.3.ebuild
26 new file mode 100644
27 index 00000000000..2e786a0b7c0
28 --- /dev/null
29 +++ b/app-antivirus/clamav/clamav-0.103.3.ebuild
30 @@ -0,0 +1,234 @@
31 +# Copyright 1999-2021 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=7
35 +
36 +inherit autotools flag-o-matic systemd tmpfiles
37 +
38 +DESCRIPTION="Clam Anti-Virus Scanner"
39 +HOMEPAGE="https://www.clamav.net/"
40 +SRC_URI="https://www.clamav.net/downloads/production/${P}.tar.gz"
41 +
42 +LICENSE="GPL-2"
43 +SLOT="0"
44 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
45 +IUSE="bzip2 doc clamonacc clamdtop clamsubmit iconv ipv6 libclamav-only milter metadata-analysis-api selinux systemd test uclibc xml"
46 +
47 +REQUIRED_USE="libclamav-only? ( !clamonacc !clamdtop !clamsubmit !milter !metadata-analysis-api )"
48 +
49 +RESTRICT="!test? ( test )"
50 +
51 +# Require acct-{user,group}/clamav at build time so that we can set
52 +# the permissions on /var/lib/clamav in src_install rather than in
53 +# pkg_postinst; calling "chown" on the live filesystem scares me.
54 +CDEPEND="acct-group/clamav
55 + acct-user/clamav
56 + dev-libs/libltdl
57 + dev-libs/libmspack
58 + || ( dev-libs/libpcre2 >dev-libs/libpcre-6 )
59 + dev-libs/tomsfastmath
60 + >=sys-libs/zlib-1.2.2:=
61 + bzip2? ( app-arch/bzip2 )
62 + clamdtop? ( sys-libs/ncurses:0 )
63 + clamsubmit? ( net-misc/curl dev-libs/json-c:= )
64 + elibc_musl? ( sys-libs/fts-standalone )
65 + iconv? ( virtual/libiconv )
66 + !libclamav-only? ( net-misc/curl )
67 + dev-libs/openssl:0=
68 + milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )
69 + xml? ( dev-libs/libxml2 )"
70 +
71 +# We need at least autoconf-2.69-r5 because that's the first (patched)
72 +# version of it in Gentoo that supports ./configure --runstatedir.
73 +BDEPEND=">=sys-devel/autoconf-2.69-r5
74 + virtual/pkgconfig"
75 +
76 +DEPEND="${CDEPEND}
77 + metadata-analysis-api? ( dev-libs/json-c:* )
78 + test? ( dev-libs/check )"
79 +RDEPEND="${CDEPEND}
80 + selinux? ( sec-policy/selinux-clamav )"
81 +
82 +PATCHES=(
83 + "${FILESDIR}/${PN}-0.102.1-libxml2_pkgconfig.patch" #661328
84 + "${FILESDIR}/${PN}-0.102.2-fix-curl-detection.patch" #709616
85 + "${FILESDIR}/${PN}-0.103.0-system-tomsfastmath.patch" # 649394
86 + "${FILESDIR}/${PN}-0.103.1-upstream-openrc.patch"
87 +)
88 +
89 +src_prepare() {
90 + default
91 +
92 + # Be extra sure that we're using the system copy of tomsfastmath
93 + einfo "removing bundled copy of dev-libs/tomsfastmath"
94 + rm -r libclamav/tomsfastmath || \
95 + die "failed to remove bundled tomsfastmath"
96 +
97 + AT_NO_RECURSIVE="yes" eautoreconf
98 +}
99 +
100 +src_configure() {
101 + use elibc_musl && append-ldflags -lfts
102 + use ppc64 && append-flags -mminimal-toc
103 + use uclibc && export ac_cv_type_error_t=yes
104 +
105 + # according to configure help it should be
106 + # $(use_enable xml)
107 + # but that does not work
108 + # do not add this, since --disable-xml seems to override
109 + # --without-xml
110 + JSONUSE="--without-libjson"
111 +
112 + if use clamsubmit || use metadata-analysis-api; then
113 + # either of those 2 requires libjson.
114 + # clamsubmit will be built as soon as libjson and curl are found
115 + # but we only install the binary if requested
116 + JSONUSE="--with-libjson=${EPREFIX}/usr"
117 + fi
118 +
119 + local myeconfargs=(
120 + $(use_enable bzip2)
121 + $(use_enable clamonacc)
122 + $(use_enable clamdtop)
123 + $(use_enable ipv6)
124 + $(use_enable milter)
125 + $(use_enable test check)
126 + $(use_with xml)
127 + $(use_with iconv)
128 + ${JSONUSE}
129 + $(use_enable libclamav-only)
130 + $(use_with !libclamav-only libcurl)
131 + --with-system-libmspack
132 + --cache-file="${S}"/config.cache
133 + --disable-experimental
134 + --disable-static
135 + --disable-zlib-vcheck
136 + --enable-id-check
137 + --with-dbdir="${EPREFIX}"/var/lib/clamav
138 + # Don't call --with-zlib=/usr (see bug #699296)
139 + --with-zlib
140 + --disable-llvm
141 + --enable-openrc
142 + --runstatedir=/run
143 + )
144 + econf "${myeconfargs[@]}"
145 +}
146 +
147 +src_install() {
148 + default
149 +
150 + rm -rf "${ED}"/var/lib/clamav || die
151 +
152 + if ! use libclamav-only ; then
153 + if use systemd; then
154 + # The tmpfiles entry is behind USE=systemd because the
155 + # upstream OpenRC service files should (and do) ensure that
156 + # the directories they need exist and have the correct
157 + # permissions without the help of opentmpfiles. There are
158 + # years-old root exploits in opentmpfiles, the design is
159 + # fundamentally flawed, and the maintainer is not up to
160 + # the task of fixing it.
161 + dotmpfiles "${FILESDIR}/tmpfiles.d/clamav.conf"
162 + systemd_newunit "${FILESDIR}/clamd_at.service" "clamd@.service"
163 + systemd_dounit "${FILESDIR}/clamd.service"
164 + systemd_newunit "${FILESDIR}/freshclamd.service-r1" \
165 + "freshclamd.service"
166 + fi
167 +
168 + insinto /etc/logrotate.d
169 + newins "${FILESDIR}/clamd.logrotate" clamd
170 + newins "${FILESDIR}/freshclam.logrotate" freshclam
171 + use milter && \
172 + newins "${FILESDIR}/clamav-milter.logrotate" clamav-milter
173 +
174 + # Modify /etc/{clamd,freshclam}.conf to be usable out of the box
175 + sed -i -e "s:^\(Example\):\# \1:" \
176 + -e "s/^#\(PidFile .*\)/\1/" \
177 + -e "s/^#\(LocalSocket .*\)/\1/" \
178 + -e "s/^#\(User .*\)/\1/" \
179 + -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \
180 + -e "s:^\#\(LogTime\).*:\1 yes:" \
181 + -e "s/^#\(DatabaseDirectory .*\)/\1/" \
182 + "${ED}"/etc/clamd.conf.sample || die
183 +
184 + sed -i -e "s:^\(Example\):\# \1:" \
185 + -e "s/^#\(PidFile .*\)/\1/" \
186 + -e "s/^#\(DatabaseOwner .*\)/\1/" \
187 + -e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \
188 + -e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamd.conf:" \
189 + -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
190 + -e "s/^#\(DatabaseDirectory .*\)/\1/" \
191 + "${ED}"/etc/freshclam.conf.sample || die
192 +
193 + if use milter ; then
194 + # Note: only keep the "unix" ClamdSocket and MilterSocket!
195 + sed -i -e "s:^\(Example\):\# \1:" \
196 + -e "s/^#\(PidFile .*\)/\1/" \
197 + -e "s/^#\(ClamdSocket unix:.*\)/\1/" \
198 + -e "s/^#\(User .*\)/\1/" \
199 + -e "s/^#\(MilterSocket unix:.*\)/\1/" \
200 + -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:" \
201 + "${ED}"/etc/clamav-milter.conf.sample || die
202 +
203 + cat >> "${ED}"/etc/conf.d/clamd <<-EOF
204 + MILTER_NICELEVEL=19
205 + START_MILTER=no
206 + EOF
207 +
208 + systemd_newunit "${FILESDIR}/clamav-milter.service-r1" clamav-milter.service
209 + fi
210 +
211 + local i
212 + for i in clamd freshclam clamav-milter
213 + do
214 + if [[ -f "${ED}"/etc/"${i}".conf.sample ]]; then
215 + mv "${ED}"/etc/"${i}".conf{.sample,} || die
216 + fi
217 + done
218 +
219 + # These both need to be writable by the clamav user.
220 + # TODO: use syslog by default; that's what it's for.
221 + diropts -o clamav -g clamav
222 + keepdir /var/lib/clamav
223 + keepdir /var/log/clamav
224 + fi
225 +
226 + if use doc ; then
227 + local HTML_DOCS=( docs/html/. )
228 + einstalldocs
229 +
230 + if ! use libclamav-only ; then
231 + doman docs/man/*.[1-8]
232 + fi
233 + fi
234 +
235 + find "${ED}" -name '*.la' -delete || die
236 +}
237 +
238 +src_test() {
239 + if use libclamav-only ; then
240 + ewarn "Test target not available when USE=libclamav-only is set, skipping tests ..."
241 + return 0
242 + fi
243 +
244 + emake quick-check
245 +}
246 +
247 +pkg_postinst() {
248 + if use milter ; then
249 + elog "For simple instructions how to setup the clamav-milter read the"
250 + elog "clamav-milter.README.gentoo in /usr/share/doc/${PF}"
251 + fi
252 +
253 + local databases=( "${EROOT}"/var/lib/clamav/main.c[lv]d )
254 + if [[ ! -f "${databases}" ]] ; then
255 + ewarn "You must run freshclam manually to populate the virus database"
256 + ewarn "before starting clamav for the first time."
257 + fi
258 +
259 + ewarn "This version of ClamAV provides separate OpenRC services"
260 + ewarn "for clamd, freshclam, clamav-milter, and clamonacc. The"
261 + ewarn "clamd service now starts only the clamd daemon itself. You"
262 + ewarn "should add freshclam (and perhaps clamav-milter) to any"
263 + ewarn "runlevels that previously contained clamd."
264 +}