From 9878fe8fb70af6626e62608ac86ed73479358c6b Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Sun, 20 Nov 2011 22:14:48 +0000 Subject: [PATCH] Added pyload --- net-misc/pyload/Manifest | 3 + net-misc/pyload/files/pyload | 23 +++++ net-misc/pyload/pyload-0.4.7.ebuild | 146 ++++++++++++++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 net-misc/pyload/Manifest create mode 100644 net-misc/pyload/files/pyload create mode 100644 net-misc/pyload/pyload-0.4.7.ebuild diff --git a/net-misc/pyload/Manifest b/net-misc/pyload/Manifest new file mode 100644 index 0000000..221301f --- /dev/null +++ b/net-misc/pyload/Manifest @@ -0,0 +1,3 @@ +AUX pyload 382 RMD160 f8574569ac91034a82ba0850de74b3d406ec0ff2 SHA1 612d6942145352a6f929ac3039612d65f6238425 SHA256 fab733b232a0591f1427175f688dc4171f87bbea2c506b23291fb4742e228196 +DIST pyload-src-v0.4.7.zip 1303376 RMD160 b607e28aa656a0235435c350881fa12e293856cc SHA1 503bb30a71446e30f30e375dc294c14c1963ab51 SHA256 b1cc2a2a2e47f37d607f4ebc4fb3b655e8b04c50fe75e36fd6949da4957e5c98 +EBUILD pyload-0.4.7.ebuild 3201 RMD160 03843f5cfdf7c7d3ac0bd33fefeccd29a566d0f5 SHA1 9b9db56d9198023faaab71286a11873987568d53 SHA256 8b739fdb089e0dc50429ecce798392e3ef41188997292d42cc2e5b18ee4cf58b diff --git a/net-misc/pyload/files/pyload b/net-misc/pyload/files/pyload new file mode 100644 index 0000000..9d2e610 --- /dev/null +++ b/net-misc/pyload/files/pyload @@ -0,0 +1,23 @@ +#!/sbin/runscript + +NAME="PyLoad Daemon" +PIDFILE=/var/run/pyload.pid + +depend() { + need net +} + +start() { + ebegin "Starting PyLoad" + start-stop-daemon --start --quiet --background \ + --pidfile ${PIDFILE} \ + --exec /usr/bin/env python2 /opt/pyload/pyLoadCore.py -- + eend $? +} + +stop() { + ebegin "Stopping PyLoad" + start-stop-daemon --stop --quiet \ + --pidfile ${PIDFILE} + eend $? +} diff --git a/net-misc/pyload/pyload-0.4.7.ebuild b/net-misc/pyload/pyload-0.4.7.ebuild new file mode 100644 index 0000000..01bc966 --- /dev/null +++ b/net-misc/pyload/pyload-0.4.7.ebuild @@ -0,0 +1,146 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=3 + +PYTHON_DEPEND="2" +PYTHON_USE_WITH="sqlite" + +inherit base eutils python systemd + +if [[ ${PV} == *9999 ]]; then + EHG_REPO_URI="http://bitbucket.org/spoob/pyload/" + inherit mercurial +else + SRC_URI="http://get.pyload.org/static/${PN}-src-v${PV}.zip" + KEYWORDS="~amd64 ~x86" +fi +DESCRIPTION="A fast, lightweight and full featured download manager for many One-Click-Hosters." +HOMEPAGE="http://www.pyload.org" +LICENSE="GPL-3" +SLOT="0" +IUSE="captcha clicknload container curl qt4 rar ssl systemd" + +DEPEND="app-arch/unzip" + +RDEPEND="${DEPEND} + dev-python/beautifulsoup + dev-python/beaker + dev-python/feedparser + dev-python/simplejson + captcha? ( + dev-python/imaging + app-text/tesseract + ) + clicknload? ( + || ( + dev-lang/spidermonkey + dev-java/rhino + ) + ) + container? ( dev-python/pycrypto ) + curl? ( dev-python/pycurl ) + qt4? ( dev-python/PyQt4 ) + rar? ( app-arch/unrar ) + ssl? ( + dev-python/pycrypto + dev-python/pyopenssl + )" +#clicknload? ( || ( ... ossp-js pyv8 ) ) + +S=${WORKDIR}/${PN} + +PYLOAD_WORKDIR=/var/lib/pyload # (/var/lib/ in lack of a better place) + +pkg_setup() { + python_pkg_setup + +# enewuser pyload -1 -1 ${PYLOAD_WORKDIR} +} + +src_unpack() { + if [[ ${PV} == *9999 ]]; then + mercurial_src_unpack + else + default + #base_src_unpack + fi +} + +src_prepare() { + # fix pidfile + sed -i -e 's:self.pidfile = "pyload.pid":self.pidfile = "/var/run/pyload.pid":' ${S}/pyLoadCore.py + + # fix workdir + echo ${PYLOAD_WORKDIR} > ${S}/module/config/configdir + + # replace some shipped dependencies with the system libraries + rm -r \ + ${S}/module/lib/BeautifulSoup.py \ + ${S}/module/lib/beaker \ + ${S}/module/lib/feedparser.py \ + ${S}/module/lib/simplejson + + find ${S}/module/ -name "*.py" -type f -print0 | xargs -0 \ + sed -i \ + -e 's:from module.lib.BeautifulSoup:from BeautifulSoup:' \ + -e 's:from module.lib \(import feedparser.*\):\1:' \ + -e 's:from module.lib.simplejson:from simplejson:' \ + #${S}/module/**/*.py # globbing not working -> find + + + if ! use qt4; then + rm -r ${S}/module/gui + fi +} + +src_configure() { + : +} + +src_compile() { + : +} + +src_install() { + insinto /opt/${PN} + doins -r ${S}/locale + doins -r ${S}/module + doins -r ${S}/scripts + doins ${S}/pyLoadCore.py + doins ${S}/pyLoadCli.py + + make_wrapper pyloadcli /opt/${PN}/pyLoadCli.py + + if use qt4; then + doins -r ${S}/icons + make_wrapper pyloadgui /opt/${PN}/pyLoadGui.py + fi + + dodir ${PYLOAD_WORKDIR} + # install default config + if ! test -f ${PYLOAD_WORKDIR}/pyload.conf; then + cp ${S}/module/config/default.conf ${D}/${PYLOAD_WORKDIR}/pyload.conf + fi + + #fix tmpdir + ln -sf /tmp ${D}/${PYLOAD_WORKDIR}/tmp + + newinitd ${FILESDIR}/pyload pyload + + if use systemd; then + systemd_dounit ${FILESDIR}/pyload.service + fi +} + +pkg_postinst() { + if use ssl && ! test -f ${PYLOAD_WORKDIR}/ssl.key; then + einfo "If you want to use pyLoad's XML-RPC via SSL have to create a key in pyloads work directory" + echo + einfo "cd ${PYLOAD_WORKDIR}" + einfo "openssl genrsa 1024 > ssl.key" + einfo "openssl req -new -key ssl.key -out ssl.csr" + einfo "openssl req -days 36500 -x509 -key ssl.key -in ssl.csr > ssl.crt" + fi +}