1 |
commit: f302ee221545dd442429c19dd3a21545df86be63 |
2 |
Author: Louis Sautier <sbraz <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Aug 22 22:36:36 2021 +0000 |
4 |
Commit: Louis Sautier <sbraz <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Aug 24 19:23:39 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f302ee22 |
7 |
|
8 |
net-irc/znc: fix data location on systemd, #743856, enable py3.10 |
9 |
|
10 |
Also: |
11 |
* Backport a patch to replace freenode with libera. |
12 |
* Adjust README. |
13 |
* Remove an 8-year-old ewarn. |
14 |
* Respect PYTHON_SINGLE_TARGET when building modpython. |
15 |
* Fix pkg_postinst to work on systemd. |
16 |
* Remove/fix some checks in pkg_postinst that became broken/unnecessary |
17 |
with the swith to acct-user. |
18 |
* Improve README.gentoo slightly. |
19 |
|
20 |
Closes: https://bugs.gentoo.org/743856 |
21 |
Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org> |
22 |
|
23 |
net-irc/znc/files/README.gentoo-r1 | 6 +- |
24 |
net-irc/znc/files/znc-1.8.2-add-libera.patch | 55 ++++++ |
25 |
net-irc/znc/files/znc-1.8.2-fix-python-3.10.patch | 31 ++++ |
26 |
.../znc/files/znc-1.8.2-fix-systemd-datadir.patch | 23 +++ |
27 |
net-irc/znc/znc-1.8.2-r1.ebuild | 194 +++++++++++++++++++++ |
28 |
5 files changed, 306 insertions(+), 3 deletions(-) |
29 |
|
30 |
diff --git a/net-irc/znc/files/README.gentoo-r1 b/net-irc/znc/files/README.gentoo-r1 |
31 |
index ca41e4dac26..1812383beb2 100644 |
32 |
--- a/net-irc/znc/files/README.gentoo-r1 |
33 |
+++ b/net-irc/znc/files/README.gentoo-r1 |
34 |
@@ -5,11 +5,11 @@ To configure the system-wide daemon, you may run 'emerge --config znc'. |
35 |
If migrating from a user-based install, you can copy the existing |
36 |
configuration files: |
37 |
|
38 |
- # mkdir /var/lib/znc |
39 |
# mv /home/$USER/.znc/* /var/lib/znc |
40 |
# rm -rf /home/$USER/.znc |
41 |
# chown -R znc:znc /var/lib/znc |
42 |
|
43 |
OpenRC users may also adjust the location of the files and the user running |
44 |
-znc in /etc/conf.d/znc instead. Systemd users may have to overwrite the |
45 |
-existing unit file. |
46 |
+znc in /etc/conf.d/znc instead. |
47 |
+The same thing can be achieved for systemd by overriding the existing |
48 |
+unit file (systemctl edit znc.service). |
49 |
|
50 |
diff --git a/net-irc/znc/files/znc-1.8.2-add-libera.patch b/net-irc/znc/files/znc-1.8.2-add-libera.patch |
51 |
new file mode 100644 |
52 |
index 00000000000..e7015754d8c |
53 |
--- /dev/null |
54 |
+++ b/net-irc/znc/files/znc-1.8.2-add-libera.patch |
55 |
@@ -0,0 +1,55 @@ |
56 |
+From 15e2351d40763acee5d246df7c725c3bd259c304 Mon Sep 17 00:00:00 2001 |
57 |
+From: Alexey Sokolov <alexey+znc@××××××××.org> |
58 |
+Date: Wed, 26 May 2021 10:10:20 +0100 |
59 |
+Subject: [PATCH] Switch --makeconf wizard from freenode to libera |
60 |
+ |
61 |
+--- |
62 |
+ src/znc.cpp | 6 +++--- |
63 |
+ 1 file changed, 3 insertions(+), 3 deletions(-) |
64 |
+ |
65 |
+diff --git a/src/znc.cpp b/src/znc.cpp |
66 |
+index c5ad17dc69..365367545a 100644 |
67 |
+--- a/src/znc.cpp |
68 |
++++ b/src/znc.cpp |
69 |
+@@ -778,7 +778,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { |
70 |
+ CUtils::PrintMessage(""); |
71 |
+ |
72 |
+ do { |
73 |
+- CUtils::GetInput("Name", sNetwork, "freenode"); |
74 |
++ CUtils::GetInput("Name", sNetwork, "libera"); |
75 |
+ } while (!CIRCNetwork::IsValidNetwork(sNetwork)); |
76 |
+ |
77 |
+ vsLines.push_back("\t<Network " + sNetwork + ">"); |
78 |
+@@ -795,8 +795,8 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { |
79 |
+ bool bSSL = false; |
80 |
+ unsigned int uServerPort = 0; |
81 |
+ |
82 |
+- if (sNetwork.Equals("freenode")) { |
83 |
+- sHost = "chat.freenode.net"; |
84 |
++ if (sNetwork.Equals("libera")) { |
85 |
++ sHost = "irc.libera.chat"; |
86 |
+ #ifdef HAVE_LIBSSL |
87 |
+ bSSL = true; |
88 |
+ #endif |
89 |
+From 688645413c258f1fe42a39e42e5b5d1dead03d71 Mon Sep 17 00:00:00 2001 |
90 |
+From: Alexey Sokolov <alexey+znc@××××××××.org> |
91 |
+Date: Fri, 18 Jun 2021 21:20:53 +0100 |
92 |
+Subject: [PATCH] Fix integration test after switch to libera |
93 |
+ |
94 |
+--- |
95 |
+ test/integration/framework/znctest.cpp | 2 +- |
96 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
97 |
+ |
98 |
+diff --git a/test/integration/framework/znctest.cpp b/test/integration/framework/znctest.cpp |
99 |
+index 195b6083a9..40dae85fc2 100644 |
100 |
+--- a/test/integration/framework/znctest.cpp |
101 |
++++ b/test/integration/framework/znctest.cpp |
102 |
+@@ -39,7 +39,7 @@ void WriteConfig(QString path) { |
103 |
+ p.ReadUntil("Real name"); p.Write(); |
104 |
+ p.ReadUntil("Bind host"); p.Write(); |
105 |
+ p.ReadUntil("Set up a network?"); p.Write(); |
106 |
+- p.ReadUntil("Name [freenode]"); p.Write("test"); |
107 |
++ p.ReadUntil("Name [libera]"); p.Write("test"); |
108 |
+ p.ReadUntil("Server host (host only)"); p.Write("127.0.0.1"); |
109 |
+ p.ReadUntil("Server uses SSL?"); p.Write(); |
110 |
+ p.ReadUntil("6667"); p.Write(); |
111 |
|
112 |
diff --git a/net-irc/znc/files/znc-1.8.2-fix-python-3.10.patch b/net-irc/znc/files/znc-1.8.2-fix-python-3.10.patch |
113 |
new file mode 100644 |
114 |
index 00000000000..fe40d190d1b |
115 |
--- /dev/null |
116 |
+++ b/net-irc/znc/files/znc-1.8.2-fix-python-3.10.patch |
117 |
@@ -0,0 +1,31 @@ |
118 |
+From e8ff16123582eb9d5c321f5c7e652335abfba368 Mon Sep 17 00:00:00 2001 |
119 |
+From: Alexey Sokolov <alexey+znc@××××××××.org> |
120 |
+Date: Sat, 23 May 2020 13:28:13 +0100 |
121 |
+Subject: [PATCH] Fix PY_SSIZE_T_CLEAN python warning |
122 |
+ |
123 |
+--- |
124 |
+ .travis.yml | 2 +- |
125 |
+ modules/modpython.cpp | 3 ++- |
126 |
+ 2 files changed, 3 insertions(+), 2 deletions(-) |
127 |
+ |
128 |
+diff --git a/modules/modpython.cpp b/modules/modpython.cpp |
129 |
+index dfe53b5b6b..7bc76fc5c1 100644 |
130 |
+--- a/modules/modpython.cpp |
131 |
++++ b/modules/modpython.cpp |
132 |
+@@ -14,6 +14,7 @@ |
133 |
+ * limitations under the License. |
134 |
+ */ |
135 |
+ |
136 |
++#define PY_SSIZE_T_CLEAN |
137 |
+ #include <Python.h> |
138 |
+ |
139 |
+ #include <znc/Chan.h> |
140 |
+@@ -455,7 +456,7 @@ CBSOCK(ConnectionRefused); |
141 |
+ void CPySocket::ReadData(const char* data, size_t len) { |
142 |
+ PyObject* pyRes = |
143 |
+ PyObject_CallMethod(m_pyObj, const_cast<char*>("OnReadData"), |
144 |
+- const_cast<char*>("y#"), data, (int)len); |
145 |
++ const_cast<char*>("y#"), data, (Py_ssize_t)len); |
146 |
+ CHECKCLEARSOCK("OnReadData"); |
147 |
+ } |
148 |
+ |
149 |
|
150 |
diff --git a/net-irc/znc/files/znc-1.8.2-fix-systemd-datadir.patch b/net-irc/znc/files/znc-1.8.2-fix-systemd-datadir.patch |
151 |
new file mode 100644 |
152 |
index 00000000000..06dd6991b4a |
153 |
--- /dev/null |
154 |
+++ b/net-irc/znc/files/znc-1.8.2-fix-systemd-datadir.patch |
155 |
@@ -0,0 +1,23 @@ |
156 |
+From d4bfd143b4b12f6e6695878cc1b5168cc31c362c Mon Sep 17 00:00:00 2001 |
157 |
+From: Alexey Sokolov <alexey+znc@××××××××.org> |
158 |
+Date: Tue, 22 Sep 2020 10:20:47 +0100 |
159 |
+Subject: [PATCH] Fix path in systemd service (which shouldn't be here at all) |
160 |
+ |
161 |
+https://bugs.gentoo.org/743856 |
162 |
+--- |
163 |
+ znc.service.in | 2 +- |
164 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
165 |
+ |
166 |
+diff --git a/znc.service.in b/znc.service.in |
167 |
+index a6c9e68df..7accad906 100644 |
168 |
+--- a/znc.service.in |
169 |
++++ b/znc.service.in |
170 |
+@@ -3,7 +3,7 @@ Description=ZNC, an advanced IRC bouncer |
171 |
+ After=network.target |
172 |
+ |
173 |
+ [Service] |
174 |
+-ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/znc -f |
175 |
++ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/znc -f --datadir=/var/lib/znc |
176 |
+ User=znc |
177 |
+ |
178 |
+ [Install] |
179 |
|
180 |
diff --git a/net-irc/znc/znc-1.8.2-r1.ebuild b/net-irc/znc/znc-1.8.2-r1.ebuild |
181 |
new file mode 100644 |
182 |
index 00000000000..396026d8980 |
183 |
--- /dev/null |
184 |
+++ b/net-irc/znc/znc-1.8.2-r1.ebuild |
185 |
@@ -0,0 +1,194 @@ |
186 |
+# Copyright 1999-2021 Gentoo Authors |
187 |
+# Distributed under the terms of the GNU General Public License v2 |
188 |
+ |
189 |
+EAPI=7 |
190 |
+ |
191 |
+PYTHON_COMPAT=( python3_{8..10} ) |
192 |
+ |
193 |
+inherit cmake python-single-r1 readme.gentoo-r1 systemd |
194 |
+ |
195 |
+GTEST_VER="1.8.1" |
196 |
+GTEST_URL="https://github.com/google/googletest/archive/${GTEST_VER}.tar.gz -> gtest-${GTEST_VER}.tar.gz" |
197 |
+DESCRIPTION="An advanced IRC Bouncer" |
198 |
+ |
199 |
+if [[ ${PV} == *9999* ]]; then |
200 |
+ inherit git-r3 |
201 |
+ EGIT_REPO_URI="https://github.com/znc/znc.git" |
202 |
+else |
203 |
+ MY_PV=${PV/_/-} |
204 |
+ MY_P=${PN}-${MY_PV} |
205 |
+ SRC_URI=" |
206 |
+ https://znc.in/releases/archive/${MY_P}.tar.gz |
207 |
+ test? ( ${GTEST_URL} ) |
208 |
+ " |
209 |
+ KEYWORDS="~amd64 ~arm ~arm64 ~x86" |
210 |
+ S=${WORKDIR}/${MY_P} |
211 |
+fi |
212 |
+ |
213 |
+HOMEPAGE="https://znc.in" |
214 |
+LICENSE="Apache-2.0" |
215 |
+# "If you upgrade your ZNC version, you must recompile all your modules." |
216 |
+# - https://wiki.znc.in/Compiling_modules |
217 |
+SLOT="0/${PV}" |
218 |
+IUSE="+ipv6 +icu nls perl python +ssl sasl tcl test +zlib" |
219 |
+RESTRICT="!test? ( test )" |
220 |
+ |
221 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} icu )" |
222 |
+ |
223 |
+# perl is a build-time dependency of modpython |
224 |
+BDEPEND=" |
225 |
+ virtual/pkgconfig |
226 |
+ nls? ( sys-devel/gettext ) |
227 |
+ perl? ( |
228 |
+ >=dev-lang/swig-3.0.0 |
229 |
+ >=dev-lang/perl-5.10 |
230 |
+ ) |
231 |
+ python? ( |
232 |
+ >=dev-lang/swig-3.0.0 |
233 |
+ >=dev-lang/perl-5.10 |
234 |
+ ) |
235 |
+ test? ( |
236 |
+ ${PYTHON_DEPS} |
237 |
+ dev-qt/qtnetwork:5 |
238 |
+ ) |
239 |
+" |
240 |
+DEPEND=" |
241 |
+ icu? ( dev-libs/icu:= ) |
242 |
+ nls? ( dev-libs/boost:=[nls] ) |
243 |
+ perl? ( >=dev-lang/perl-5.10:= ) |
244 |
+ python? ( ${PYTHON_DEPS} ) |
245 |
+ sasl? ( >=dev-libs/cyrus-sasl-2 ) |
246 |
+ ssl? ( dev-libs/openssl:0= ) |
247 |
+ tcl? ( dev-lang/tcl:0= ) |
248 |
+ zlib? ( sys-libs/zlib:0= ) |
249 |
+" |
250 |
+RDEPEND=" |
251 |
+ ${DEPEND} |
252 |
+ acct-user/znc |
253 |
+ acct-group/znc |
254 |
+" |
255 |
+ |
256 |
+PATCHES=( |
257 |
+ "${FILESDIR}"/${PN}-1.7.1-inttest-dir.patch |
258 |
+ # All these are backports |
259 |
+ "${FILESDIR}"/${P}-fix-systemd-datadir.patch |
260 |
+ "${FILESDIR}"/${P}-add-libera.patch |
261 |
+ "${FILESDIR}"/${P}-fix-python-3.10.patch |
262 |
+) |
263 |
+ |
264 |
+pkg_setup() { |
265 |
+ if use python; then |
266 |
+ python-single-r1_pkg_setup |
267 |
+ fi |
268 |
+} |
269 |
+ |
270 |
+src_prepare() { |
271 |
+ # Let SWIG rebuild modperl/modpython to make user patching easier. |
272 |
+ if [[ ${PV} != *9999* ]]; then |
273 |
+ rm modules/modperl/generated.tar.gz || die |
274 |
+ rm modules/modpython/generated.tar.gz || die |
275 |
+ fi |
276 |
+ |
277 |
+ sed -i -e "s|DZNC_BIN_DIR:path=|DZNC_BIN_DIR:path=${T}/inttest|" \ |
278 |
+ test/CMakeLists.txt || die |
279 |
+ |
280 |
+ sed -i "s|--datadir=|&${EPREFIX}|" znc.service.in || die |
281 |
+ |
282 |
+ cmake_src_prepare |
283 |
+} |
284 |
+ |
285 |
+src_configure() { |
286 |
+ local mycmakeargs=( |
287 |
+ -DWANT_SYSTEMD=yes # Causes -DSYSTEMD_DIR to be used. |
288 |
+ -DSYSTEMD_DIR="$(systemd_get_systemunitdir)" |
289 |
+ -DWANT_ICU="$(usex icu)" |
290 |
+ -DWANT_IPV6="$(usex ipv6)" |
291 |
+ -DWANT_I18N="$(usex nls)" |
292 |
+ -DWANT_PERL="$(usex perl)" |
293 |
+ -DWANT_PYTHON="$(usex python)" |
294 |
+ -DWANT_PYTHON_VERSION="${EPYTHON#python}" |
295 |
+ -DWANT_CYRUS="$(usex sasl)" |
296 |
+ -DWANT_OPENSSL="$(usex ssl)" |
297 |
+ -DWANT_TCL="$(usex tcl)" |
298 |
+ -DWANT_ZLIB="$(usex zlib)" |
299 |
+ ) |
300 |
+ |
301 |
+ if [[ ${PV} != *9999* ]] && use test; then |
302 |
+ export GTEST_ROOT="${WORKDIR}/googletest-release-${GTEST_VER}/googletest" |
303 |
+ export GMOCK_ROOT="${WORKDIR}/googletest-release-${GTEST_VER}/googlemock" |
304 |
+ fi |
305 |
+ |
306 |
+ cmake_src_configure |
307 |
+} |
308 |
+ |
309 |
+src_test() { |
310 |
+ cmake_build unittest |
311 |
+ DESTDIR="${T}/inttest" cmake_build install |
312 |
+ local filter='-' |
313 |
+ if ! use perl; then |
314 |
+ filter="${filter}:ZNCTest.Modperl*" |
315 |
+ fi |
316 |
+ if ! use python; then |
317 |
+ filter="${filter}:ZNCTest.Modpython*" |
318 |
+ fi |
319 |
+ # CMAKE_PREFIX_PATH and CXXFLAGS are needed for znc-buildmod |
320 |
+ # invocations from inside the test |
321 |
+ GTEST_FILTER="${filter}" ZNC_UNUSUAL_ROOT="${T}/inttest" \ |
322 |
+ CMAKE_PREFIX_PATH="${T}/inttest/usr/share/znc/cmake" \ |
323 |
+ CXXFLAGS="${CXXFLAGS} -isystem ${T}/inttest/usr/include" \ |
324 |
+ cmake_build inttest |
325 |
+} |
326 |
+ |
327 |
+src_install() { |
328 |
+ cmake_src_install |
329 |
+ |
330 |
+ dodoc NOTICE |
331 |
+ newinitd "${FILESDIR}"/znc.initd-r2 znc |
332 |
+ newconfd "${FILESDIR}"/znc.confd-r1 znc |
333 |
+ |
334 |
+ local DOC_CONTENTS |
335 |
+ # "local" has its own return value which is not what we want to catch |
336 |
+ DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r1") || die |
337 |
+ local DISABLE_AUTOFORMATTING=1 |
338 |
+ readme.gentoo_create_doc |
339 |
+} |
340 |
+ |
341 |
+pkg_postinst() { |
342 |
+ if [[ -d "${EROOT}/var/lib/znc/.znc/" ]]; then |
343 |
+ eerror "${EROOT}/var/lib/znc/.znc/ exists, please move your data to ${EROOT}/var/lib/znc/" |
344 |
+ eerror "" |
345 |
+ eerror "The systemd unit has changed and now expects data to be located" |
346 |
+ eerror "at the root of ${EROOT}/var/lib/znc instead of its '.znc' subfolder." |
347 |
+ eerror "The recommended procedure to move the data is the following:" |
348 |
+ eerror "1. stop the service: systemctl stop znc.service" |
349 |
+ eerror "2. move the data: cp -a '${EROOT}/var/lib/znc/.znc/.' '${EROOT}/var/lib/znc/'" |
350 |
+ eerror "3. fix the config file: sed -i 's|${EROOT}/var/lib/znc/.znc|${EROOT}/var/lib/znc|g' '${EROOT}/var/lib/znc/configs/znc.conf'" |
351 |
+ eerror "4. restart znc: systemctl start znc.service" |
352 |
+ eerror "5. once everything works, remove the old data directory: rm -r '${EROOT}/var/lib/znc/.znc/'" |
353 |
+ eerror "See https://bugs.gentoo.org/743856 for details." |
354 |
+ fi |
355 |
+ |
356 |
+ if [[ -z "${REPLACING_VERSIONS}" ]]; then |
357 |
+ # This is a new installation |
358 |
+ readme.gentoo_print_elog |
359 |
+ fi |
360 |
+} |
361 |
+ |
362 |
+pkg_config() { |
363 |
+ if [[ -d "${EROOT}/var/lib/znc/configs" ]]; then |
364 |
+ ewarn "${EROOT}/var/lib/znc/configs/ already exists," |
365 |
+ ewarn "aborting to avoid damaging any existing configuration." |
366 |
+ ewarn "If you are sure you want to generate a new configuration," |
367 |
+ ewarn "remove the folder and try again." |
368 |
+ else |
369 |
+ einfo "Press enter to interactively create a new configuration file for znc." |
370 |
+ einfo "To abort, press Control-C" |
371 |
+ read |
372 |
+ su ${PN} -p -s /bin/sh -c 'ZNC_NO_LAUNCH_AFTER_MAKECONF=1 \ |
373 |
+ "${EROOT}"/usr/bin/znc --makeconf \ |
374 |
+ --datadir "${EROOT}/var/lib/znc"' || die "Config failed" |
375 |
+ einfo |
376 |
+ einfo "You can now start the znc service using the init system of your choice." |
377 |
+ einfo "Don't forget to enable it if you want to use znc at boot." |
378 |
+ fi |
379 |
+} |