Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: mail-filter/amavisd-new/
Date: Fri, 21 Feb 2020 06:08:57
Message-Id: 1582263720.a30c37ecf9d93913f9d79aacefe2ca8e0c655c99.juippis@gentoo
1 commit: a30c37ecf9d93913f9d79aacefe2ca8e0c655c99
2 Author: Ralph Seichter <github <AT> seichter <DOT> de>
3 AuthorDate: Fri Feb 14 10:31:00 2020 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 21 05:42:00 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a30c37ec
7
8 mail-filter/amavisd-new: Migrate to GLEP 81
9
10 Updated ebuild uses acct-user/amavis.
11
12 Package-Manager: Portage-2.3.84, Repoman-2.3.20
13 Signed-off-by: Ralph Seichter <gentoo <AT> seichter.de>
14 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
15
16 .../amavisd-new/amavisd-new-2.12.0-r1.ebuild | 198 +++++++++++++++++++++
17 1 file changed, 198 insertions(+)
18
19 diff --git a/mail-filter/amavisd-new/amavisd-new-2.12.0-r1.ebuild b/mail-filter/amavisd-new/amavisd-new-2.12.0-r1.ebuild
20 new file mode 100644
21 index 00000000000..f68990e14fa
22 --- /dev/null
23 +++ b/mail-filter/amavisd-new/amavisd-new-2.12.0-r1.ebuild
24 @@ -0,0 +1,198 @@
25 +# Copyright 1999-2020 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=7
29 +inherit systemd
30 +
31 +DESCRIPTION="High-performance interface between the MTA and content checkers"
32 +HOMEPAGE="https://gitlab.com/amavis/amavis"
33 +SRC_URI="https://gitlab.com/amavis/amavis/-/archive/v${PV}/amavis-v${PV}.tar.bz2"
34 +
35 +LICENSE="GPL-2 BSD-2"
36 +SLOT="0"
37 +KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
38 +IUSE="clamav courier dkim ldap mysql postgres qmail razor rspamd rspamd-https snmp spamassassin zmq"
39 +
40 +MY_RSPAMD_DEPEND="( dev-perl/JSON dev-perl/HTTP-Message dev-perl/LWP-UserAgent-Determined )"
41 +BDEPEND="acct-user/amavis"
42 +RDEPEND="${BDEPEND}
43 + >=dev-lang/perl-5.10.0
44 + app-arch/arc
45 + app-arch/bzip2
46 + app-arch/cabextract
47 + app-arch/cpio
48 + app-arch/gzip
49 + app-arch/lha
50 + app-arch/lrzip
51 + app-arch/lzop
52 + app-arch/ncompress
53 + app-arch/p7zip
54 + app-arch/pax
55 + app-arch/unarj
56 + app-arch/unrar
57 + app-arch/xz-utils
58 + app-arch/zoo
59 + clamav? ( app-antivirus/clamav )
60 + >=dev-perl/Archive-Zip-1.14
61 + dev-perl/BerkeleyDB
62 + dev-perl/Convert-BinHex
63 + dev-perl/File-LibMagic
64 + dev-perl/IO-Socket-SSL
65 + dev-perl/IO-stringy
66 + >=dev-perl/Mail-DKIM-0.31
67 + >=dev-perl/MailTools-1.58
68 + >=dev-perl/MIME-tools-5.415
69 + dev-perl/Net-LibIDN
70 + >=dev-perl/Net-Server-0.91
71 + dev-perl/Net-SSLeay
72 + dev-perl/Unix-Syslog
73 + ldap? ( >=dev-perl/perl-ldap-0.33 )
74 + mysql? ( dev-perl/DBD-mysql )
75 + net-mail/ripole
76 + net-mail/tnef
77 + postgres? ( dev-perl/DBD-Pg )
78 + razor? ( mail-filter/razor )
79 + rspamd? ( ${MY_RSPAMD_DEPEND} )
80 + rspamd-https? ( ${MY_RSPAMD_DEPEND} dev-perl/LWP-Protocol-https dev-perl/Net-SSLeay )
81 + snmp? ( net-analyzer/net-snmp[perl] )
82 + spamassassin? ( mail-filter/spamassassin dev-perl/Image-Info )
83 + >=sys-apps/coreutils-5.0-r3
84 + >=sys-libs/db-4.4.20
85 + virtual/mta
86 + >=virtual/perl-Compress-Raw-Zlib-2.017
87 + virtual/perl-Digest-MD5
88 + virtual/perl-File-Temp
89 + >=virtual/perl-IO-Compress-1.35
90 + virtual/perl-IO-Socket-IP
91 + virtual/perl-MIME-Base64
92 + >=virtual/perl-Time-HiRes-1.49
93 + zmq? ( dev-perl/ZMQ-LibZMQ3 )"
94 +
95 +AMAVIS_ROOT="/var/lib/amavishome"
96 +S="${WORKDIR}/amavis-v${PV}"
97 +
98 +src_prepare() {
99 + if use courier ; then
100 + eapply -p0 amavisd-new-courier.patch
101 + fi
102 +
103 + if use qmail ; then
104 + eapply -p0 amavisd-new-qmqpqq.patch
105 + fi
106 +
107 + # We need to fix the daemon_user and daemon_group in amavis-mc even
108 + # though we're going to run it in the foreground, because it calls
109 + # "drop_priv" unconditionally and will crash if its user/group
110 + # doesn't exist.
111 + sed -i \
112 + -e '/daemon/s/vscan/amavis/' \
113 + -e "s:'/var/virusmails':\"\$MYHOME/quarantine\":" \
114 + "${S}/amavisd.conf" "${S}/amavis-mc" || die "missing conf file"
115 +
116 + if ! use dkim ; then
117 + sed -i -e '/enable_dkim/s/1/0/' "${S}/amavisd.conf" \
118 + || die "missing conf file - dkim"
119 + fi
120 +
121 + if use zmq ; then
122 + sed -i -e '/enable_zmq/s/# //' "${S}/amavisd.conf" \
123 + || die "missing conf file - zmq"
124 + fi
125 +
126 + if ! use spamassassin ; then
127 + sed -i -e \
128 + "/^#[[:space:]]*@bypass_spam_checks_maps[[:space:]]*=[[:space:]]*(1)/s/^#//" \
129 + "${S}/amavisd.conf" || die "missing conf file - sa"
130 + fi
131 +
132 + eapply_user
133 +}
134 +
135 +src_install() {
136 + dosbin amavisd{,-agent,-nanny,-release,-signer,-status}
137 + dobin p0f-analyzer.pl amavisd-submit
138 +
139 + if use snmp ; then
140 + dosbin amavisd-snmp-subagent
141 + newinitd "${FILESDIR}/amavisd-snmp-subagent.initd" \
142 + amavisd-snmp-subagent
143 + dodoc AMAVIS-MIB.txt
144 +
145 + if use zmq ; then
146 + dosbin amavisd-snmp-subagent-zmq
147 + newinitd "${FILESDIR}/amavisd-snmp-subagent-zmq.initd" \
148 + amavisd-snmp-subagent-zmq
149 + fi
150 + fi
151 +
152 + if use zmq ; then
153 + dosbin amavis-services amavis-mc
154 + newinitd "${FILESDIR}/amavis-mc.initd-r1" amavis-mc
155 + fi
156 +
157 + if use ldap ; then
158 + insinto /etc/openldap/schema
159 + newins LDAP.schema "${PN}.schema"
160 + fi
161 +
162 + # The config file should be root:amavis so that the amavis user can
163 + # read (only) it after dropping privileges. And of course he should
164 + # own everything in his home directory.
165 + insinto /etc
166 + insopts -m0640 -g amavis
167 + doins amavisd.conf
168 +
169 + # Implementation detail? Keepdir calls dodir under the hood.
170 + diropts -o amavis -g amavis
171 + keepdir "${AMAVIS_ROOT}"/{,db,quarantine,tmp,var}
172 +
173 + # BEWARE:
174 + #
175 + # Anything below this line is using the mangled insopts/diropts from
176 + # above!
177 + #
178 +
179 + newinitd "${FILESDIR}/amavisd.initd-r2" amavisd
180 +
181 + systemd_newunit "${FILESDIR}/amavisd.service-r1" amavisd.service
182 +
183 + dodoc AAAREADME.first INSTALL MANIFEST RELEASE_NOTES TODO \
184 + amavisd.conf-default amavisd-custom.conf
185 +
186 + docinto README_FILES
187 + dodoc README_FILES/README*
188 + dodoc -r README_FILES/*.{html,css}
189 + docinto README_FILES/images
190 + dodoc README_FILES/images/*.png
191 + docinto README_FILES/images/callouts
192 + dodoc README_FILES/images/callouts/*.png
193 +
194 + docinto test-messages
195 + dodoc test-messages/README
196 + dodoc test-messages/sample.tar.gz.compl
197 +}
198 +
199 +pkg_preinst() {
200 + # TODO: the following is done as root, but should probably be done
201 + # as the amavis user.
202 + if use razor ; then
203 + if [ ! -d "${ROOT}${AMAVIS_ROOT}/.razor" ] ; then
204 + elog "Setting up initial razor config files..."
205 +
206 + razor-admin -create -home="${D}/${AMAVIS_ROOT}/.razor"
207 + sed -i -e "s:debuglevel\([ ]*\)= .:debuglevel\1= 0:g" \
208 + "${D}/${AMAVIS_ROOT}/.razor/razor-agent.conf" || die
209 + fi
210 + fi
211 +}
212 +
213 +pkg_postinst() {
214 + local d="/var/amavis"
215 + if [ -d ${d} ]; then
216 + elog "Existing data found. Please make sure to manually copy it to amavis' new"
217 + elog "home directory by executing the following command as root from a shell:"
218 + elog
219 + elog " cp -a ${d}/* ${d}/.??* ${AMAVIS_ROOT}/ && rm -r ${d}"
220 + elog
221 + fi
222 +}