summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Sautier <sbraz@gentoo.org>2021-08-23 00:36:36 +0200
committerLouis Sautier <sbraz@gentoo.org>2021-08-24 21:23:39 +0200
commitf302ee221545dd442429c19dd3a21545df86be63 (patch)
tree5a338ace957a9e431aae55c8e85c22a245e82746 /net-irc
parentnet-irc/znc: drop 1.8.1 (diff)
downloadgentoo-f302ee221545dd442429c19dd3a21545df86be63.tar.gz
gentoo-f302ee221545dd442429c19dd3a21545df86be63.tar.bz2
gentoo-f302ee221545dd442429c19dd3a21545df86be63.zip
net-irc/znc: fix data location on systemd, #743856, enable py3.10
Also: * Backport a patch to replace freenode with libera. * Adjust README. * Remove an 8-year-old ewarn. * Respect PYTHON_SINGLE_TARGET when building modpython. * Fix pkg_postinst to work on systemd. * Remove/fix some checks in pkg_postinst that became broken/unnecessary with the swith to acct-user. * Improve README.gentoo slightly. Closes: https://bugs.gentoo.org/743856 Signed-off-by: Louis Sautier <sbraz@gentoo.org>
Diffstat (limited to 'net-irc')
-rw-r--r--net-irc/znc/files/README.gentoo-r16
-rw-r--r--net-irc/znc/files/znc-1.8.2-add-libera.patch55
-rw-r--r--net-irc/znc/files/znc-1.8.2-fix-python-3.10.patch31
-rw-r--r--net-irc/znc/files/znc-1.8.2-fix-systemd-datadir.patch23
-rw-r--r--net-irc/znc/znc-1.8.2-r1.ebuild194
5 files changed, 306 insertions, 3 deletions
diff --git a/net-irc/znc/files/README.gentoo-r1 b/net-irc/znc/files/README.gentoo-r1
index ca41e4dac26b..1812383beb29 100644
--- a/net-irc/znc/files/README.gentoo-r1
+++ b/net-irc/znc/files/README.gentoo-r1
@@ -5,11 +5,11 @@ To configure the system-wide daemon, you may run 'emerge --config znc'.
If migrating from a user-based install, you can copy the existing
configuration files:
- # mkdir /var/lib/znc
# mv /home/$USER/.znc/* /var/lib/znc
# rm -rf /home/$USER/.znc
# chown -R znc:znc /var/lib/znc
OpenRC users may also adjust the location of the files and the user running
-znc in /etc/conf.d/znc instead. Systemd users may have to overwrite the
-existing unit file.
+znc in /etc/conf.d/znc instead.
+The same thing can be achieved for systemd by overriding the existing
+unit file (systemctl edit znc.service).
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
new file mode 100644
index 000000000000..e7015754d8c1
--- /dev/null
+++ b/net-irc/znc/files/znc-1.8.2-add-libera.patch
@@ -0,0 +1,55 @@
+From 15e2351d40763acee5d246df7c725c3bd259c304 Mon Sep 17 00:00:00 2001
+From: Alexey Sokolov <alexey+znc@asokolov.org>
+Date: Wed, 26 May 2021 10:10:20 +0100
+Subject: [PATCH] Switch --makeconf wizard from freenode to libera
+
+---
+ src/znc.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/znc.cpp b/src/znc.cpp
+index c5ad17dc69..365367545a 100644
+--- a/src/znc.cpp
++++ b/src/znc.cpp
+@@ -778,7 +778,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) {
+ CUtils::PrintMessage("");
+
+ do {
+- CUtils::GetInput("Name", sNetwork, "freenode");
++ CUtils::GetInput("Name", sNetwork, "libera");
+ } while (!CIRCNetwork::IsValidNetwork(sNetwork));
+
+ vsLines.push_back("\t<Network " + sNetwork + ">");
+@@ -795,8 +795,8 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) {
+ bool bSSL = false;
+ unsigned int uServerPort = 0;
+
+- if (sNetwork.Equals("freenode")) {
+- sHost = "chat.freenode.net";
++ if (sNetwork.Equals("libera")) {
++ sHost = "irc.libera.chat";
+ #ifdef HAVE_LIBSSL
+ bSSL = true;
+ #endif
+From 688645413c258f1fe42a39e42e5b5d1dead03d71 Mon Sep 17 00:00:00 2001
+From: Alexey Sokolov <alexey+znc@asokolov.org>
+Date: Fri, 18 Jun 2021 21:20:53 +0100
+Subject: [PATCH] Fix integration test after switch to libera
+
+---
+ test/integration/framework/znctest.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/integration/framework/znctest.cpp b/test/integration/framework/znctest.cpp
+index 195b6083a9..40dae85fc2 100644
+--- a/test/integration/framework/znctest.cpp
++++ b/test/integration/framework/znctest.cpp
+@@ -39,7 +39,7 @@ void WriteConfig(QString path) {
+ p.ReadUntil("Real name"); p.Write();
+ p.ReadUntil("Bind host"); p.Write();
+ p.ReadUntil("Set up a network?"); p.Write();
+- p.ReadUntil("Name [freenode]"); p.Write("test");
++ p.ReadUntil("Name [libera]"); p.Write("test");
+ p.ReadUntil("Server host (host only)"); p.Write("127.0.0.1");
+ p.ReadUntil("Server uses SSL?"); p.Write();
+ p.ReadUntil("6667"); p.Write();
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
new file mode 100644
index 000000000000..fe40d190d1ba
--- /dev/null
+++ b/net-irc/znc/files/znc-1.8.2-fix-python-3.10.patch
@@ -0,0 +1,31 @@
+From e8ff16123582eb9d5c321f5c7e652335abfba368 Mon Sep 17 00:00:00 2001
+From: Alexey Sokolov <alexey+znc@asokolov.org>
+Date: Sat, 23 May 2020 13:28:13 +0100
+Subject: [PATCH] Fix PY_SSIZE_T_CLEAN python warning
+
+---
+ .travis.yml | 2 +-
+ modules/modpython.cpp | 3 ++-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/modules/modpython.cpp b/modules/modpython.cpp
+index dfe53b5b6b..7bc76fc5c1 100644
+--- a/modules/modpython.cpp
++++ b/modules/modpython.cpp
+@@ -14,6 +14,7 @@
+ * limitations under the License.
+ */
+
++#define PY_SSIZE_T_CLEAN
+ #include <Python.h>
+
+ #include <znc/Chan.h>
+@@ -455,7 +456,7 @@ CBSOCK(ConnectionRefused);
+ void CPySocket::ReadData(const char* data, size_t len) {
+ PyObject* pyRes =
+ PyObject_CallMethod(m_pyObj, const_cast<char*>("OnReadData"),
+- const_cast<char*>("y#"), data, (int)len);
++ const_cast<char*>("y#"), data, (Py_ssize_t)len);
+ CHECKCLEARSOCK("OnReadData");
+ }
+
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
new file mode 100644
index 000000000000..06dd6991b4a4
--- /dev/null
+++ b/net-irc/znc/files/znc-1.8.2-fix-systemd-datadir.patch
@@ -0,0 +1,23 @@
+From d4bfd143b4b12f6e6695878cc1b5168cc31c362c Mon Sep 17 00:00:00 2001
+From: Alexey Sokolov <alexey+znc@asokolov.org>
+Date: Tue, 22 Sep 2020 10:20:47 +0100
+Subject: [PATCH] Fix path in systemd service (which shouldn't be here at all)
+
+https://bugs.gentoo.org/743856
+---
+ znc.service.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/znc.service.in b/znc.service.in
+index a6c9e68df..7accad906 100644
+--- a/znc.service.in
++++ b/znc.service.in
+@@ -3,7 +3,7 @@ Description=ZNC, an advanced IRC bouncer
+ After=network.target
+
+ [Service]
+-ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/znc -f
++ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/znc -f --datadir=/var/lib/znc
+ User=znc
+
+ [Install]
diff --git a/net-irc/znc/znc-1.8.2-r1.ebuild b/net-irc/znc/znc-1.8.2-r1.ebuild
new file mode 100644
index 000000000000..396026d8980b
--- /dev/null
+++ b/net-irc/znc/znc-1.8.2-r1.ebuild
@@ -0,0 +1,194 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{8..10} )
+
+inherit cmake python-single-r1 readme.gentoo-r1 systemd
+
+GTEST_VER="1.8.1"
+GTEST_URL="https://github.com/google/googletest/archive/${GTEST_VER}.tar.gz -> gtest-${GTEST_VER}.tar.gz"
+DESCRIPTION="An advanced IRC Bouncer"
+
+if [[ ${PV} == *9999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/znc/znc.git"
+else
+ MY_PV=${PV/_/-}
+ MY_P=${PN}-${MY_PV}
+ SRC_URI="
+ https://znc.in/releases/archive/${MY_P}.tar.gz
+ test? ( ${GTEST_URL} )
+ "
+ KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+ S=${WORKDIR}/${MY_P}
+fi
+
+HOMEPAGE="https://znc.in"
+LICENSE="Apache-2.0"
+# "If you upgrade your ZNC version, you must recompile all your modules."
+# - https://wiki.znc.in/Compiling_modules
+SLOT="0/${PV}"
+IUSE="+ipv6 +icu nls perl python +ssl sasl tcl test +zlib"
+RESTRICT="!test? ( test )"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} icu )"
+
+# perl is a build-time dependency of modpython
+BDEPEND="
+ virtual/pkgconfig
+ nls? ( sys-devel/gettext )
+ perl? (
+ >=dev-lang/swig-3.0.0
+ >=dev-lang/perl-5.10
+ )
+ python? (
+ >=dev-lang/swig-3.0.0
+ >=dev-lang/perl-5.10
+ )
+ test? (
+ ${PYTHON_DEPS}
+ dev-qt/qtnetwork:5
+ )
+"
+DEPEND="
+ icu? ( dev-libs/icu:= )
+ nls? ( dev-libs/boost:=[nls] )
+ perl? ( >=dev-lang/perl-5.10:= )
+ python? ( ${PYTHON_DEPS} )
+ sasl? ( >=dev-libs/cyrus-sasl-2 )
+ ssl? ( dev-libs/openssl:0= )
+ tcl? ( dev-lang/tcl:0= )
+ zlib? ( sys-libs/zlib:0= )
+"
+RDEPEND="
+ ${DEPEND}
+ acct-user/znc
+ acct-group/znc
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.7.1-inttest-dir.patch
+ # All these are backports
+ "${FILESDIR}"/${P}-fix-systemd-datadir.patch
+ "${FILESDIR}"/${P}-add-libera.patch
+ "${FILESDIR}"/${P}-fix-python-3.10.patch
+)
+
+pkg_setup() {
+ if use python; then
+ python-single-r1_pkg_setup
+ fi
+}
+
+src_prepare() {
+ # Let SWIG rebuild modperl/modpython to make user patching easier.
+ if [[ ${PV} != *9999* ]]; then
+ rm modules/modperl/generated.tar.gz || die
+ rm modules/modpython/generated.tar.gz || die
+ fi
+
+ sed -i -e "s|DZNC_BIN_DIR:path=|DZNC_BIN_DIR:path=${T}/inttest|" \
+ test/CMakeLists.txt || die
+
+ sed -i "s|--datadir=|&${EPREFIX}|" znc.service.in || die
+
+ cmake_src_prepare
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DWANT_SYSTEMD=yes # Causes -DSYSTEMD_DIR to be used.
+ -DSYSTEMD_DIR="$(systemd_get_systemunitdir)"
+ -DWANT_ICU="$(usex icu)"
+ -DWANT_IPV6="$(usex ipv6)"
+ -DWANT_I18N="$(usex nls)"
+ -DWANT_PERL="$(usex perl)"
+ -DWANT_PYTHON="$(usex python)"
+ -DWANT_PYTHON_VERSION="${EPYTHON#python}"
+ -DWANT_CYRUS="$(usex sasl)"
+ -DWANT_OPENSSL="$(usex ssl)"
+ -DWANT_TCL="$(usex tcl)"
+ -DWANT_ZLIB="$(usex zlib)"
+ )
+
+ if [[ ${PV} != *9999* ]] && use test; then
+ export GTEST_ROOT="${WORKDIR}/googletest-release-${GTEST_VER}/googletest"
+ export GMOCK_ROOT="${WORKDIR}/googletest-release-${GTEST_VER}/googlemock"
+ fi
+
+ cmake_src_configure
+}
+
+src_test() {
+ cmake_build unittest
+ DESTDIR="${T}/inttest" cmake_build install
+ local filter='-'
+ if ! use perl; then
+ filter="${filter}:ZNCTest.Modperl*"
+ fi
+ if ! use python; then
+ filter="${filter}:ZNCTest.Modpython*"
+ fi
+ # CMAKE_PREFIX_PATH and CXXFLAGS are needed for znc-buildmod
+ # invocations from inside the test
+ GTEST_FILTER="${filter}" ZNC_UNUSUAL_ROOT="${T}/inttest" \
+ CMAKE_PREFIX_PATH="${T}/inttest/usr/share/znc/cmake" \
+ CXXFLAGS="${CXXFLAGS} -isystem ${T}/inttest/usr/include" \
+ cmake_build inttest
+}
+
+src_install() {
+ cmake_src_install
+
+ dodoc NOTICE
+ newinitd "${FILESDIR}"/znc.initd-r2 znc
+ newconfd "${FILESDIR}"/znc.confd-r1 znc
+
+ local DOC_CONTENTS
+ # "local" has its own return value which is not what we want to catch
+ DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r1") || die
+ local DISABLE_AUTOFORMATTING=1
+ readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+ if [[ -d "${EROOT}/var/lib/znc/.znc/" ]]; then
+ eerror "${EROOT}/var/lib/znc/.znc/ exists, please move your data to ${EROOT}/var/lib/znc/"
+ eerror ""
+ eerror "The systemd unit has changed and now expects data to be located"
+ eerror "at the root of ${EROOT}/var/lib/znc instead of its '.znc' subfolder."
+ eerror "The recommended procedure to move the data is the following:"
+ eerror "1. stop the service: systemctl stop znc.service"
+ eerror "2. move the data: cp -a '${EROOT}/var/lib/znc/.znc/.' '${EROOT}/var/lib/znc/'"
+ 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'"
+ eerror "4. restart znc: systemctl start znc.service"
+ eerror "5. once everything works, remove the old data directory: rm -r '${EROOT}/var/lib/znc/.znc/'"
+ eerror "See https://bugs.gentoo.org/743856 for details."
+ fi
+
+ if [[ -z "${REPLACING_VERSIONS}" ]]; then
+ # This is a new installation
+ readme.gentoo_print_elog
+ fi
+}
+
+pkg_config() {
+ if [[ -d "${EROOT}/var/lib/znc/configs" ]]; then
+ ewarn "${EROOT}/var/lib/znc/configs/ already exists,"
+ ewarn "aborting to avoid damaging any existing configuration."
+ ewarn "If you are sure you want to generate a new configuration,"
+ ewarn "remove the folder and try again."
+ else
+ einfo "Press enter to interactively create a new configuration file for znc."
+ einfo "To abort, press Control-C"
+ read
+ su ${PN} -p -s /bin/sh -c 'ZNC_NO_LAUNCH_AFTER_MAKECONF=1 \
+ "${EROOT}"/usr/bin/znc --makeconf \
+ --datadir "${EROOT}/var/lib/znc"' || die "Config failed"
+ einfo
+ einfo "You can now start the znc service using the init system of your choice."
+ einfo "Don't forget to enable it if you want to use znc at boot."
+ fi
+}