1 |
commit: 08352091a142a547d7aaf9a52609395634489a86 |
2 |
Author: Alexey Sokolov <sokolov <AT> google <DOT> com> |
3 |
AuthorDate: Wed Jan 4 00:58:29 2017 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 4 01:01:18 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08352091 |
7 |
|
8 |
net-irc/znc: Update/rewrite live ebuild |
9 |
|
10 |
Closes: https://github.com/gentoo/gentoo/pull/3236 |
11 |
|
12 |
Package-Manager: Portage-2.3.3, Repoman-2.3.1 |
13 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
14 |
|
15 |
net-irc/znc/files/README.gentoo-r1 | 15 +++ |
16 |
net-irc/znc/files/znc.initd-r2 | 41 +++++++ |
17 |
net-irc/znc/znc-9999.ebuild | 220 ++++++++++++++++++------------------- |
18 |
3 files changed, 162 insertions(+), 114 deletions(-) |
19 |
|
20 |
diff --git a/net-irc/znc/files/README.gentoo-r1 b/net-irc/znc/files/README.gentoo-r1 |
21 |
new file mode 100644 |
22 |
index 00000000..cbd565d |
23 |
--- /dev/null |
24 |
+++ b/net-irc/znc/files/README.gentoo-r1 |
25 |
@@ -0,0 +1,15 @@ |
26 |
+To run znc as a user, run 'znc --makeconf' to create a configuration file. |
27 |
+ |
28 |
+To configure the system-wide daemon, you may run 'emerge --config znc'. |
29 |
+ |
30 |
+If migrating from a user-based install, you can copy the existing |
31 |
+configuration files: |
32 |
+ |
33 |
+ # mkdir /var/lib/znc |
34 |
+ # mv /home/$USER/.znc/* /var/lib/znc |
35 |
+ # rm -rf /home/$USER/.znc |
36 |
+ # chown -R znc:znc /var/lib/znc |
37 |
+ |
38 |
+OpenRC user may also adjust the location of the files and the user running |
39 |
+znc in /etc/conf.d/znc instead. Systemd user may have to overwrite |
40 |
+existing unit file. |
41 |
|
42 |
diff --git a/net-irc/znc/files/znc.initd-r2 b/net-irc/znc/files/znc.initd-r2 |
43 |
new file mode 100644 |
44 |
index 00000000..13bfcdf |
45 |
--- /dev/null |
46 |
+++ b/net-irc/znc/files/znc.initd-r2 |
47 |
@@ -0,0 +1,41 @@ |
48 |
+#!/sbin/openrc-run |
49 |
+# Copyright 1999-2017 Gentoo Foundation |
50 |
+# Distributed under the terms of the GNU General Public License v2 |
51 |
+# $Id$ |
52 |
+ |
53 |
+extra_commands="config" |
54 |
+extra_started_commands="reload save" |
55 |
+command="/usr/bin/znc" |
56 |
+command_args="--datadir \"${ZNC_DATADIR}\" --foreground" |
57 |
+command_background="yes" |
58 |
+pidfile="${ZNC_PIDFILE:-/run/znc/znc.pid}" |
59 |
+user=${ZNC_USER:-znc} |
60 |
+group=${ZNC_GROUP:-znc} |
61 |
+start_stop_daemon_args="--chdir \"${ZNC_DATADIR}\" --user ${user} --group ${group} ${ZNC_SSDARGS}" |
62 |
+retry="${ZNC_TERMTIMEOUT}" |
63 |
+ |
64 |
+required_dirs="${ZNC_DATADIR}" |
65 |
+ |
66 |
+depend() { |
67 |
+ use dns logger |
68 |
+} |
69 |
+ |
70 |
+start_pre() { |
71 |
+ checkpath -d -m 0770 -o ${user}:${group} "$(dirname ${pidfile})" |
72 |
+} |
73 |
+ |
74 |
+stop_post() { |
75 |
+ rm -f "${pidfile}" |
76 |
+} |
77 |
+ |
78 |
+reload() { |
79 |
+ ebegin "Reloading ZNC Configuration File from Disk" |
80 |
+ start-stop-daemon --signal SIGHUP --pidfile "${pidfile}" |
81 |
+ eend $? |
82 |
+} |
83 |
+ |
84 |
+save() { |
85 |
+ ebegin "Saving ZNC Configuration File to Disk" |
86 |
+ start-stop-daemon --signal SIGUSR1 --pidfile "${pidfile}" |
87 |
+ eend $? |
88 |
+} |
89 |
|
90 |
diff --git a/net-irc/znc/znc-9999.ebuild b/net-irc/znc/znc-9999.ebuild |
91 |
index 81f4659..642a974 100644 |
92 |
--- a/net-irc/znc/znc-9999.ebuild |
93 |
+++ b/net-irc/znc/znc-9999.ebuild |
94 |
@@ -1,164 +1,156 @@ |
95 |
-# Copyright 1999-2016 Gentoo Foundation |
96 |
+# Copyright 1999-2017 Gentoo Foundation |
97 |
# Distributed under the terms of the GNU General Public License v2 |
98 |
# $Id$ |
99 |
|
100 |
-EAPI=5 |
101 |
+EAPI=6 |
102 |
|
103 |
-PYTHON_COMPAT=( python3_4 ) |
104 |
-inherit autotools eutils python-single-r1 user |
105 |
+PYTHON_COMPAT=( python{3_4,3_5} ) |
106 |
+PLOCALES="ru" |
107 |
+ |
108 |
+inherit cmake-utils l10n python-single-r1 readme.gentoo-r1 systemd user |
109 |
|
110 |
-MY_PV=${PV/_/-} |
111 |
DESCRIPTION="An advanced IRC Bouncer" |
112 |
|
113 |
-inherit git-r3 |
114 |
-EGIT_REPO_URI=${EGIT_REPO_URI:-"git://github.com/znc/znc.git"} |
115 |
-SRC_URI="" |
116 |
-KEYWORDS="" |
117 |
+if [[ ${PV} == *9999* ]]; then |
118 |
+ inherit git-r3 |
119 |
+ EGIT_REPO_URI=${EGIT_REPO_URI:-"https://github.com/znc/znc.git"} |
120 |
+ SRC_URI="" |
121 |
+else |
122 |
+ SRC_URI="http://znc.in/releases/archive/${P}.tar.gz" |
123 |
+ KEYWORDS="~amd64 ~arm ~x86" |
124 |
+fi |
125 |
|
126 |
HOMEPAGE="http://znc.in" |
127 |
LICENSE="Apache-2.0" |
128 |
SLOT="0" |
129 |
-IUSE="daemon debug ipv6 libressl perl python ssl sasl tcl" |
130 |
+IUSE="+ipv6 +icu libressl nls perl python +ssl sasl tcl test +zlib" |
131 |
|
132 |
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
133 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} icu )" |
134 |
|
135 |
RDEPEND=" |
136 |
- dev-libs/icu:= |
137 |
- sys-libs/zlib |
138 |
- perl? ( >=dev-lang/perl-5.10 ) |
139 |
+ icu? ( dev-libs/icu:= ) |
140 |
+ nls? ( dev-libs/boost:=[nls] ) |
141 |
+ perl? ( >=dev-lang/perl-5.10:= ) |
142 |
python? ( ${PYTHON_DEPS} ) |
143 |
sasl? ( >=dev-libs/cyrus-sasl-2 ) |
144 |
ssl? ( |
145 |
- !libressl? ( dev-libs/openssl:0 ) |
146 |
- libressl? ( dev-libs/libressl ) |
147 |
+ !libressl? ( dev-libs/openssl:0= ) |
148 |
+ libressl? ( dev-libs/libressl:0= ) |
149 |
) |
150 |
tcl? ( dev-lang/tcl:0= ) |
151 |
+ zlib? ( sys-libs/zlib ) |
152 |
" |
153 |
-DEPEND="${RDEPEND} |
154 |
+DEPEND=" |
155 |
+ ${RDEPEND} |
156 |
+ nls? ( sys-devel/gettext ) |
157 |
virtual/pkgconfig |
158 |
- perl? ( |
159 |
- >=dev-lang/swig-2.0.12 |
160 |
- ) |
161 |
- python? ( |
162 |
- >=dev-lang/swig-2.0.12 |
163 |
- ) |
164 |
+ perl? ( >=dev-lang/swig-3.0.0 ) |
165 |
+ python? ( >=dev-lang/swig-3.0.0 ) |
166 |
+ test? ( dev-cpp/gtest ) |
167 |
" |
168 |
|
169 |
-S=${WORKDIR}/${PN}-${MY_PV} |
170 |
- |
171 |
-CONFDIR="/var/lib/znc" |
172 |
- |
173 |
pkg_setup() { |
174 |
if use python; then |
175 |
python-single-r1_pkg_setup |
176 |
fi |
177 |
- if use daemon; then |
178 |
- enewgroup ${PN} |
179 |
- enewuser ${PN} -1 -1 /dev/null ${PN} |
180 |
- fi |
181 |
+ |
182 |
+ enewgroup ${PN} |
183 |
+ enewuser ${PN} -1 -1 /var/lib/${PN} ${PN} |
184 |
+ # The home directory was previously set to /dev/null |
185 |
+ # This caused a bug with the systemd unit |
186 |
+ # https://bugs.gentoo.org/521916 |
187 |
+ esethome ${PN} /var/lib/${PN} |
188 |
} |
189 |
|
190 |
src_prepare() { |
191 |
- AT_M4DIR="${S}/m4" \ |
192 |
- eautoreconf |
193 |
+ l10n_find_plocales_changes "${S}/src/po" "${PN}." '.po' |
194 |
+ |
195 |
+ remove_locale() { |
196 |
+ # Some language/module pairs can be missing |
197 |
+ rm -f src/po/${PN}.${1}.po modules/po/*.${1}.po || die |
198 |
+ } |
199 |
+ l10n_for_each_disabled_locale_do remove_locale |
200 |
+ |
201 |
+ # Let SWIG rebuild modperl/modpython to make user patching easier. |
202 |
+ if [[ ${PV} != *9999* ]]; then |
203 |
+ rm modules/modperl/generated.tar.gz || die |
204 |
+ rm modules/modpython/generated.tar.gz || die |
205 |
+ fi |
206 |
|
207 |
- # build system quirk, it does not define AM_INIT_AUTOMAKE, nor |
208 |
- # does it have Makefile.am in the root dir, but we need '--add-missing' |
209 |
- automake --add-missing |
210 |
+ cmake-utils_src_prepare |
211 |
} |
212 |
|
213 |
src_configure() { |
214 |
- econf \ |
215 |
- $(use_enable debug) \ |
216 |
- $(use_enable ipv6) \ |
217 |
- $(use_enable perl) \ |
218 |
- $(use python && echo "--enable-python=python3") \ |
219 |
- $(use_enable sasl cyrus) \ |
220 |
- $(use_enable ssl openssl) \ |
221 |
- $(use_enable tcl tcl) |
222 |
+ local mycmakeargs=( |
223 |
+ -DWANT_SYSTEMD=yes # Causes -DSYSTEMD_DIR to be used. |
224 |
+ -DSYSTEMD_DIR="$(systemd_get_systemunitdir)" |
225 |
+ -DWANT_ICU="$(usex icu)" |
226 |
+ -DWANT_IPV6="$(usex ipv6)" |
227 |
+ -DWANT_I18N="$(usex nls)" |
228 |
+ -DWANT_PERL="$(usex perl)" |
229 |
+ -DWANT_PYTHON="$(usex python)" |
230 |
+ -DWANT_CYRUS="$(usex sasl)" |
231 |
+ -DWANT_OPENSSL="$(usex ssl)" |
232 |
+ -DWANT_TCL="$(usex tcl)" |
233 |
+ -DWANT_ZLIB="$(usex zlib)" |
234 |
+ ) |
235 |
+ |
236 |
+ cmake-utils_src_configure |
237 |
+} |
238 |
+ |
239 |
+src_test() { |
240 |
+ pushd "${BUILD_DIR}" > /dev/null || die |
241 |
+ ${CMAKE_MAKEFILE_GENERATOR} unittest || die "Unit test failed" |
242 |
+ popd > /dev/null || die |
243 |
} |
244 |
|
245 |
src_install() { |
246 |
- emake install DESTDIR="${D}" |
247 |
- dodoc NOTICE README.md |
248 |
- if use daemon; then |
249 |
- newinitd "${FILESDIR}"/znc.initd-r1 znc |
250 |
- newconfd "${FILESDIR}"/znc.confd-r1 znc |
251 |
- fi |
252 |
+ cmake-utils_src_install |
253 |
+ |
254 |
+ dodoc NOTICE |
255 |
+ newinitd "${FILESDIR}"/znc.initd-r2 znc |
256 |
+ newconfd "${FILESDIR}"/znc.confd-r1 znc |
257 |
+ |
258 |
+ DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r1") || die |
259 |
+ DISABLE_AUTOFORMATTING=1 |
260 |
+ readme.gentoo_create_doc |
261 |
} |
262 |
|
263 |
pkg_postinst() { |
264 |
- if use !daemon; then |
265 |
- elog |
266 |
- elog "Run 'znc --makeconf' as the user you want to run ZNC as" |
267 |
- elog "to make a configuration file" |
268 |
- elog |
269 |
- else |
270 |
- elog |
271 |
- elog "An init-script was installed in /etc/init.d" |
272 |
- elog "A config file was installed in /etc/conf.d" |
273 |
- if [[ ! -d "${EROOT}${CONFDIR}" ]]; then |
274 |
- elog |
275 |
- elog "Run 'emerge --config znc' under portage" |
276 |
- elog "or 'cave config znc' under paludis to configure ZNC" |
277 |
- elog "as a system-wide daemon." |
278 |
- elog |
279 |
- elog "To generate a new SSL certificate, run:" |
280 |
- elog " znc --system-wide-config-as znc --makepem -d ${CONFDIR}" |
281 |
- elog "as root" |
282 |
- elog |
283 |
- elog "If migrating from a user-based install" |
284 |
- elog "you can use your existing config files:" |
285 |
- elog " mkdir ${CONFDIR}" |
286 |
- elog " mv /home/\$USER/.znc/* ${CONFDIR}" |
287 |
- elog " rm -rf /home/\$USER/.znc" |
288 |
- elog " chown -R znc:znc ${CONFDIR}" |
289 |
- elog |
290 |
- elog "If you already have znc set up and want take advantage of the" |
291 |
- elog "init script but skip of all the above, you can also edit" |
292 |
- elog " /etc/conf.d/znc" |
293 |
- elog "and adjust the variables to your current znc user and config" |
294 |
- elog "location." |
295 |
- if [[ -d "${EROOT}"/etc/znc ]]; then |
296 |
- elog |
297 |
- ewarn "/etc/znc exists on your system." |
298 |
- ewarn "Due to the nature of the contents of that folder," |
299 |
- ewarn "we have changed the default configuration to use" |
300 |
- ewarn " /var/lib/znc" |
301 |
- ewarn "please move /etc/znc to /var/lib/znc" |
302 |
- ewarn "or adjust /etc/conf.d/znc" |
303 |
- fi |
304 |
- else |
305 |
- elog "Existing config detected in ${CONFDIR}" |
306 |
- elog "You're good to go :)" |
307 |
- fi |
308 |
- elog |
309 |
+ if [[ -z "${REPLACING_VERSIONS}" ]]; then |
310 |
+ # This is a new installation |
311 |
+ readme.gentoo_print_elog |
312 |
+ fi |
313 |
+ |
314 |
+ if [[ -d "${EROOT%/}"/etc/znc ]]; then |
315 |
+ ewarn "${EROOT%/}/etc/znc exists on your system." |
316 |
+ ewarn "Due to the nature of the contents of that folder," |
317 |
+ ewarn "we have changed the default configuration to use" |
318 |
+ ewarn " ${EROOT%/}/var/lib/znc" |
319 |
+ ewarn "please move ${EROOT%/}/etc/znc to ${EROOT%/}/var/lib/znc" |
320 |
+ ewarn "or adjust your service configuration." |
321 |
fi |
322 |
} |
323 |
|
324 |
pkg_config() { |
325 |
- if use daemon && ! [[ -d "${EROOT}${CONFDIR}" ]]; then |
326 |
- einfo "Press ENTER to interactively create a new configuration file for znc." |
327 |
+ if [[ -e "${EROOT%/}/var/lib/znc" ]]; then |
328 |
+ ewarn "${EROOT%/}/var/lib/znc already exists, aborting to avoid damaging" |
329 |
+ ewarn "any existing configuration. If you are sure you want" |
330 |
+ ewarn "to generate a new configuration, remove the folder" |
331 |
+ ewarn "and try again." |
332 |
+ else |
333 |
+ einfo "Press any key to interactively create a new configuration file" |
334 |
+ einfo "for znc." |
335 |
einfo "To abort, press Control-C" |
336 |
read |
337 |
- mkdir -p "${EROOT}${CONFDIR}" || die |
338 |
- chown -R ${PN}:${PN} "${EROOT}${CONFDIR}" || |
339 |
+ mkdir -p "${EROOT%/}/var/lib/znc" || die |
340 |
+ chown -R ${PN}:${PN} "${EROOT%/}/var/lib/znc" || |
341 |
die "Setting permissions failed" |
342 |
- "${EROOT}"/usr/bin/znc --system-wide-config-as znc -c -r -d "${EROOT}${CONFDIR}" || |
343 |
+ start-stop-daemon --start --user ${PN}:${PN} --env ZNC_NO_LAUNCH_AFTER_MAKECONF=1 \ |
344 |
+ "${EROOT%/}"/usr/bin/znc -- --makeconf --datadir "${EROOT%/}/var/lib/znc" || |
345 |
die "Config failed" |
346 |
- echo |
347 |
- einfo "To start znc, run '/etc/init.d/znc start'" |
348 |
- einfo "or add znc to a runlevel:" |
349 |
- einfo " rc-update add znc default" |
350 |
- else |
351 |
- if use daemon; then |
352 |
- ewarn "${CONFDIR} already exists, aborting to avoid damaging" |
353 |
- ewarn "any existing configuration. If you are sure you want" |
354 |
- ewarn "to generate a new configuration, remove the folder" |
355 |
- ewarn "and try again." |
356 |
- else |
357 |
- ewarn "To configure znc as a system-wide daemon you have to" |
358 |
- ewarn "enable the 'daemon' use flag." |
359 |
- fi |
360 |
+ einfo |
361 |
+ einfo "Now you can start znc service using the init system of your choice." |
362 |
+ einfo "Don't forget to enable znc service if you want to use znc on boot." |
363 |
fi |
364 |
} |