commit:     e8f4256f6405c53c49c2b0f3725862505a512d85
Author:     Louis Sautier <sbraz <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 24 19:21:38 2021 +0000
Commit:     Louis Sautier <sbraz <AT> gentoo <DOT> org>
CommitDate: Tue Aug 24 19:23:39 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e8f4256f

net-irc/znc: sync live ebuild with 1.8.2-r1

Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org>

 net-irc/znc/znc-9999.ebuild | 89 +++++++++++++++++++++++++--------------------
 1 file changed, 49 insertions(+), 40 deletions(-)

diff --git a/net-irc/znc/znc-9999.ebuild b/net-irc/znc/znc-9999.ebuild
index 303be815490..d00dd9757dd 100644
--- a/net-irc/znc/znc-9999.ebuild
+++ b/net-irc/znc/znc-9999.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7,8,9} )
+PYTHON_COMPAT=( python3_{8..10} )
 
 inherit cmake python-single-r1 readme.gentoo-r1 systemd
 
@@ -13,8 +13,7 @@ DESCRIPTION="An advanced IRC Bouncer"
 
 if [[ ${PV} == *9999* ]]; then
        inherit git-r3
-       EGIT_REPO_URI=${EGIT_REPO_URI:-"https://github.com/znc/znc.git"}
-       SRC_URI=""
+       EGIT_REPO_URI="https://github.com/znc/znc.git";
 else
        MY_PV=${PV/_/-}
        MY_P=${PN}-${MY_PV}
@@ -36,21 +35,7 @@ RESTRICT="!test? ( test )"
 
 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} icu )"
 
-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
-"
+# perl is a build-time dependency of modpython
 BDEPEND="
        virtual/pkgconfig
        nls? ( sys-devel/gettext )
@@ -67,8 +52,25 @@ BDEPEND="
                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 )
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.7.1-inttest-dir.patch
+)
 
 pkg_setup() {
        if use python; then
@@ -86,6 +88,8 @@ src_prepare() {
        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
 }
 
@@ -98,6 +102,7 @@ src_configure() {
                -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)"
@@ -137,43 +142,47 @@ src_install() {
        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
-       DISABLE_AUTOFORMATTING=1
+       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
-
-       if [[ -d "${EROOT}"/etc/znc ]]; then
-               ewarn "${EROOT}/etc/znc exists on your system."
-               ewarn "Due to the nature of the contents of that folder,"
-               ewarn "we have changed the default configuration to use"
-               ewarn " ${EROOT}/var/lib/znc"
-               ewarn "please move ${EROOT}/etc/znc to ${EROOT}/var/lib/znc"
-               ewarn "or adjust your service configuration."
-       fi
 }
 
 pkg_config() {
-       if [[ -e "${EROOT}/var/lib/znc" ]]; then
-               ewarn "${EROOT}/var/lib/znc already exists, aborting to avoid 
damaging"
-               ewarn "any existing configuration. If you are sure you want"
-               ewarn "to generate a new configuration, remove the folder"
-               ewarn "and try again."
+       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
-               mkdir -p "${EROOT}/var/lib/znc" || die
-               chown -R ${PN}:${PN} "${EROOT}/var/lib/znc" ||
-                       die "Setting permissions failed"
-               start-stop-daemon --start --user ${PN}:${PN} --env 
ZNC_NO_LAUNCH_AFTER_MAKECONF=1 \
-                       "${EROOT}"/usr/bin/znc -- --makeconf --datadir 
"${EROOT}/var/lib/znc" ||
-                       die "Config failed"
+               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."

Reply via email to