Gentoo Archives: gentoo-commits

From: Hanno Boeck <hanno@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-mail/mailman/, net-mail/mailman/files/
Date: Sat, 17 Aug 2019 07:43:51
Message-Id: 1566027819.b15be589df04e040e94367cb6723008b0929aab4.hanno@gentoo
1 commit: b15be589df04e040e94367cb6723008b0929aab4
2 Author: Hanno <hanno <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 17 07:43:39 2019 +0000
4 Commit: Hanno Boeck <hanno <AT> gentoo <DOT> org>
5 CommitDate: Sat Aug 17 07:43:39 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b15be589
7
8 net-mail/mailman: Fix python sitedir location.
9
10 Without this there will be errors with the no-symlink profiles.
11 Patch also reported and applied upstream.
12
13 Signed-off-by: Hanno Boeck <hanno <AT> gentoo.org>
14 Package-Manager: Portage-2.3.71, Repoman-2.3.17
15
16 .../mailman/files/mailman-2.1.29-fix-libdir.diff | 20 +++
17 net-mail/mailman/mailman-2.1.29-r2.ebuild | 170 +++++++++++++++++++++
18 2 files changed, 190 insertions(+)
19
20 diff --git a/net-mail/mailman/files/mailman-2.1.29-fix-libdir.diff b/net-mail/mailman/files/mailman-2.1.29-fix-libdir.diff
21 new file mode 100644
22 index 00000000000..f095938ff42
23 --- /dev/null
24 +++ b/net-mail/mailman/files/mailman-2.1.29-fix-libdir.diff
25 @@ -0,0 +1,20 @@
26 +--- misc/paths.py.in 2018-06-17 23:47:34 +0000
27 ++++ misc/paths.py.in 2019-08-16 15:18:03 +0000
28 +@@ -67,6 +67,16 @@
29 + 'dist-packages')
30 + sys.path.append(distdir)
31 +
32 ++# Some distros may have the python library in a directory other than lib/
33 ++# such as Lib/ or lib64/. Hopefully they will have hacked
34 ++# site.getsitepackages() to return the right thing.
35 ++try:
36 ++ import site
37 ++ sys.path.extend(site.getsitepackages())
38 ++ del site
39 ++except (ImportError, AttributeError):
40 ++ pass
41 ++
42 +
43 + # In a normal interactive Python environment, the japanese.pth and korean.pth
44 + # files would be imported automatically. But because we inhibit the importing
45 +
46
47 diff --git a/net-mail/mailman/mailman-2.1.29-r2.ebuild b/net-mail/mailman/mailman-2.1.29-r2.ebuild
48 new file mode 100644
49 index 00000000000..d6ef012802e
50 --- /dev/null
51 +++ b/net-mail/mailman/mailman-2.1.29-r2.ebuild
52 @@ -0,0 +1,170 @@
53 +# Copyright 1999-2019 Gentoo Authors
54 +# Distributed under the terms of the GNU General Public License v2
55 +
56 +EAPI=5
57 +
58 +PYTHON_COMPAT=( python2_7 )
59 +
60 +inherit eutils python-single-r1 multilib systemd user
61 +
62 +DESCRIPTION="A python-based mailing list server with an extensive web interface"
63 +SRC_URI="mirror://sourceforge/${PN}/${P/_p/-}.tgz"
64 +HOMEPAGE="http://www.list.org/"
65 +
66 +LICENSE="GPL-2"
67 +SLOT="0"
68 +KEYWORDS="~amd64 ~ppc ~x86"
69 +IUSE="selinux"
70 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
71 +
72 +DEPEND="
73 + ${PYTHON_DEPS}
74 + dev-python/dnspython[${PYTHON_USEDEP}]
75 + virtual/mta
76 + virtual/cron
77 + virtual/httpd-cgi"
78 +RDEPEND="${DEPEND}
79 + selinux? ( sec-policy/selinux-mailman )
80 +"
81 +
82 +S="${WORKDIR}/${P/_p/-}"
83 +
84 +pkg_setup() {
85 + python-single-r1_pkg_setup
86 + INSTALLDIR=${MAILMAN_PREFIX:-"/usr/$(get_libdir)/mailman"}
87 + VAR_PREFIX=${MAILMAN_VAR_PREFIX:-"/var/lib/mailman"}
88 + CGIUID=${MAILMAN_CGIUID:-apache}
89 + CGIGID=${MAILMAN_CGIGID:-apache}
90 + MAILUSR=${MAILMAN_MAILUSR:-mailman}
91 + MAILUID=${MAILMAN_MAILUID:-280}
92 + MAILGRP=${MAILMAN_MAILGRP:-mailman}
93 + MAILGID=${MAILMAN_MAILGID:-280}
94 +
95 + # Bug #58526: switch to enew{group,user}.
96 + # need to add mailman here for compile process.
97 + # Duplicated at pkg_postinst() for binary install.
98 + enewgroup ${MAILGRP} ${MAILGID}
99 + enewuser ${MAILUSR} ${MAILUID} /bin/bash ${INSTALLDIR} mailman,cron
100 +}
101 +
102 +src_prepare() {
103 + epatch "${FILESDIR}/${PN}-2.1.14_rc1-directory-check.patch"
104 + epatch "${FILESDIR}/${PN}-2.1.9-icons.patch"
105 + # Needed for new no-symlink profiles,
106 + # see https://bazaar.launchpad.net/~mailman-coders/mailman/2.1/revision/1819
107 + epatch "${FILESDIR}/mailman-2.1.29-fix-libdir.diff"
108 +}
109 +
110 +src_configure() {
111 + econf \
112 + --without-permcheck \
113 + --prefix="${INSTALLDIR}" \
114 + --with-mail-gid=${MAILGID} \
115 + --with-cgi-gid=${CGIGID} \
116 + --with-cgi-ext="${MAILMAN_CGIEXT}" \
117 + --with-var-prefix="${VAR_PREFIX}" \
118 + --with-username=${MAILUSR} \
119 + --with-groupname=${MAILGRP} \
120 + --with-python="${PYTHON}"
121 +}
122 +
123 +src_install () {
124 + emake "DESTDIR=${D}" doinstall
125 +
126 + insinto /etc/apache2/modules.d
127 + newins "${FILESDIR}/50_mailman.conf-r2" 50_mailman.conf
128 + sed \
129 + -e "s:/usr/local/mailman/cgi-bin:${INSTALLDIR}/cgi-bin:g" \
130 + -e "s:/usr/local/mailman/icons:${INSTALLDIR}/icons:g" \
131 + -e "s:/usr/local/mailman/archives:${VAR_PREFIX}/archives:g" \
132 + -i "${D}/etc/apache2/modules.d/50_mailman.conf" || die
133 +
134 + newdoc "${FILESDIR}/README.gentoo-r3" README.gentoo
135 +
136 + dodoc ACK* BUGS FAQ NEWS README* TODO UPGRADING INSTALL contrib/mailman.mc \
137 + contrib/README.check_perms_grsecurity contrib/virtusertable
138 +
139 + exeinto ${INSTALLDIR}/bin
140 + doexe build/contrib/*.py contrib/majordomo2mailman.pl contrib/auto \
141 + contrib/mm-handler*
142 +
143 + dodir /etc/mailman
144 + mv "${D}/${INSTALLDIR}/Mailman/mm_cfg.py" "${D}/etc/mailman"
145 + dosym /etc/mailman/mm_cfg.py ${INSTALLDIR}/Mailman/mm_cfg.py
146 +
147 + # Save the old config for updates from pre-2.1.9-r2
148 + # To be removed some distant day
149 + for i in /var/mailman /home/mailman /usr/local/mailman ${INSTALLDIR}; do
150 + if [ -f ${i}/Mailman/mm_cfg.py ] && ! [ -L ${i}/Mailman/mm_cfg.py ]; then
151 + cp ${i}/Mailman/mm_cfg.py "${D}/etc/mailman/mm_cfg.py" || die
152 + fi
153 + done
154 +
155 + newinitd "${FILESDIR}/mailman.rc" mailman
156 + cp "${FILESDIR}/mailman.service" "${T}/mailman.service" || die
157 + sed -i "s/^User=.*/User=${MAILUSR}/" "${T}/mailman.service" || die
158 + systemd_dounit "${T}/mailman.service"
159 +
160 + keepdir ${VAR_PREFIX}/logs
161 + keepdir ${VAR_PREFIX}/locks
162 + keepdir ${VAR_PREFIX}/spam
163 + keepdir ${VAR_PREFIX}/archives/public
164 + keepdir ${VAR_PREFIX}/archives/private
165 + keepdir ${VAR_PREFIX}/lists
166 + keepdir ${VAR_PREFIX}/qfiles
167 +
168 + chown -R ${MAILUSR}:${MAILGRP} "${D}/${VAR_PREFIX}" "${D}/${INSTALLDIR}" "${D}"/etc/mailman/* || die
169 + chown ${CGIUID}:${MAILGRP} "${D}/${VAR_PREFIX}/archives/private" || die
170 + chmod 2775 "${D}/${INSTALLDIR}" "${D}/${INSTALLDIR}"/templates/* \
171 + "${D}/${INSTALLDIR}"/messages/* "${D}/${VAR_PREFIX}" "${D}/${VAR_PREFIX}"/{logs,lists,spam,locks,archives/public} || die
172 + chmod 2770 "${D}/${VAR_PREFIX}/archives/private" || die
173 + chmod 2770 "${D}/${VAR_PREFIX}/qfiles" || die
174 + chmod 2755 "${D}/${INSTALLDIR}"/cgi-bin/* "${D}/${INSTALLDIR}/mail/mailman" || die
175 +
176 + python_optimize "${D}/${INSTALLDIR}/bin/" \
177 + "${D}/${INSTALLDIR}/Mailman/" \
178 + "${D}/${INSTALLDIR}/Mailman/*"
179 +}
180 +
181 +pkg_postinst() {
182 + enewgroup ${MAILGRP} ${MAILGID}
183 + enewuser ${MAILUSR} ${MAILUID} -1 ${INSTALLDIR} mailman,cron
184 + echo
185 + elog "Please read /usr/share/doc/${PF}/README.gentoo.bz2 for additional"
186 + elog "Setup information, mailman will NOT run unless you follow"
187 + elog "those instructions!"
188 + echo
189 +
190 + elog "An example Mailman configuration file for Apache has been installed into:"
191 + elog " ${APACHE2_MODULES_CONFDIR}/50_mailman.conf"
192 + echo
193 + elog "To enable, you will need to add \"-D MAILMAN\" to"
194 + elog "/etc/conf.d/apache2."
195 + echo
196 +
197 + ewarn "Default-Configuration has changed deeply in 2.1.9-r2. You can configure"
198 + ewarn "mailman with the following variables:"
199 + ewarn "MAILMAN_PREFIX (default: /usr/$(get_libdir)/mailman)"
200 + ewarn "MAILMAN_VAR_PREFIX (default: /var/lib/mailman)"
201 + ewarn "MAILMAN_CGIUID (default: apache)"
202 + ewarn "MAILMAN_CGIGID (default: apache)"
203 + ewarn "MAILMAN_CGIEXT (default: empty)"
204 + ewarn "MAILMAN_MAILUSR (default: mailman)"
205 + ewarn "MAILMAN_MAILUID (default: 280)"
206 + ewarn "MAILMAN_MAILGRP (default: mailman)"
207 + ewarn "MAILMAN_MAILGID (default: 280)"
208 + ewarn
209 + ewarn "Config file is now symlinked in /etc/mailman, so etc-update works."
210 + ewarn
211 + ewarn "If you're upgrading from below 2.1.9-r2 or changed MAILMAN_PREFIX, you"
212 + ewarn "NEED to make a few manual updates to your system:"
213 + ewarn
214 + ewarn "1. Update your mailman users's home directory: usermod -d ${INSTALLDIR} mailman"
215 + ewarn "2. Re-import the crontab: su - mailman -c 'crontab cron/crontab.in'"
216 + ewarn "3. Copy your old mm_cfg.py file to /etc/mailman/mm_cfg.py"
217 + ewarn
218 + ewarn "Additionally if you've modified MAILMAN_VAR_PREFIX (or upgraded from"
219 + ewarn "a pre 2.1.9-r2 installation), you should move your old lists/ and"
220 + ewarn "archives/ directory to the new location, ensuring that the"
221 + ewarn "permissions is correct. See bug #208789 for a discussion."
222 +}