Diff amavisd-new-2.12.2 with a amavisd-new-2.13.1

/usr/portage/mail-filter/amavisd-new/amavisd-new-2.13.1.ebuild 2025-11-10 18:18:05.237865465 +0300
1 1
# Copyright 1999-2025 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=7
4
EAPI=8
5 5

  
6
inherit systemd
6
inherit systemd perl-module
7 7

  
8 8
DESCRIPTION="High-performance interface between the MTA and content checkers"
9 9
HOMEPAGE="https://gitlab.com/amavis/amavis"
10 10
SRC_URI="https://gitlab.com/amavis/amavis/-/archive/v${PV}/amavis-v${PV}.tar.bz2"
11
S="${WORKDIR}/amavis-v${PV}"
11 12

  
12 13
LICENSE="GPL-2 BSD-2"
13 14
SLOT="0"
14
KEYWORDS="amd64 ~arm64 ppc ppc64 ~sparc x86"
15
IUSE="clamav courier dkim ldap mysql postgres qmail razor rspamd rspamd-https selinux snmp spamassassin"
15
KEYWORDS="amd64 ~arm64 ppc x86"
16

  
17
IUSE="clamav dkim ldap mysql postgres razor rspamd rspamd-https selinux snmp spamassassin test"
18
RESTRICT="!test? ( test )"
19
REQUIRED_USE="test? ( spamassassin )"
16 20

  
17
MY_RSPAMD_DEPEND="dev-perl/HTTP-Message
21
MY_RSPAMD_DEPEND="
22
	dev-perl/HTTP-Message
18 23
	dev-perl/JSON
19
	dev-perl/LWP-UserAgent-Determined"
24
	dev-perl/LWP-UserAgent-Determined
25
"
20 26
DEPEND="acct-user/amavis"
21
RDEPEND="${DEPEND}
27
RDEPEND="
28
	${DEPEND}
22 29
	app-arch/arc
23 30
	app-arch/bzip2
24 31
	app-arch/cabextract
......
43 50
	>=dev-perl/Mail-DKIM-0.31
44 51
	>=dev-perl/MailTools-1.58
45 52
	>=dev-perl/MIME-tools-5.415
46
	dev-perl/Net-LibIDN
53
	dev-perl/Net-LibIDN2
47 54
	>=dev-perl/Net-Server-0.91
48 55
	dev-perl/Net-SSLeay
49 56
	dev-perl/Unix-Syslog
......
52 59
	>=sys-apps/coreutils-5.0-r3
53 60
	>=sys-libs/db-4.4.20
54 61
	virtual/mta
55
	virtual/perl-Compress-Raw-Zlib
56
	virtual/perl-Digest-MD5
57
	virtual/perl-File-Temp
58
	virtual/perl-IO-Compress
59
	virtual/perl-IO-Socket-IP
60
	virtual/perl-MIME-Base64
61
	virtual/perl-Time-HiRes
62 62
	clamav? ( app-antivirus/clamav )
63 63
	ldap? ( >=dev-perl/perl-ldap-0.33 )
64 64
	mysql? ( dev-perl/DBD-mysql )
65 65
	postgres? ( dev-perl/DBD-Pg )
66 66
	razor? ( mail-filter/razor )
67 67
	rspamd? ( ${MY_RSPAMD_DEPEND} )
68
	rspamd-https? ( ${MY_RSPAMD_DEPEND}
68
	rspamd-https? (
69
		${MY_RSPAMD_DEPEND}
69 70
		dev-perl/LWP-Protocol-https
70
		dev-perl/Net-SSLeay )
71
		dev-perl/Net-SSLeay
72
	)
71 73
	selinux? ( sec-policy/selinux-amavis )
72 74
	snmp? ( net-analyzer/net-snmp[perl] )
73
	spamassassin? ( mail-filter/spamassassin dev-perl/Image-Info )"
75
	spamassassin? (
76
		mail-filter/spamassassin
77
		dev-perl/Image-Info
78
	)
79
"
80
BDEPEND="
81
	${RDEPEND}
82
	dev-perl/Dist-Zilla
83
	test? (
84
		dev-perl/File-Slurp
85
		dev-perl/Test-Class
86
		dev-perl/DBI
87
		dev-perl/perl-ldap
88
		dev-perl/NetAddr-IP
89
		dev-perl/Test-Most
90
	)
