Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-antivirus/clamav/
Date: Thu, 02 Jun 2022 03:46:31
Message-Id: 1654141580.eebb889a2e861c1cae85e57c0ded55d999f0c407.sam@gentoo
1 commit: eebb889a2e861c1cae85e57c0ded55d999f0c407
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 2 03:46:00 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 2 03:46:20 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eebb889a
7
8 app-antivirus/clamav: add 0.104.3
9
10 Bug: https://bugs.gentoo.org/842813
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 app-antivirus/clamav/Manifest | 1 +
14 app-antivirus/clamav/clamav-0.104.3.ebuild | 215 +++++++++++++++++++++++++++++
15 2 files changed, 216 insertions(+)
16
17 diff --git a/app-antivirus/clamav/Manifest b/app-antivirus/clamav/Manifest
18 index 085efa58f7ef..c910a4622887 100644
19 --- a/app-antivirus/clamav/Manifest
20 +++ b/app-antivirus/clamav/Manifest
21 @@ -1,2 +1,3 @@
22 DIST clamav-0.103.6.tar.gz 16491761 BLAKE2B 3c43bcda4a613f81d1b31036e7323a7af7708e54af94ad30a659a8fb318d8f79f357086ce70703659298524d778374df886495cd8c75280bbbe4bae30795a85a SHA512 d39e1964678b8251bde3a9f3db30fe3d3d76cc566a86834297f4dd8489086dc9cc4c6541ca128089159f4c071d2d85b530455bd942987d3929ea0082b8ab272b
23 DIST clamav-0.104.2.tar.gz 11950409 BLAKE2B 7d7eb9d22ca519f7ad0c171b6cab4b59cb52787a897ab31b9567166be2223f9ea89e79f42f1e4e0caf32fcb4b008f5ce755fa136566f85fe1de7808b436f80fa SHA512 8c89a05dec6650677125177434cc49ec2298701525508cdda52358e8f98086d80892287f6267f8b7fda0aef2ca361616cb584c3059f3b066bfde65f7f1ba2df5
24 +DIST clamav-0.104.3.tar.gz 12017176 BLAKE2B db97a3d3ca0a2c5273a175ee3a30fdd07eecd13588a39d39e4d07f91034016ee6eca626b0ab7bf548121e4093ea612f9932512bc021326e4bba8b0844af73664 SHA512 d38a2427df29813e4d0f41d480cda85f6175e617c397ab39d913000fa43fcb44f1e0b97d7bd558bc62369e8caeeb2b3aeb4b3dd575b9da4abb91f8b67a6b8431
25
26 diff --git a/app-antivirus/clamav/clamav-0.104.3.ebuild b/app-antivirus/clamav/clamav-0.104.3.ebuild
27 new file mode 100644
28 index 000000000000..d9ec6a29c4a3
29 --- /dev/null
30 +++ b/app-antivirus/clamav/clamav-0.104.3.ebuild
31 @@ -0,0 +1,215 @@
32 +# Copyright 1999-2022 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=8
36 +
37 +PYTHON_COMPAT=( python3_{8..10} )
38 +inherit cmake flag-o-matic python-any-r1 systemd tmpfiles
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 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
47 +IUSE="doc clamonacc +clamapp libclamav-only milter rar selinux systemd test"
48 +
49 +REQUIRED_USE="libclamav-only? ( !clamonacc !clamapp !milter )
50 + clamonacc? ( clamapp )
51 + milter? ( clamapp )
52 + test? ( !libclamav-only )"
53 +
54 +RESTRICT="!test? ( test )"
55 +
56 +# Require acct-{user,group}/clamav at build time so that we can set
57 +# the permissions on /var/lib/clamav in src_install rather than in
58 +# pkg_postinst; calling "chown" on the live filesystem scares me.
59 +CDEPEND="acct-group/clamav
60 + acct-user/clamav
61 + dev-libs/libltdl
62 + dev-libs/libmspack
63 + dev-libs/json-c:=
64 + dev-libs/libpcre2
65 + >=sys-libs/zlib-1.2.2:=
66 + app-arch/bzip2
67 + clamapp? ( sys-libs/ncurses:= net-misc/curl )
68 + elibc_musl? ( sys-libs/fts-standalone )
69 + virtual/libiconv
70 + !libclamav-only? ( net-misc/curl )
71 + dev-libs/openssl:=
72 + milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )
73 + dev-libs/libxml2
74 + rar? ( app-arch/unrar )
75 + test? ( dev-python/pytest )"
76 +# TODO: there is no way to use this with the new build system instead of the bundled one
77 +# dev-libs/tomsfastmath
78 +BDEPEND="virtual/pkgconfig
79 + doc? ( app-doc/doxygen )
80 + test? (
81 + ${PYTHON_DEPS}
82 + $(python_gen_any_dep 'dev-python/pytest[${PYTHON_USEDEP}]')
83 + )"
84 +DEPEND="${CDEPEND}
85 + test? ( dev-libs/check )"
86 +RDEPEND="${CDEPEND}
87 + selinux? ( sec-policy/selinux-clamav )"
88 +
89 +python_check_deps() {
90 + has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
91 +}
92 +
93 +pkg_setup() {
94 + use test && python-any-r1_pkg_setup
95 +}
96 +
97 +src_configure() {
98 + use elibc_musl && append-ldflags -lfts
99 + use ppc64 && append-flags -mminimal-toc
100 +
101 + local mycmakeargs=(
102 + -DDATABASE_DIRECTORY="${EPREFIX}"/var/lib/clamav
103 + -DAPP_CONFIG_DIRECTORY="${EPREFIX}"/etc/clamav
104 + -DENABLE_EXPERIMENTAL=OFF
105 + -DENABLE_JSON_SHARED=ON
106 + -DENABLE_APP=$(usex clamapp ON OFF)
107 + -DENABLE_MILTER=$(usex milter ON OFF)
108 + -DENABLE_CLAMONACC=$(usex clamonacc ON OFF)
109 + -DCLAMAV_USER="clamav"
110 + -DCLAMAV_GROUP="clamav"
111 + -DBYTECODE_RUNTIME=interpreter
112 + -DOPTIMIZE=ON
113 + -DENABLE_EXTERNAL_MSPACK=ON
114 + -DENABLE_MAN_PAGES=ON
115 + -DENABLE_DOXYGEN=$(usex doc)
116 + -DENABLE_UNRAR=$(usex rar ON OFF)
117 + -DENABLE_TESTS=$(usex test ON OFF)
118 + # Used to enable some more tests but doesn't behave well in
119 + # sandbox necessarily(?) + needs certain debug symbols present
120 + # in e.g. glibc.
121 + -DCMAKE_DISABLE_FIND_PACKAGE_Valgrind=ON
122 + -DENABLE_STATIC_LIB=OFF
123 + -DENABLE_SHARED_LIB=ON
124 + -DENABLE_SYSTEMD=$(usex systemd ON OFF)
125 + )
126 + cmake_src_configure
127 +}
128 +
129 +src_install() {
130 + cmake_src_install
131 +
132 + # init scripts
133 + newinitd "${FILESDIR}/clamd.initd" clamd
134 + newinitd "${FILESDIR}/freshclam.initd" freshclam
135 + use clamonacc && \
136 + newinitd "${FILESDIR}/clamonacc.initd" clamonacc
137 + use milter && \
138 + newinitd "${FILESDIR}/clamav-milter.initd" clamav-milter
139 +
140 + rm -rf "${ED}"/var/lib/clamav || die
141 +
142 + if ! use libclamav-only ; then
143 + if use systemd ; then
144 + # The tmpfiles entry is behind USE=systemd because the
145 + # upstream OpenRC service files should (and do) ensure that
146 + # the directories they need exist and have the correct
147 + # permissions without the help of opentmpfiles. There are
148 + # years-old root exploits in opentmpfiles, the design is
149 + # fundamentally flawed, and the maintainer is not up to
150 + # the task of fixing it.
151 + dotmpfiles "${FILESDIR}/tmpfiles.d/clamav.conf"
152 + systemd_newunit "${FILESDIR}/clamd_at.service-0.104.0" "clamd@.service"
153 + systemd_dounit "${FILESDIR}/clamd.service"
154 + systemd_newunit "${FILESDIR}/freshclamd.service-r1" \
155 + "freshclamd.service"
156 + fi
157 +
158 + if use clamapp ; then
159 + # Modify /etc/{clamd,freshclam}.conf to be usable out of the box
160 + sed -e "s:^\(Example\):\# \1:" \
161 + -e "s/^#\(PidFile .*\)/\1/" \
162 + -e "s/^#\(LocalSocket .*\)/\1/" \
163 + -e "s/^#\(User .*\)/\1/" \
164 + -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \
165 + -e "s:^\#\(LogTime\).*:\1 yes:" \
166 + -e "s/^#\(DatabaseDirectory .*\)/\1/" \
167 + "${ED}"/etc/clamav/clamd.conf.sample > \
168 + "${ED}"/etc/clamav/clamd.conf || die
169 +
170 + sed -e "s:^\(Example\):\# \1:" \
171 + -e "s/^#\(PidFile .*\)/\1/" \
172 + -e "s/^#\(DatabaseOwner .*\)/\1/" \
173 + -e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \
174 + -e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamav/clamd.conf:" \
175 + -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
176 + -e "s/^#\(DatabaseDirectory .*\)/\1/" \
177 + "${ED}"/etc/clamav/freshclam.conf.sample > \
178 + "${ED}"/etc/clamav/freshclam.conf || die
179 +
180 + if use milter ; then
181 + # Note: only keep the "unix" ClamdSocket and MilterSocket!
182 + sed -e "s:^\(Example\):\# \1:" \
183 + -e "s/^#\(PidFile .*\)/\1/" \
184 + -e "s/^#\(ClamdSocket unix:.*\)/\1/" \
185 + -e "s/^#\(User .*\)/\1/" \
186 + -e "s/^#\(MilterSocket unix:.*\)/\1/" \
187 + -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:" \
188 + "${ED}"/etc/clamav/clamav-milter.conf.sample > \
189 + "${ED}"/etc/clamav/clamav-milter.conf || die
190 +
191 + systemd_newunit "${FILESDIR}/clamav-milter.service-0.104.0" clamav-milter.service
192 + fi
193 +
194 + local i
195 + for i in clamd freshclam clamav-milter
196 + do
197 + if [[ -f "${ED}"/etc/"${i}".conf.sample ]] ; then
198 + mv "${ED}"/etc/"${i}".conf{.sample,} || die
199 + fi
200 + done
201 +
202 + # These both need to be writable by the clamav user.
203 + # TODO: use syslog by default; that's what it's for.
204 + diropts -o clamav -g clamav
205 + keepdir /var/lib/clamav
206 + keepdir /var/log/clamav
207 + fi
208 + fi
209 +
210 + if use doc ; then
211 + local HTML_DOCS=( docs/html/. )
212 + einstalldocs
213 + fi
214 +
215 + # Don't install man pages for utilities we didn't install
216 + if use libclamav-only ; then
217 + rm -r "${ED}"/usr/share/man || die
218 + fi
219 +
220 + find "${ED}" -name '*.la' -delete || die
221 +}
222 +
223 +pkg_postinst() {
224 + if ! use libclamav-only ; then
225 + if use systemd ; then
226 + tmpfiles_process clamav.conf
227 + fi
228 + fi
229 +
230 + if use milter ; then
231 + elog "For simple instructions how to setup the clamav-milter read the"
232 + elog "clamav-milter.README.gentoo in /usr/share/doc/${PF}"
233 + fi
234 +
235 + local databases=( "${EROOT}"/var/lib/clamav/main.c[lv]d )
236 + if [[ ! -f "${databases}" ]] ; then
237 + ewarn "You must run freshclam manually to populate the virus database"
238 + ewarn "before starting clamav for the first time."
239 + fi
240 +
241 + ewarn "This version of ClamAV provides separate OpenRC services"
242 + ewarn "for clamd, freshclam, clamav-milter, and clamonacc. The"
243 + ewarn "clamd service now starts only the clamd daemon itself. You"
244 + ewarn "should add freshclam (and perhaps clamav-milter) to any"
245 + ewarn "runlevels that previously contained clamd."
246 +}