summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/mwlib')
-rw-r--r--dev-python/mwlib/ChangeLog14
-rw-r--r--dev-python/mwlib/files/0.15.8-nslave-add-address-parameter.patch51
-rw-r--r--dev-python/mwlib/files/mw-qserve.confd14
-rw-r--r--dev-python/mwlib/files/mw-qserve.initd21
-rw-r--r--dev-python/mwlib/files/mw-qserve.logrotate7
-rw-r--r--dev-python/mwlib/files/mwlib-purge-cache.cron4
-rw-r--r--dev-python/mwlib/files/nserve.confd20
-rw-r--r--dev-python/mwlib/files/nserve.initd24
-rw-r--r--dev-python/mwlib/files/nserve.logrotate7
-rw-r--r--dev-python/mwlib/files/nslave.confd26
-rw-r--r--dev-python/mwlib/files/nslave.initd27
-rw-r--r--dev-python/mwlib/files/nslave.logrotate7
-rw-r--r--dev-python/mwlib/files/postman.confd12
-rw-r--r--dev-python/mwlib/files/postman.initd21
-rw-r--r--dev-python/mwlib/files/postman.logrotate7
-rw-r--r--dev-python/mwlib/metadata.xml3
-rw-r--r--dev-python/mwlib/mwlib-0.15.8-r2.ebuild121
17 files changed, 385 insertions, 1 deletions
diff --git a/dev-python/mwlib/ChangeLog b/dev-python/mwlib/ChangeLog
index e2af0e4dd276..459bdd96d79d 100644
--- a/dev-python/mwlib/ChangeLog
+++ b/dev-python/mwlib/ChangeLog
@@ -1,6 +1,18 @@
# ChangeLog for dev-python/mwlib
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/mwlib/ChangeLog,v 1.25 2013/07/01 10:03:00 dev-zero Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-python/mwlib/ChangeLog,v 1.26 2013/07/01 13:56:29 dev-zero Exp $
+
+*mwlib-0.15.8-r2 (01 Jul 2013)
+
+ 01 Jul 2013; Tiziano Müller <dev-zero@gentoo.org>
+ +files/0.15.8-nslave-add-address-parameter.patch, +files/mw-qserve.confd,
+ +files/mw-qserve.initd, +files/mw-qserve.logrotate,
+ +files/mwlib-purge-cache.cron, +files/nserve.confd, +files/nserve.initd,
+ +files/nserve.logrotate, +files/nslave.confd, +files/nslave.initd,
+ +files/nslave.logrotate, +files/postman.confd, +files/postman.initd,
+ +files/postman.logrotate, +mwlib-0.15.8-r2.ebuild, metadata.xml:
+ Add init.d scripts to manage servers, thanks to Pat Kläy and Christian
+ Affolter. Add patch which adds an address parameter to nslave.
*mwlib-0.15.8-r1 (01 Jul 2013)
diff --git a/dev-python/mwlib/files/0.15.8-nslave-add-address-parameter.patch b/dev-python/mwlib/files/0.15.8-nslave-add-address-parameter.patch
new file mode 100644
index 000000000000..1e878feeb4fb
--- /dev/null
+++ b/dev-python/mwlib/files/0.15.8-nslave-add-address-parameter.patch
@@ -0,0 +1,51 @@
+diff --git a/mwlib/nslave.py b/mwlib/nslave.py
+index d3f8fc0..cccfc7a 100755
+--- a/mwlib/nslave.py
++++ b/mwlib/nslave.py
+@@ -184,7 +184,7 @@ class commands(object):
+ return doit(**params)
+
+
+-def start_serving_files(cachedir, port):
++def start_serving_files(cachedir, address, port):
+ from gevent.pywsgi import WSGIServer
+ from bottle import route, static_file, default_app
+ cachedir = os.path.abspath(cachedir)
+@@ -195,7 +195,7 @@ def start_serving_files(cachedir, port):
+ if filename.endswith(".rl"):
+ response.headers["Content-Disposition"] = "inline; filename=collection.pdf"
+ return response
+- s = WSGIServer(("", port), default_app())
++ s = WSGIServer((address, port), default_app())
+ s.start()
+ return s
+
+@@ -212,10 +212,11 @@ def make_cachedir(cachedir):
+ def main():
+ global cachedir, cacheurl
+ numgreenlets = 10
++ http_address = 'localhost'
+ http_port = 8898
+ serve_files = True
+ from mwlib import argv
+- opts, args = argv.parse(sys.argv[1:], "--no-serve-files --serve-files-port= --serve-files --cachedir= --url= --numprocs=")
++ opts, args = argv.parse(sys.argv[1:], "--no-serve-files --serve-files-port= --serve-files-address= --serve-files --cachedir= --url= --numprocs=")
+ for o, a in opts:
+ if o == "--cachedir":
+ cachedir = a
+@@ -227,12 +228,14 @@ def main():
+ serve_files = False
+ elif o == "--serve-files-port":
+ http_port = int(a)
++ elif o == "--serve-files-address":
++ http_address = str(a)
+
+ if cachedir is None:
+ sys.exit("nslave: missing --cachedir argument")
+
+ if serve_files:
+- wsgi_server = start_serving_files(cachedir, http_port)
++ wsgi_server = start_serving_files(cachedir, http_address, http_port)
+ port = wsgi_server.socket.getsockname()[1]
+ if not cacheurl:
+ cacheurl = "http://%s:%s/cache" % (find_ip(), port)
diff --git a/dev-python/mwlib/files/mw-qserve.confd b/dev-python/mwlib/files/mw-qserve.confd
new file mode 100644
index 000000000000..bcd18d4667af
--- /dev/null
+++ b/dev-python/mwlib/files/mw-qserve.confd
@@ -0,0 +1,14 @@
+# The port to listen to
+MW_QSERVE_PORT=14311
+
+# The interface to listen to (for example: 127.0.0.1)
+MW_QSERVE_INTERFACE="127.0.0.1"
+
+# The user running the mw-qserve service, defaults to 'mwlib'
+# MW_QSERVE_USER="mwlib"
+
+# The group running the mq-qserve service, defaults to 'mwlib'
+# MW_QSERVE_GROUP="mwlib"
+
+# The logfile collecting all output from stdout and stderr, comment out for no logging
+MW_QSERVE_LOGFILE="/var/log/mwlib/mw-qserve.log"
diff --git a/dev-python/mwlib/files/mw-qserve.initd b/dev-python/mwlib/files/mw-qserve.initd
new file mode 100644
index 000000000000..46020735c8f5
--- /dev/null
+++ b/dev-python/mwlib/files/mw-qserve.initd
@@ -0,0 +1,21 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/mwlib/files/mw-qserve.initd,v 1.1 2013/07/01 13:56:29 dev-zero Exp $
+
+description="mw-qserve is a job queue server used to distribute and manage jobs"
+
+command="/usr/bin/mw-qserve"
+command_args="--interface=${MW_QSERVE_INTERFACE} --port=${MW_QSERVE_PORT}"
+
+pidfile="/var/run/${SVCNAME}.pid"
+command_background="yes"
+
+start_stop_daemon_args="--user ${MW_QSERVE_USER:-mwlib} \
+ --group ${MW_QSERVE_GROUP:-mwlib} \
+ ${MW_QSERVE_LOGFILE:+--stderr ${MW_QSERVE_LOGFILE}} \
+ ${MW_QSERVE_LOGFILE:+--stdout ${MW_QSERVE_LOGFILE}}"
+
+depend() {
+ need net localmount
+}
diff --git a/dev-python/mwlib/files/mw-qserve.logrotate b/dev-python/mwlib/files/mw-qserve.logrotate
new file mode 100644
index 000000000000..3b9cf46e9411
--- /dev/null
+++ b/dev-python/mwlib/files/mw-qserve.logrotate
@@ -0,0 +1,7 @@
+/var/log/mwlib/mw-qserve.log {
+ su mwlib mwlib
+ missingok
+ postrotate
+ /etc/init.d/mw-qserve restart > /dev/null 2>&1
+ endscript
+}
diff --git a/dev-python/mwlib/files/mwlib-purge-cache.cron b/dev-python/mwlib/files/mwlib-purge-cache.cron
new file mode 100644
index 000000000000..d5a97ca61ce6
--- /dev/null
+++ b/dev-python/mwlib/files/mwlib-purge-cache.cron
@@ -0,0 +1,4 @@
+# purge mw-serve cache directory
+# --cache-dir=DIR: the NSLAVE_CACHEDIR directory specified in /etc/conf.d/nslave
+# --purge-cache=HOURS: remove cache files that have not been touched for at east HOURS hours
+00 23 * * * sudo -u mwlib mw-serve-ctl --cache-dir=/var/cache/mw-serve --purge-cache=24
diff --git a/dev-python/mwlib/files/nserve.confd b/dev-python/mwlib/files/nserve.confd
new file mode 100644
index 000000000000..7a482e9989c8
--- /dev/null
+++ b/dev-python/mwlib/files/nserve.confd
@@ -0,0 +1,20 @@
+# The port on which the mw-qserve service is listening
+MW_QSERVE_PORT=14311
+
+# The interface on which the mw-qserve is listening (for example: 127.0.0.1)
+MW_QSERVE_INTERFACE="127.0.0.1"
+
+# The port to listen to
+NSERVE_PORT=8899
+
+# The interface to listen to (for example: 127.0.0.1)
+NSERVE_INTERFACE="127.0.0.1"
+
+# The user running the nserve service, defaults to 'mwlib'
+# NSERVE_USER="mwlib"
+
+# The group running the nserve service, defaults to 'mwlib'
+# NSERVE_GROUP="mwlib"
+
+# The logfile collecting all output from stdout and stderr, comment out for no logging
+NSERVE_LOGFILE="/var/log/mwlib/nserve.log"
diff --git a/dev-python/mwlib/files/nserve.initd b/dev-python/mwlib/files/nserve.initd
new file mode 100644
index 000000000000..f4361fe8af42
--- /dev/null
+++ b/dev-python/mwlib/files/nserve.initd
@@ -0,0 +1,24 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/mwlib/files/nserve.initd,v 1.1 2013/07/01 13:56:29 dev-zero Exp $
+
+description="nserve is a HTTP server which distributes received jobs to a mw-qserve instance"
+
+command="/usr/bin/nserve"
+command_args="--port=${NSERVE_PORT} \
+ --interface=${NSERVE_INTERFACE} \
+ --qserve=${MW_QSERVE_INTERFACE}:${MW_QSERVE_PORT}"
+
+pidfile="/var/run/${SVCNAME}.pid"
+command_background="yes"
+
+start_stop_daemon_args="--user ${NSERVE_USER:-mwlib} \
+ --group ${NSERVE_GROUP:-mwlib} \
+ ${NSERVE_LOGFILE:+--stderr ${NSERVE_LOGFILE}} \
+ ${NSERVE_LOGFILE:+--stdout ${NSERVE_LOGFILE}}"
+
+depend() {
+ need net localmount
+ use mw-qserve
+}
diff --git a/dev-python/mwlib/files/nserve.logrotate b/dev-python/mwlib/files/nserve.logrotate
new file mode 100644
index 000000000000..54cc4587335d
--- /dev/null
+++ b/dev-python/mwlib/files/nserve.logrotate
@@ -0,0 +1,7 @@
+/var/log/mwlib/nserve.log {
+ su mwlib mwlib
+ missingok
+ postrotate
+ /etc/init.d/nserve restart > /dev/null 2>&1
+ endscript
+}
diff --git a/dev-python/mwlib/files/nslave.confd b/dev-python/mwlib/files/nslave.confd
new file mode 100644
index 000000000000..512be0fe1050
--- /dev/null
+++ b/dev-python/mwlib/files/nslave.confd
@@ -0,0 +1,26 @@
+# The address to serve the rendered files to the wiki
+NSLAVE_ADDRESS="localhost"
+
+# The port to serve the rendered files to the wiki
+NSLAVE_PORT=8898
+
+# The url to serve the rendered files to the wiki
+NSLAVE_URL="http://${NSLAVE_ADDRESS}:${NSLAVE_PORT}"
+
+# The directory to save the rendered PDFs to
+NSLAVE_CACHEDIR="/var/cache/mwlib/"
+
+# The umask to create files in NSLAVE_CACHEDIR
+NSLAVE_UMASK=027
+
+# How many greenlets are allowed to run in parallel
+NSLAVE_NUMPROCS=10
+
+# The user running the nserve service, defaults to 'mwlib'
+# NSLAVE_USER="mwlib"
+
+# The group running the nserve service, defaults to 'mwlib'
+# NSLAVE_GROUP="mwlib"
+
+# The logfile collecting all output from stdout and stderr, comment out for no logging
+NSLAVE_LOGFILE="/var/log/mwlib/nslave.log"
diff --git a/dev-python/mwlib/files/nslave.initd b/dev-python/mwlib/files/nslave.initd
new file mode 100644
index 000000000000..8683c8d23ccd
--- /dev/null
+++ b/dev-python/mwlib/files/nslave.initd
@@ -0,0 +1,27 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/mwlib/files/nslave.initd,v 1.1 2013/07/01 13:56:29 dev-zero Exp $
+
+description="nslave pulls new jobs from a mw-qserve instance"
+
+command="/usr/bin/nslave"
+command_args="--cachedir=${NSLAVE_CACHEDIR} \
+ --serve-files-address=${NSLAVE_ADDRESS} \
+ --serve-files-port=${NSLAVE_PORT} \
+ --url=${NSLAVE_URL} \
+ --numprocs=${NSLAVE_NUMPROCS}"
+
+pidfile="/var/run/${SVCNAME}.pid"
+command_background="yes"
+
+start_stop_daemon_args="--user ${NSLAVE_USER:-mwlib} \
+ --group ${NSLAVE_GROUP:-mwlib} \
+ ${NSLAVE_LOGFILE-:+-stderr ${NSLAVE_LOGFILE}} \
+ ${NSLAVE_LOGFILE:+--stdout ${NSLAVE_LOGFILE}} \
+ --umask ${NSLAVE_UMASK}"
+
+depend() {
+ need net localmount
+ use mw-qserve
+}
diff --git a/dev-python/mwlib/files/nslave.logrotate b/dev-python/mwlib/files/nslave.logrotate
new file mode 100644
index 000000000000..0637e248f2e7
--- /dev/null
+++ b/dev-python/mwlib/files/nslave.logrotate
@@ -0,0 +1,7 @@
+/var/log/mwlib/nslave.log {
+ su mwlib mwlib
+ missingok
+ postrotate
+ /etc/init.d/nslave restart > /dev/null 2>&1
+ endscript
+}
diff --git a/dev-python/mwlib/files/postman.confd b/dev-python/mwlib/files/postman.confd
new file mode 100644
index 000000000000..168627480dda
--- /dev/null
+++ b/dev-python/mwlib/files/postman.confd
@@ -0,0 +1,12 @@
+# The cache-directory to which the collections are saved, make sure you enter
+# the same directory as in /etc/conf.d/nslave
+POSTMAN_CACHEDIR="/var/cache/mwlib/"
+
+# The user running the postman service, defaults to 'mwlib'
+# POSTMAN_USER="mwlib"
+
+# The group running the postman service, defaults to 'mwlib'
+# POSTMAN_GROUP="mwlib"
+
+# The logfile collecting all output from stdout and stderr, comment out for no logging
+POSTMAN_LOGFILE="/var/log/mwlib/postman.log"
diff --git a/dev-python/mwlib/files/postman.initd b/dev-python/mwlib/files/postman.initd
new file mode 100644
index 000000000000..ef890c304713
--- /dev/null
+++ b/dev-python/mwlib/files/postman.initd
@@ -0,0 +1,21 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/mwlib/files/postman.initd,v 1.1 2013/07/01 13:56:29 dev-zero Exp $
+
+description="postman uploads zip collections to pediapress in case someone likes to order printed books"
+
+command="/usr/bin/postman"
+command_args="--cachedir=${POSTMAN_CACHDIR}"
+
+pidfile="/var/run/${SVCNAME}.pid"
+command_background="yes"
+
+start_stop_daemon_args="--user ${POSTMAN_USER:-mwlib} \
+ --group ${POSTMAN_GROUP:-mwlib} \
+ ${POSTMAN_LOGFILE:+--stderr ${POSTMAN_LOGFILE}} \
+ ${POSTMAN_LOGFILE:+--stdout ${POSTMAN_LOGFILE}}"
+
+depend() {
+ need net localmount
+}
diff --git a/dev-python/mwlib/files/postman.logrotate b/dev-python/mwlib/files/postman.logrotate
new file mode 100644
index 000000000000..50cbccda7df9
--- /dev/null
+++ b/dev-python/mwlib/files/postman.logrotate
@@ -0,0 +1,7 @@
+/var/log/mwlib/postman.log {
+ su mwlib mwlib
+ missingok
+ postrotate
+ /etc/init.d/postman restart > /dev/null 2>&1
+ endscript
+}
diff --git a/dev-python/mwlib/metadata.xml b/dev-python/mwlib/metadata.xml
index 4a7fe8562b0f..9db9111b0083 100644
--- a/dev-python/mwlib/metadata.xml
+++ b/dev-python/mwlib/metadata.xml
@@ -5,4 +5,7 @@
<upstream>
<remote-id type="pypi">mwlib</remote-id>
</upstream>
+ <use>
+ <flag name='server'>Install the daemons required when using mwlib for generating PDFs on a MediaWiki instance.</flag>
+ </use>
</pkgmetadata>
diff --git a/dev-python/mwlib/mwlib-0.15.8-r2.ebuild b/dev-python/mwlib/mwlib-0.15.8-r2.ebuild
new file mode 100644
index 000000000000..801e04f07b43
--- /dev/null
+++ b/dev-python/mwlib/mwlib-0.15.8-r2.ebuild
@@ -0,0 +1,121 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/mwlib/mwlib-0.15.8-r2.ebuild,v 1.1 2013/07/01 13:56:29 dev-zero Exp $
+
+EAPI=5
+
+PYTHON_COMPAT=( python{2_6,2_7} )
+
+inherit distutils-r1 user eutils
+
+DESCRIPTION="Tools for parsing Mediawiki content to other formats"
+HOMEPAGE="http://code.pediapress.com/wiki/wiki http://pypi.python.org/pypi/mwlib"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.zip"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc server"
+
+RDEPEND="dev-python/lxml[${PYTHON_USEDEP}]
+ =dev-python/odfpy-0.9*[${PYTHON_USEDEP}]
+ dev-python/pyPdf[${PYTHON_USEDEP}]
+ virtual/pyparsing[${PYTHON_USEDEP}]
+ dev-python/timelib[${PYTHON_USEDEP}]
+ virtual/latex-base
+ >=dev-python/simplejson-2.5[${PYTHON_USEDEP}]
+ dev-python/gevent[${PYTHON_USEDEP}]
+ >=dev-python/bottle-0.11.6[${PYTHON_USEDEP}]
+ dev-python/apipkg[${PYTHON_USEDEP}]
+ dev-python/qserve[${PYTHON_USEDEP}]
+ dev-python/roman[${PYTHON_USEDEP}]
+ dev-python/py[${PYTHON_USEDEP}]
+ dev-python/sqlite3dbm[${PYTHON_USEDEP}]
+ dev-python/pillow[${PYTHON_USEDEP}]
+ server? ( app-admin/sudo )"
+DEPEND="${RDEPEND}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ app-arch/unzip
+ doc? ( dev-python/sphinx )"
+
+# TODO: requires ploticus to generate timelines
+
+PATCHES=( "${FILESDIR}/${PV}-fix-tests.patch" "${FILESDIR}/${PV}-nslave-add-address-parameter.patch" )
+
+DOCS=(changelog.rst)
+
+pkg_setup() {
+ if use server ; then
+ enewgroup mwlib
+ enewuser mwlib -1 -1 -1 mwlib
+ fi
+}
+
+python_prepare_all() {
+ # mwlib.apipkg is actually used.
+ sed -e 's/, "apipkg"//' -i setup.py || die
+
+ # Execute odflint script.
+ sed \
+ -e "/def _get_odflint_module():/,/odflint = _get_odflint_module()/d" \
+ -e "s/odflint.lint(path)/os.system('odflint %s' % path)/" \
+ -i tests/test_odfwriter.py || die
+
+ # Disable test which requires installed mw-zip script.
+ rm -f tests/test_{nuwiki,redirect,zipwiki}.py
+ # Disable render test that fails for no apparent reason
+ rm -f tests/test_render.py
+
+ distutils-r1_python_prepare_all
+}
+
+python_compile() {
+ if [[ ${EPYTHON} == python2* ]] ; then
+ local CFLAGS="${CFLAGS} -fno-strict-aliasing"
+ export CFLAGS
+ fi
+
+ distutils-r1_python_compile
+}
+
+python_compile_all() {
+ use doc && emake -C docs html
+}
+
+python_test() {
+ py.test || die
+}
+
+python_install_all() {
+ use doc && local HTML_DOCS=( docs/_build/html/. )
+ distutils-r1_python_install_all
+
+ if use server ; then
+ keepdir /var/log/mwlib
+ keepdir /var/cache/mwlib
+
+ fowners mwlib:mwlib /var/log/mwlib /var/cache/mwlib
+ fperms 0750 /var/log/mwlib /var/cache/mwlib
+
+ insinto /etc/logrotate.d
+ for d in mw-qserve nserve nslave postman ; do
+ newins "${FILESDIR}/${d}.logrotate" "${d}"
+ newinitd "${FILESDIR}/${d}.initd" "${d}"
+ newconfd "${FILESDIR}/${d}.confd" "${d}"
+ done
+
+ insinto /etc/cron.d
+ newins "${FILESDIR}/mwlib-purge-cache.cron" "mwlib-purge-cache"
+ else
+ rm "${D}"/usr/bin/{mw-qserve,nserve,nslave,postman}* || die "removing binaries failed"
+ fi
+}
+
+pkg_postinst() {
+ elog "Please enable required image formats for dev-python/pillow"
+ if use server ; then
+ elog "A cronjob to cleanup the cache files got installed to"
+ elog " /etc/cron.d/mwlib-purge-cache"
+ elog "Default parameters are to clean every 24h, adjust it to your needs."
+ fi
+}