91
"
74 92

  
75 93
AMAVIS_ROOT="/var/lib/amavishome"
76
S="${WORKDIR}/amavis-v${PV}"
77 94

  
78
src_prepare() {
79
	if use courier ; then
80
		eapply -p0 amavisd-new-courier.patch
81
	fi
95
dzil_to_distdir() {
96
	local dzil_root dest has_missing modname dzil_version
97
	dzil_root="$1"
98
	dest="$2"
99

  
100
	cd "${dzil_root}" || die "Can't enter workdir '${dzil_root}'";
101

  
102
	dzil_version="$(dzil version)" || die "Error invoking 'dzil version'"
103
	einfo "Generating CPAN dist with ${dzil_version}"
104

  
105
	has_missing=""
106

  
107
	einfo "Checking dzil authordeps"
108
	while IFS= read -d $'\n' -r modname; do
109
		if [[ -z "${has_missing}" ]]; then
110
			has_missing=1
111
			eerror "'dzil authordeps' indicates missing build dependencies"
112
			eerror "These will prevent building, please report a bug"
113
			eerror "Missing:"
114
		fi
115
	S=	eerror "  ${modname}"
116
	done < <(dzil authordeps --missing --versions)
82 117

  
83
	if use qmail ; then
84
		eapply -p0 amavisd-new-qmqpqq.patch
85
	fi
118
	[[ -z "${has_missing}" ]] || die "Satisfy all missing authordeps first"
119

  
120
	einfo "Checking dzil build deps"
121
	while IFS= read -d $'\n' -r modname; do
122
		if [[ -z "${has_missing}" ]]; then
123
			has_missing=1
124
			ewarn "'dzil listdeps' indicates missing build dependencies"
125
			ewarn "These may prevent building, please report a bug if they do"
126
			ewarn "Missing:"
127
		fi
128
		ewarn "  ${modname}"
129
	done < <(dzil listdeps --missing --versions --author)
130

  
131
	einfo "Generating release"
132
	dzil build --notgz --in "${dest}" || die "Unable to build CPAN dist in '${dest}'"
133
}
134

  
135
src_prepare() {
136
	# perl-module doesn't account for this being a directory
137
	mv README_FILES READ_FILES || die
86 138

  
87 139
	# We need to fix the daemon_user and daemon_group in amavis-mc even
88 140
	# though we're going to run it in the foreground, because it calls
......
91 143
	sed -i	\
92 144
		-e '/daemon/s/vscan/amavis/' \
93 145
		-e "s:'/var/virusmails':\"\$MYHOME/quarantine\":" \
94
		"${S}/amavisd.conf" "${S}/amavis-mc" || die "missing conf file"
146
		"${S}/conf/amavisd.conf" "${S}/bin/amavis-mc" || die "missing conf file"
95 147

  
96 148
	if ! use dkim ; then
97
		sed -i -e '/enable_dkim/s/1/0/' "${S}/amavisd.conf" \
149
		sed -i -e '/enable_dkim/s/1/0/' "${S}/conf/amavisd.conf" \
98 150
			|| die "missing conf file - dkim"
99 151
	fi
100 152

  
101 153
	if ! use spamassassin ; then
102 154
		sed -i -e \
103 155
			"/^#[[:space:]]*@bypass_spam_checks_maps[[:space:]]*=[[:space:]]*(1)/s/^#//" \
104
			"${S}/amavisd.conf" || die "missing conf file - sa"
156
			"${S}/conf/amavisd.conf" || die "missing conf file - sa"
157
	fi
158

  
159
	# needs ZMQ::LibZMQ3 which only suports net-libs/zeromq-3*,
160
	# long since removed from tree
161
	perl_rm_files t/Amavis/ZMQTest.t
162
	sed -e '/^ZMQ::LibZMQ3 =/d' \
163
	-i dist.ini || die "Can't patch dist.ini"
164

  
165
	rm bin/{amavis-services,amavis-mc,amavisd-snmp-subagent-zmq}
166

  
167
	if ! use snmp ; then
168
		rm bin/amavisd-snmp-subagent
105 169
	fi
106 170

  
107 171
	eapply_user
172

  
173
	# prevent distdir-in-distdir
174
	mv "${S}" "${T}" || die
175
	dzil_to_distdir "${T}/amavis-v${PV}" "${S}"
176

  
177
	perl-module_src_prepare
178
}
179

  
180
src_test() {
181
	# TODO: xz test fails
182
	rm t/Amavis/UnpackersTest.t || die
183

  
184
	prove -lr t || die
108 185
}
109 186

  
110 187
src_install() {
111
	dosbin amavisd{,-agent,-nanny,-release,-signer,-status}
112
	dobin p0f-analyzer.pl amavisd-submit
188
	perl-module_src_install
189
	mkdir "${ED}"/usr/sbin
190
	mv "${ED}"/usr/bin/amavisd "${ED}"/usr/sbin/amavisd || die
191
	mv "${ED}"/usr/bin/amavisd-agent "${ED}"/usr/sbin/amavisd-agent || die
192
	mv "${ED}"/usr/bin/amavisd-nanny "${ED}"/usr/sbin/amavisd-nanny || die
193
	mv "${ED}"/usr/bin/amavisd-release "${ED}"/usr/sbin/amavisd-release || die
194
	mv "${ED}"/usr/bin/amavisd-signer "${ED}"/usr/sbin/amavisd-signer || die
195
	mv "${ED}"/usr/bin/amavisd-status "${ED}"/usr/sbin/amavisd-status || die
196
	dobin contrib/p0f-analyzer.pl
113 197

  
114 198
	if use snmp ; then
115
		dosbin amavisd-snmp-subagent
199
		mv "${ED}"/usr/bin/amavisd-snmp-subagent "${ED}"/usr/sbin/amavisd-snmp-subagent || die
116 200
		newinitd "${FILESDIR}/amavisd-snmp-subagent.initd" \
117 201
				 amavisd-snmp-subagent
118 202
		dodoc AMAVIS-MIB.txt
119 203
	fi
120 204

  
205
	perl_fix_packlist
206

  
121 207
	if use ldap ; then
122 208
		insinto /etc/openldap/schema
123
		newins LDAP.schema "${PN}.schema"
209
		newins contrib/LDAP.schema "${PN}.schema"
124 210
	fi
125 211

  
126 212
	# The config file should be root:amavis so that the amavis user can
......
128 214
	# own everything in his home directory.
129 215
	insinto /etc
130 216
	insopts -m0640 -g amavis
131
	doins amavisd.conf
217
	doins conf/amavisd.conf
132 218

  
133 219
	# Implementation detail? Keepdir calls dodir under the hood.
134 220
	diropts -o amavis -g amavis
......
144 230

  
145 231
	systemd_newunit "${FILESDIR}/amavisd.service-r1" amavisd.service
146 232

  
147
	dodoc AAAREADME.first INSTALL MANIFEST RELEASE_NOTES TODO \
148
		amavisd.conf-default amavisd-custom.conf
233
	dodoc AAAREADME.first RELEASE_NOTES TODO \
234
		conf/amavisd.conf-default conf/amavisd-custom.conf \
235
		conf/amavisd-docker.conf
149 236

  
150 237
	docinto README_FILES
151
	dodoc README_FILES/README*
152
	dodoc -r README_FILES/*.{html,css}
238
	dodoc READ_FILES/README*
239
	dodoc -r READ_FILES/*.{html,css}
153 240
	docinto README_FILES/images
154
	dodoc README_FILES/images/*.png
241
	dodoc READ_FILES/images/*.png
155 242
	docinto README_FILES/images/callouts
156
	dodoc README_FILES/images/callouts/*.png
243
	dodoc READ_FILES/images/callouts/*.png
157 244

  
158 245
	docinto test-messages
159
	dodoc test-messages/README
160
	dodoc test-messages/sample.tar.gz.compl
246
	dodoc t/messages/README
247
	dodoc t/messages/sample.tar.gz.compl
161 248
}
162 249

  
163 250
pkg_preinst() {
164 251
	# TODO: the following is done as root, but should probably be done
165 252
	# as the amavis user.
166 253
	if use razor ; then
167
		if [ ! -d "${ROOT}${AMAVIS_ROOT}/.razor" ] ; then
254
		if [[ ! -d "${ROOT}${AMAVIS_ROOT}/.razor" ]] ; then
168 255
			elog "Setting up initial razor config files..."
169 256

  
170 257
			razor-admin -create -home="${D}/${AMAVIS_ROOT}/.razor"
......
176 263

  
177 264
pkg_postinst() {
178 265
	local d="/var/amavis"
179
	if [ -d ${d} ]; then
266
	if [[ -d ${d} ]]; then
180 267
		elog "Existing data found. Please make sure to manually copy it to amavis' new"
181 268
		elog "home directory by executing the following command as root from a shell:"
182 269
		elog
Thank you!