From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E204A139085 for ; Wed, 4 Jan 2017 01:01:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 26BFEE0C4F; Wed, 4 Jan 2017 01:01:39 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E35D9E0C4F for ; Wed, 4 Jan 2017 01:01:38 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C2C3F34102B for ; Wed, 4 Jan 2017 01:01:37 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 889C32519 for ; Wed, 4 Jan 2017 01:01:35 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1483491678.08352091a142a547d7aaf9a52609395634489a86.whissi@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: net-irc/znc/, net-irc/znc/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: net-irc/znc/files/README.gentoo-r1 net-irc/znc/files/znc.initd-r2 net-irc/znc/znc-9999.ebuild X-VCS-Directories: net-irc/znc/files/ net-irc/znc/ X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 08352091a142a547d7aaf9a52609395634489a86 X-VCS-Branch: master Date: Wed, 4 Jan 2017 01:01:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 632575bc-45d0-4adc-ac21-abc90af2e457 X-Archives-Hash: 9caa1ca87ca584c9db7d156ac819ca24 commit: 08352091a142a547d7aaf9a52609395634489a86 Author: Alexey Sokolov google com> AuthorDate: Wed Jan 4 00:58:29 2017 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Wed Jan 4 01:01:18 2017 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08352091 net-irc/znc: Update/rewrite live ebuild Closes: https://github.com/gentoo/gentoo/pull/3236 Package-Manager: Portage-2.3.3, Repoman-2.3.1 Signed-off-by: Thomas Deutschmann gentoo.org> net-irc/znc/files/README.gentoo-r1 | 15 +++ net-irc/znc/files/znc.initd-r2 | 41 +++++++ net-irc/znc/znc-9999.ebuild | 220 ++++++++++++++++++------------------- 3 files changed, 162 insertions(+), 114 deletions(-) diff --git a/net-irc/znc/files/README.gentoo-r1 b/net-irc/znc/files/README.gentoo-r1 new file mode 100644 index 00000000..cbd565d --- /dev/null +++ b/net-irc/znc/files/README.gentoo-r1 @@ -0,0 +1,15 @@ +To run znc as a user, run 'znc --makeconf' to create a configuration file. + +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 user may also adjust the location of the files and the user running +znc in /etc/conf.d/znc instead. Systemd user may have to overwrite +existing unit file. diff --git a/net-irc/znc/files/znc.initd-r2 b/net-irc/znc/files/znc.initd-r2 new file mode 100644 index 00000000..13bfcdf --- /dev/null +++ b/net-irc/znc/files/znc.initd-r2 @@ -0,0 +1,41 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +extra_commands="config" +extra_started_commands="reload save" +command="/usr/bin/znc" +command_args="--datadir \"${ZNC_DATADIR}\" --foreground" +command_background="yes" +pidfile="${ZNC_PIDFILE:-/run/znc/znc.pid}" +user=${ZNC_USER:-znc} +group=${ZNC_GROUP:-znc} +start_stop_daemon_args="--chdir \"${ZNC_DATADIR}\" --user ${user} --group ${group} ${ZNC_SSDARGS}" +retry="${ZNC_TERMTIMEOUT}" + +required_dirs="${ZNC_DATADIR}" + +depend() { + use dns logger +} + +start_pre() { + checkpath -d -m 0770 -o ${user}:${group} "$(dirname ${pidfile})" +} + +stop_post() { + rm -f "${pidfile}" +} + +reload() { + ebegin "Reloading ZNC Configuration File from Disk" + start-stop-daemon --signal SIGHUP --pidfile "${pidfile}" + eend $? +} + +save() { + ebegin "Saving ZNC Configuration File to Disk" + start-stop-daemon --signal SIGUSR1 --pidfile "${pidfile}" + eend $? +} diff --git a/net-irc/znc/znc-9999.ebuild b/net-irc/znc/znc-9999.ebuild index 81f4659..642a974 100644 --- a/net-irc/znc/znc-9999.ebuild +++ b/net-irc/znc/znc-9999.ebuild @@ -1,164 +1,156 @@ -# Copyright 1999-2016 Gentoo Foundation +# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ -EAPI=5 +EAPI=6 -PYTHON_COMPAT=( python3_4 ) -inherit autotools eutils python-single-r1 user +PYTHON_COMPAT=( python{3_4,3_5} ) +PLOCALES="ru" + +inherit cmake-utils l10n python-single-r1 readme.gentoo-r1 systemd user -MY_PV=${PV/_/-} DESCRIPTION="An advanced IRC Bouncer" -inherit git-r3 -EGIT_REPO_URI=${EGIT_REPO_URI:-"git://github.com/znc/znc.git"} -SRC_URI="" -KEYWORDS="" +if [[ ${PV} == *9999* ]]; then + inherit git-r3 + EGIT_REPO_URI=${EGIT_REPO_URI:-"https://github.com/znc/znc.git"} + SRC_URI="" +else + SRC_URI="http://znc.in/releases/archive/${P}.tar.gz" + KEYWORDS="~amd64 ~arm ~x86" +fi HOMEPAGE="http://znc.in" LICENSE="Apache-2.0" SLOT="0" -IUSE="daemon debug ipv6 libressl perl python ssl sasl tcl" +IUSE="+ipv6 +icu libressl nls perl python +ssl sasl tcl test +zlib" -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} icu )" RDEPEND=" - dev-libs/icu:= - sys-libs/zlib - perl? ( >=dev-lang/perl-5.10 ) + 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? ( - !libressl? ( dev-libs/openssl:0 ) - libressl? ( dev-libs/libressl ) + !libressl? ( dev-libs/openssl:0= ) + libressl? ( dev-libs/libressl:0= ) ) tcl? ( dev-lang/tcl:0= ) + zlib? ( sys-libs/zlib ) " -DEPEND="${RDEPEND} +DEPEND=" + ${RDEPEND} + nls? ( sys-devel/gettext ) virtual/pkgconfig - perl? ( - >=dev-lang/swig-2.0.12 - ) - python? ( - >=dev-lang/swig-2.0.12 - ) + perl? ( >=dev-lang/swig-3.0.0 ) + python? ( >=dev-lang/swig-3.0.0 ) + test? ( dev-cpp/gtest ) " -S=${WORKDIR}/${PN}-${MY_PV} - -CONFDIR="/var/lib/znc" - pkg_setup() { if use python; then python-single-r1_pkg_setup fi - if use daemon; then - enewgroup ${PN} - enewuser ${PN} -1 -1 /dev/null ${PN} - fi + + enewgroup ${PN} + enewuser ${PN} -1 -1 /var/lib/${PN} ${PN} + # The home directory was previously set to /dev/null + # This caused a bug with the systemd unit + # https://bugs.gentoo.org/521916 + esethome ${PN} /var/lib/${PN} } src_prepare() { - AT_M4DIR="${S}/m4" \ - eautoreconf + l10n_find_plocales_changes "${S}/src/po" "${PN}." '.po' + + remove_locale() { + # Some language/module pairs can be missing + rm -f src/po/${PN}.${1}.po modules/po/*.${1}.po || die + } + l10n_for_each_disabled_locale_do remove_locale + + # 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 - # build system quirk, it does not define AM_INIT_AUTOMAKE, nor - # does it have Makefile.am in the root dir, but we need '--add-missing' - automake --add-missing + cmake-utils_src_prepare } src_configure() { - econf \ - $(use_enable debug) \ - $(use_enable ipv6) \ - $(use_enable perl) \ - $(use python && echo "--enable-python=python3") \ - $(use_enable sasl cyrus) \ - $(use_enable ssl openssl) \ - $(use_enable tcl tcl) + 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_CYRUS="$(usex sasl)" + -DWANT_OPENSSL="$(usex ssl)" + -DWANT_TCL="$(usex tcl)" + -DWANT_ZLIB="$(usex zlib)" + ) + + cmake-utils_src_configure +} + +src_test() { + pushd "${BUILD_DIR}" > /dev/null || die + ${CMAKE_MAKEFILE_GENERATOR} unittest || die "Unit test failed" + popd > /dev/null || die } src_install() { - emake install DESTDIR="${D}" - dodoc NOTICE README.md - if use daemon; then - newinitd "${FILESDIR}"/znc.initd-r1 znc - newconfd "${FILESDIR}"/znc.confd-r1 znc - fi + cmake-utils_src_install + + dodoc NOTICE + newinitd "${FILESDIR}"/znc.initd-r2 znc + newconfd "${FILESDIR}"/znc.confd-r1 znc + + DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r1") || die + DISABLE_AUTOFORMATTING=1 + readme.gentoo_create_doc } pkg_postinst() { - if use !daemon; then - elog - elog "Run 'znc --makeconf' as the user you want to run ZNC as" - elog "to make a configuration file" - elog - else - elog - elog "An init-script was installed in /etc/init.d" - elog "A config file was installed in /etc/conf.d" - if [[ ! -d "${EROOT}${CONFDIR}" ]]; then - elog - elog "Run 'emerge --config znc' under portage" - elog "or 'cave config znc' under paludis to configure ZNC" - elog "as a system-wide daemon." - elog - elog "To generate a new SSL certificate, run:" - elog " znc --system-wide-config-as znc --makepem -d ${CONFDIR}" - elog "as root" - elog - elog "If migrating from a user-based install" - elog "you can use your existing config files:" - elog " mkdir ${CONFDIR}" - elog " mv /home/\$USER/.znc/* ${CONFDIR}" - elog " rm -rf /home/\$USER/.znc" - elog " chown -R znc:znc ${CONFDIR}" - elog - elog "If you already have znc set up and want take advantage of the" - elog "init script but skip of all the above, you can also edit" - elog " /etc/conf.d/znc" - elog "and adjust the variables to your current znc user and config" - elog "location." - if [[ -d "${EROOT}"/etc/znc ]]; then - elog - ewarn "/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 " /var/lib/znc" - ewarn "please move /etc/znc to /var/lib/znc" - ewarn "or adjust /etc/conf.d/znc" - fi - else - elog "Existing config detected in ${CONFDIR}" - elog "You're good to go :)" - fi - elog + 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 use daemon && ! [[ -d "${EROOT}${CONFDIR}" ]]; then - einfo "Press ENTER to interactively create a new configuration file for znc." + 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." + else + einfo "Press any key to interactively create a new configuration file" + einfo "for znc." einfo "To abort, press Control-C" read - mkdir -p "${EROOT}${CONFDIR}" || die - chown -R ${PN}:${PN} "${EROOT}${CONFDIR}" || + mkdir -p "${EROOT%/}/var/lib/znc" || die + chown -R ${PN}:${PN} "${EROOT%/}/var/lib/znc" || die "Setting permissions failed" - "${EROOT}"/usr/bin/znc --system-wide-config-as znc -c -r -d "${EROOT}${CONFDIR}" || + 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" - echo - einfo "To start znc, run '/etc/init.d/znc start'" - einfo "or add znc to a runlevel:" - einfo " rc-update add znc default" - else - if use daemon; then - ewarn "${CONFDIR} 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." - else - ewarn "To configure znc as a system-wide daemon you have to" - ewarn "enable the 'daemon' use flag." - fi + einfo + einfo "Now you can start znc service using the init system of your choice." + einfo "Don't forget to enable znc service if you want to use znc on boot." fi }