summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Sokolov <sokolov@google.com>2017-01-04 01:58:29 +0100
committerThomas Deutschmann <whissi@gentoo.org>2017-01-04 02:01:18 +0100
commit08352091a142a547d7aaf9a52609395634489a86 (patch)
tree751976165b7526ea1245d50de71446d22ad2c587 /net-irc/znc
parentdev-python/requests: drop unused patch #595974 and restore used one #604560 (diff)
downloadgentoo-08352091a142a547d7aaf9a52609395634489a86.tar.gz
gentoo-08352091a142a547d7aaf9a52609395634489a86.tar.bz2
gentoo-08352091a142a547d7aaf9a52609395634489a86.zip
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 <whissi@gentoo.org>
Diffstat (limited to 'net-irc/znc')
-rw-r--r--net-irc/znc/files/README.gentoo-r115
-rw-r--r--net-irc/znc/files/znc.initd-r241
-rw-r--r--net-irc/znc/znc-9999.ebuild220
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 000000000000..cbd565d3d964
--- /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 000000000000..13bfcdfd0d9a
--- /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 81f46590043d..642a974b3a15 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
}