Gentoo Archives: gentoo-commits

From: Thomas Raschbacher <lordvan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-antivirus/clamav/
Date: Tue, 12 May 2020 18:40:55
Message-Id: 1589308549.7049f9872d507d71103b759add938288ae7d5813.lordvan@gentoo
1 commit: 7049f9872d507d71103b759add938288ae7d5813
2 Author: Thomas Raschbacher <lordvan <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 12 18:35:49 2020 +0000
4 Commit: Thomas Raschbacher <lordvan <AT> gentoo <DOT> org>
5 CommitDate: Tue May 12 18:35:49 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7049f987
7
8 app-antivirus/clamav: version bump
9
10 fixes CVE-2020-3327, CVE-2020-3341
11
12 Package-Manager: Portage-2.3.99, Repoman-2.3.22
13 Signed-off-by: Thomas Raschbacher <lordvan <AT> gentoo.org>
14
15 app-antivirus/clamav/Manifest | 1 +
16 app-antivirus/clamav/clamav-0.102.3.ebuild | 214 +++++++++++++++++++++++++++++
17 2 files changed, 215 insertions(+)
18
19 diff --git a/app-antivirus/clamav/Manifest b/app-antivirus/clamav/Manifest
20 index 0b7df1fc6c4..213281bf6a9 100644
21 --- a/app-antivirus/clamav/Manifest
22 +++ b/app-antivirus/clamav/Manifest
23 @@ -1 +1,2 @@
24 DIST clamav-0.102.2.tar.gz 13227538 BLAKE2B 09d18f507a439f1dd63ebc038b129e0ead75bb344bfad2b5bd36e2c0c76af01f42fcacc60ff40b5676cb5fb7b38b90747452654a5d104b9b7b5e2d5a06b3dc2d SHA512 7db53e0e2b4d6b0e4cf5048d3c9dfbcabcffd680c3a2b718c763b9599b0c1c14e56bae70c54c251ee9e8fd1acd3134657196dbaad2d23a16bad76a088c6fc41f
25 +DIST clamav-0.102.3.tar.gz 13226108 BLAKE2B 741c0cc6a088ffe880eabb7a59151b3c13c5754f9cb36582ffca9cbeea6b039e3c49b7155ba14fa302e9ee4bfa6adf8b98f0e29f2354ea8569b11b1ed2b2532c SHA512 d239718814b303fb0f1655d9bdaf3675d888eea57e786d927eafabb7b6f58cd7f5fb7dc149511c2af6f800dcc919f2e1d6954110d45b9e16619c632e8d2b37f2
26
27 diff --git a/app-antivirus/clamav/clamav-0.102.3.ebuild b/app-antivirus/clamav/clamav-0.102.3.ebuild
28 new file mode 100644
29 index 00000000000..35a1db0325c
30 --- /dev/null
31 +++ b/app-antivirus/clamav/clamav-0.102.3.ebuild
32 @@ -0,0 +1,214 @@
33 +# Copyright 1999-2020 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=7
37 +
38 +inherit autotools flag-o-matic systemd
39 +
40 +DESCRIPTION="Clam Anti-Virus Scanner"
41 +HOMEPAGE="https://www.clamav.net/"
42 +SRC_URI="https://www.clamav.net/downloads/production/${P}.tar.gz"
43 +
44 +LICENSE="GPL-2"
45 +SLOT="0"
46 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
47 +IUSE="bzip2 doc clamdtop clamsubmit iconv ipv6 libclamav-only libressl milter metadata-analysis-api selinux test uclibc xml"
48 +
49 +REQUIRED_USE="libclamav-only? ( !clamdtop !clamsubmit !milter !metadata-analysis-api )"
50 +
51 +RESTRICT="!test? ( test )"
52 +
53 +# Require acct-{user,group}/clamav at build time so that we can set
54 +# the permissions on /var/lib/clamav in src_install rather than in
55 +# pkg_postinst; calling "chown" on the live filesystem scares me.
56 +CDEPEND="acct-group/clamav
57 + acct-user/clamav
58 + dev-libs/libltdl
59 + dev-libs/libmspack
60 + || ( dev-libs/libpcre2 >dev-libs/libpcre-6 )
61 + >=sys-libs/zlib-1.2.2:=
62 + bzip2? ( app-arch/bzip2 )
63 + clamdtop? ( sys-libs/ncurses:0 )
64 + clamsubmit? ( net-misc/curl dev-libs/json-c:= )
65 + elibc_musl? ( sys-libs/fts-standalone )
66 + iconv? ( virtual/libiconv )
67 + !libclamav-only? ( net-misc/curl )
68 + !libressl? ( dev-libs/openssl:0= )
69 + libressl? ( dev-libs/libressl:0= )
70 + milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )
71 + xml? ( dev-libs/libxml2 )"
72 +
73 +BDEPEND="virtual/pkgconfig"
74 +
75 +DEPEND="${CDEPEND}
76 + metadata-analysis-api? ( dev-libs/json-c:* )
77 + test? ( dev-libs/check )"
78 +RDEPEND="${CDEPEND}
79 + selinux? ( sec-policy/selinux-clamav )"
80 +
81 +PATCHES=(
82 + "${FILESDIR}/${PN}-0.101.2-tinfo.patch" #670729
83 + "${FILESDIR}/${PN}-0.102.1-libxml2_pkgconfig.patch" #661328
84 + "${FILESDIR}/${PN}-0.102.2-fix-curl-detection.patch" #709616
85 +)
86 +
87 +src_prepare() {
88 + default
89 + eautoconf
90 +}
91 +
92 +src_configure() {
93 + use elibc_musl && append-ldflags -lfts
94 + use ppc64 && append-flags -mminimal-toc
95 + use uclibc && export ac_cv_type_error_t=yes
96 +
97 + # according to configure help it should be
98 + # $(use_enable xml)
99 + # but that does not work
100 + # do not add this, since --disable-xml seems to override
101 + # --without-xml
102 + JSONUSE="--without-libjson"
103 +
104 + if use clamsubmit || use metadata-analysis-api; then
105 + # either of those 2 requires libjson.
106 + # clamsubmit will be built as soon as libjson and curl are found
107 + # but we only install the binary if requested
108 + JSONUSE="--with-libjson=${EPREFIX}/usr"
109 + fi
110 +
111 + local myeconfargs=(
112 + $(use_enable bzip2)
113 + $(use_enable clamdtop)
114 + $(use_enable ipv6)
115 + $(use_enable milter)
116 + $(use_enable test check)
117 + $(use_with xml)
118 + $(use_with iconv)
119 + ${JSONUSE}
120 + $(use_enable libclamav-only)
121 + $(use_with !libclamav-only libcurl)
122 + --with-system-libmspack
123 + --cache-file="${S}"/config.cache
124 + --disable-experimental
125 + --disable-static
126 + --disable-zlib-vcheck
127 + --enable-id-check
128 + --with-dbdir="${EPREFIX}"/var/lib/clamav
129 + # Don't call --with-zlib=/usr (see bug #699296)
130 + --with-zlib
131 + --disable-llvm
132 + )
133 + econf "${myeconfargs[@]}"
134 +}
135 +
136 +src_install() {
137 + default
138 +
139 + rm -rf "${ED}"/var/lib/clamav || die
140 +
141 + if ! use libclamav-only ; then
142 + newinitd "${FILESDIR}"/clamd.initd-r6 clamd
143 + newconfd "${FILESDIR}"/clamd.conf-r1 clamd
144 +
145 + systemd_dotmpfilesd "${FILESDIR}/tmpfiles.d/clamav.conf"
146 + systemd_newunit "${FILESDIR}/clamd_at.service" "clamd@.service"
147 + systemd_dounit "${FILESDIR}/clamd.service"
148 + systemd_dounit "${FILESDIR}/freshclamd.service"
149 +
150 + insinto /etc/logrotate.d
151 + newins "${FILESDIR}"/clamav.logrotate clamav
152 +
153 + # Modify /etc/{clamd,freshclam}.conf to be usable out of the box
154 + sed -i -e "s:^\(Example\):\# \1:" \
155 + -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.pid:" \
156 + -e "s:.*\(LocalSocket\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.sock:" \
157 + -e "s:.*\(User\) .*:\1 clamav:" \
158 + -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \
159 + -e "s:^\#\(LogTime\).*:\1 yes:" \
160 + -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
161 + -e "s:^\#\(DatabaseDirectory\).*:\1 /var/lib/clamav:" \
162 + "${ED}"/etc/clamd.conf.sample || die
163 +
164 + sed -i -e "s:^\(Example\):\# \1:" \
165 + -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/freshclam.pid:" \
166 + -e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \
167 + -e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \
168 + -e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamd.conf:" \
169 + -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
170 + -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
171 + -e "s:^\#\(DatabaseDirectory\).*:\1 /var/lib/clamav:" \
172 + "${ED}"/etc/freshclam.conf.sample || die
173 +
174 + if use milter ; then
175 + # MilterSocket one to include ' /' because there is a 2nd line for
176 + # inet: which we want to leave
177 + ##dodoc "${FILESDIR}"/clamav-milter.README.gentoo
178 + sed -i -e "s:^\(Example\):\# \1:" \
179 + -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamav-milter.pid:" \
180 + -e "s+^\#\(ClamdSocket\) .*+\1 unix:${EPREFIX}/var/run/clamav/clamd.sock+" \
181 + -e "s:.*\(User\) .*:\1 clamav:" \
182 + -e "s+^\#\(MilterSocket\) /.*+\1 unix:${EPREFIX}/var/run/clamav/clamav-milter.sock+" \
183 + -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
184 + -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:" \
185 + "${ED}"/etc/clamav-milter.conf.sample || die
186 +
187 + cat >> "${ED}"/etc/conf.d/clamd <<-EOF
188 + MILTER_NICELEVEL=19
189 + START_MILTER=no
190 + EOF
191 +
192 + systemd_newunit "${FILESDIR}/clamav-milter.service-r1" clamav-milter.service
193 + fi
194 +
195 + local i
196 + for i in clamd freshclam clamav-milter
197 + do
198 + if [[ -f "${ED}"/etc/"${i}".conf.sample ]]; then
199 + mv "${ED}"/etc/"${i}".conf{.sample,} || die
200 + fi
201 + done
202 +
203 + # These both need to be writable by the clamav user.
204 + # TODO: use syslog by default; that's what it's for.
205 + diropts -o clamav -g clamav
206 + keepdir /var/lib/clamav
207 + keepdir /var/log/clamav
208 + fi
209 +
210 + if use doc ; then
211 + local HTML_DOCS=( docs/html/. )
212 + einstalldocs
213 +
214 + if ! use libclamav-only ; then
215 + doman docs/man/*.[1-8]
216 + fi
217 + fi
218 +
219 + find "${ED}" -name '*.la' -delete || die
220 +}
221 +
222 +src_test() {
223 + if use libclamav-only ; then
224 + ewarn "Test target not available when USE=libclamav-only is set, skipping tests ..."
225 + return 0
226 + fi
227 +
228 + emake quick-check
229 +}
230 +
231 +pkg_postinst() {
232 + if use milter ; then
233 + elog "For simple instructions how to setup the clamav-milter read the"
234 + elog "clamav-milter.README.gentoo in /usr/share/doc/${PF}"
235 + fi
236 +
237 + local databases=( "${EROOT}"/var/lib/clamav/main.c[lv]d )
238 + if [[ ! -f "${databases}" ]] ; then
239 + ewarn "You must run freshclam manually to populate the virus database"
240 + ewarn "before starting clamav for the first time."
241 + fi
242 +
243 + elog "For instructions on how to use clamonacc, see"
244 + elog
245 + elog " https://www.clamav.net/documents/on-access-scanning"
246 +}