Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-antivirus/clamav/, app-antivirus/clamav/files/
Date: Thu, 29 Mar 2018 22:42:33
Message-Id: 1522363338.6c8c54a1663246d42c8fda0de366a3078a02be13.whissi@gentoo
1 commit: 6c8c54a1663246d42c8fda0de366a3078a02be13
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Mar 29 22:41:57 2018 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu Mar 29 22:42:18 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c8c54a1
7
8 app-antivirus/clamav: Make clamav work with >=zlib-1.2.9
9
10 ..in addition, an automagic on dev-libs/check was fixed.
11
12 Closes: https://bugs.gentoo.org/649516
13 Package-Manager: Portage-2.3.26, Repoman-2.3.7
14
15 app-antivirus/clamav/clamav-0.99.4-r1.ebuild | 159 +++++++++++++++++++++
16 .../files/clamav-0.99.4-fix-newer-zlib.patch | 54 +++++++
17 2 files changed, 213 insertions(+)
18
19 diff --git a/app-antivirus/clamav/clamav-0.99.4-r1.ebuild b/app-antivirus/clamav/clamav-0.99.4-r1.ebuild
20 new file mode 100644
21 index 00000000000..cee37d96b48
22 --- /dev/null
23 +++ b/app-antivirus/clamav/clamav-0.99.4-r1.ebuild
24 @@ -0,0 +1,159 @@
25 +# Copyright 1999-2018 Gentoo Foundation
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=6
29 +
30 +inherit autotools eutils flag-o-matic user systemd
31 +
32 +DESCRIPTION="Clam Anti-Virus Scanner"
33 +HOMEPAGE="http://www.clamav.net/"
34 +SRC_URI="https://www.clamav.net/downloads/production/${P}.tar.gz"
35 +
36 +LICENSE="GPL-2"
37 +SLOT="0"
38 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
39 +IUSE="bzip2 clamdtop iconv ipv6 libressl milter metadata-analysis-api selinux static-libs test uclibc"
40 +
41 +CDEPEND="bzip2? ( app-arch/bzip2 )
42 + clamdtop? ( sys-libs/ncurses:0 )
43 + iconv? ( virtual/libiconv )
44 + metadata-analysis-api? ( dev-libs/json-c:= )
45 + milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )
46 + dev-libs/libtommath
47 + >=sys-libs/zlib-1.2.2:=
48 + !libressl? ( dev-libs/openssl:0= )
49 + libressl? ( dev-libs/libressl:0= )
50 + sys-devel/libtool
51 + || ( dev-libs/libpcre2 >dev-libs/libpcre-6 )
52 + !!<app-antivirus/clamav-0.99"
53 +# hard block clamav < 0.99 due to linking problems Bug #567680
54 +# openssl is now *required* see this link as to why
55 +# http://blog.clamav.net/2014/02/introducing-openssl-as-dependency-to.html
56 +DEPEND="${CDEPEND}
57 + virtual/pkgconfig
58 + test? ( dev-libs/check )"
59 +RDEPEND="${CDEPEND}
60 + selinux? ( sec-policy/selinux-clamav )"
61 +
62 +DOCS=( AUTHORS BUGS ChangeLog FAQ INSTALL NEWS README UPGRADE )
63 +PATCHES=(
64 + "${FILESDIR}"/${PN}-0.99.4-fix-newer-zlib.patch
65 + "${FILESDIR}/${P}-pcre2-compile-erroffset.patch"
66 +)
67 +
68 +pkg_setup() {
69 + enewgroup clamav
70 + enewuser clamav -1 -1 /dev/null clamav
71 +}
72 +
73 +src_prepare() {
74 + default
75 +
76 + eautoconf
77 +}
78 +
79 +src_configure() {
80 + use ppc64 && append-flags -mminimal-toc
81 + use uclibc && export ac_cv_type_error_t=yes
82 +
83 + econf \
84 + $(use_enable bzip2) \
85 + $(use_enable clamdtop) \
86 + $(use_enable ipv6) \
87 + $(use_enable milter) \
88 + $(use_enable static-libs static) \
89 + $(use_enable test check) \
90 + $(use_with iconv) \
91 + $(use_with metadata-analysis-api libjson /usr) \
92 + --cache-file="${S}"/config.cache \
93 + --disable-experimental \
94 + --disable-gcc-vcheck \
95 + --disable-zlib-vcheck \
96 + --enable-id-check \
97 + --with-dbdir="${EPREFIX}"/var/lib/clamav \
98 + --with-system-tommath \
99 + --with-zlib="${EPREFIX}"/usr \
100 + --disable-llvm
101 +}
102 +
103 +src_install() {
104 + default
105 +
106 + rm -rf "${ED}"/var/lib/clamav
107 + newinitd "${FILESDIR}"/clamd.initd-r6 clamd
108 + newconfd "${FILESDIR}"/clamd.conf-r1 clamd
109 +
110 + systemd_dotmpfilesd "${FILESDIR}/tmpfiles.d/clamav.conf"
111 + systemd_newunit "${FILESDIR}/clamd_at.service" "clamd@.service"
112 + systemd_dounit "${FILESDIR}/clamd.service"
113 + systemd_dounit "${FILESDIR}/freshclamd.service"
114 +
115 + keepdir /var/lib/clamav
116 + fowners clamav:clamav /var/lib/clamav
117 + keepdir /var/log/clamav
118 + fowners clamav:clamav /var/log/clamav
119 +
120 + dodir /etc/logrotate.d
121 + insinto /etc/logrotate.d
122 + newins "${FILESDIR}"/clamav.logrotate clamav
123 +
124 + # Modify /etc/{clamd,freshclam}.conf to be usable out of the box
125 + sed -i -e "s:^\(Example\):\# \1:" \
126 + -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.pid:" \
127 + -e "s:.*\(LocalSocket\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.sock:" \
128 + -e "s:.*\(User\) .*:\1 clamav:" \
129 + -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \
130 + -e "s:^\#\(LogTime\).*:\1 yes:" \
131 + -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
132 + "${ED}"/etc/clamd.conf.sample || die
133 + sed -i -e "s:^\(Example\):\# \1:" \
134 + -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/freshclam.pid:" \
135 + -e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \
136 + -e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \
137 + -e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamd.conf:" \
138 + -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
139 + -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
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 + cat >> "${ED}"/etc/conf.d/clamd <<-EOF
155 + MILTER_NICELEVEL=19
156 + START_MILTER=no
157 + EOF
158 +
159 + systemd_newunit "${FILESDIR}/clamav-milter.service-r1" clamav-milter.service
160 + fi
161 +
162 + for i in clamd freshclam clamav-milter
163 + do
164 + [[ -f "${D}"/etc/"${i}".conf.sample ]] && mv "${D}"/etc/"${i}".conf{.sample,}
165 + done
166 +
167 + prune_libtool_files --all
168 +}
169 +
170 +src_test() {
171 + emake quick-check
172 +}
173 +
174 +pkg_postinst() {
175 + if use milter ; then
176 + elog "For simple instructions how to setup the clamav-milter read the"
177 + elog "clamav-milter.README.gentoo in /usr/share/doc/${PF}"
178 + fi
179 + if test -z $(find "${ROOT}"var/lib/clamav -maxdepth 1 -name 'main.c*' -print -quit) ; then
180 + ewarn "You must run freshclam manually to populate the virus database files"
181 + ewarn "before starting clamav for the first time.\n"
182 + fi
183 +}
184
185 diff --git a/app-antivirus/clamav/files/clamav-0.99.4-fix-newer-zlib.patch b/app-antivirus/clamav/files/clamav-0.99.4-fix-newer-zlib.patch
186 new file mode 100644
187 index 00000000000..18673419a58
188 --- /dev/null
189 +++ b/app-antivirus/clamav/files/clamav-0.99.4-fix-newer-zlib.patch
190 @@ -0,0 +1,54 @@
191 +https://bugs.gentoo.org/649516
192 +
193 +Description: fix compatibility with zlib 1.2.9 and newer
194 +Author: Marc Deslauriers <marc.deslauriers@×××××××××.com>
195 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/clamav/+bug/1692073
196 +
197 +Index: clamav-0.99.2+dfsg/libclamav/bytecode_api.c
198 +===================================================================
199 +--- clamav-0.99.2+dfsg.orig/libclamav/bytecode_api.c 2017-08-08 15:20:06.651685637 -0400
200 ++++ clamav-0.99.2+dfsg/libclamav/bytecode_api.c 2017-08-15 15:45:14.645714766 -0400
201 +@@ -811,8 +811,20 @@ int32_t cli_bcapi_inflate_init(struct cl
202 + cli_dbgmsg("bytecode api: inflate_init: invalid buffers!\n");
203 + return -1;
204 + }
205 +- memset(&stream, 0, sizeof(stream));
206 +- ret = inflateInit2(&stream, windowBits);
207 ++
208 ++ b = cli_realloc(ctx->inflates, sizeof(*ctx->inflates)*n);
209 ++ if (!b) {
210 ++ return -1;
211 ++ }
212 ++ ctx->inflates = b;
213 ++ ctx->ninflates = n;
214 ++ b = &b[n-1];
215 ++
216 ++ b->from = from;
217 ++ b->to = to;
218 ++ b->needSync = 0;
219 ++ memset(&b->stream, 0, sizeof(stream));
220 ++ ret = inflateInit2(&b->stream, windowBits);
221 + switch (ret) {
222 + case Z_MEM_ERROR:
223 + cli_dbgmsg("bytecode api: inflateInit2: out of memory!\n");
224 +@@ -829,20 +841,6 @@ int32_t cli_bcapi_inflate_init(struct cl
225 + cli_dbgmsg("bytecode api: inflateInit2: unknown error %d\n", ret);
226 + return -1;
227 + }
228 +-
229 +- b = cli_realloc(ctx->inflates, sizeof(*ctx->inflates)*n);
230 +- if (!b) {
231 +- inflateEnd(&stream);
232 +- return -1;
233 +- }
234 +- ctx->inflates = b;
235 +- ctx->ninflates = n;
236 +- b = &b[n-1];
237 +-
238 +- b->from = from;
239 +- b->to = to;
240 +- b->needSync = 0;
241 +- memcpy(&b->stream, &stream, sizeof(stream));
242 + return n-1;
243 + }
244 +