diff --git a/net-p2p/deluge/Manifest b/net-p2p/deluge/Manifest new file mode 100644 index 00000000..80be64c7 --- /dev/null +++ b/net-p2p/deluge/Manifest @@ -0,0 +1 @@ +DIST deluge-1.3.12.tar.bz2 1772567 SHA256 565745b2a3f0567fc007dbdfeea2aa96a6bebd7dbdda2ec932a3017c66613c93 SHA512 bcb909f70d407ec766a609a1525f48b0f0ce18217049ff05dfd03b3681bdc021a446afa265b288181c644b1e47c710f41d17b1244c3b991818b947a51b97eb74 WHIRLPOOL 683e6d197ee617646ffc716738c58f479df5dc05cfc20d8295c283f9b98da309490ec582becf0d584c28a957d8bcbf1dc7b9ab4b06879d1fd338bc88a0bda29b diff --git a/net-p2p/deluge/deluge-1.3.12.ebuild b/net-p2p/deluge/deluge-1.3.12.ebuild new file mode 100644 index 00000000..d42c92d8 --- /dev/null +++ b/net-p2p/deluge/deluge-1.3.12.ebuild @@ -0,0 +1,84 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +PYTHON_COMPAT=( python2_7 ) +DISTUTILS_SINGLE_IMPL=1 +inherit distutils-r1 eutils systemd + +DESCRIPTION="BitTorrent client with a client/server model" +HOMEPAGE="http://deluge-torrent.org/" + +if [[ ${PV} == 9999 ]]; then + inherit git-2 + EGIT_REPO_URI="git://deluge-torrent.org/${PN}.git + http://git.deluge-torrent.org/${PN}" + SRC_URI="" + KEYWORDS="" +else + SRC_URI="http://download.deluge-torrent.org/source/${P}.tar.bz2" + KEYWORDS="~amd64 ~arm ~ppc ~sparc ~x86" +fi + +LICENSE="GPL-2" +SLOT="0" +IUSE="geoip gtk libnotify setproctitle sound webinterface" + +DEPEND=">=net-libs/rb_libtorrent-0.14.9[python] + dev-util/intltool" +RDEPEND=">=net-libs/rb_libtorrent-0.14.9[python] + dev-python/chardet[${PYTHON_USEDEP}] + dev-python/pyopenssl[${PYTHON_USEDEP}] + dev-python/pyxdg[${PYTHON_USEDEP}] + >=dev-python/twisted-core-8.1[${PYTHON_USEDEP}] + >=dev-python/twisted-web-8.1[${PYTHON_USEDEP}] + geoip? ( dev-libs/geoip ) + gtk? ( + sound? ( dev-python/pygame[${PYTHON_USEDEP}] ) + dev-python/pygobject:2[${PYTHON_USEDEP}] + >=dev-python/pygtk-2.12[${PYTHON_USEDEP}] + gnome-base/librsvg + libnotify? ( dev-python/notify-python[${PYTHON_USEDEP}] ) + ) + setproctitle? ( dev-python/setproctitle[${PYTHON_USEDEP}] ) + webinterface? ( dev-python/mako[${PYTHON_USEDEP}] )" + +python_prepare_all() { + local PATCHES=( + "${FILESDIR}"/${PN}-1.3.5-disable_libtorrent_internal_copy.patch + ) + + distutils-r1_python_prepare_all +} + +_distutils-r1_create_setup_cfg() { + # bug 531370: deluge has its own plugin system. No need to relocate its egg info files. + # Override this call from the distutils-r1 eclass. + # This does not respect the distutils-r1 API. DONOT copy this example. + : +} + +python_install_all() { + distutils-r1_python_install_all + newinitd "${FILESDIR}"/deluged.init deluged + newconfd "${FILESDIR}"/deluged.conf deluged + systemd_dounit "${FILESDIR}"/deluged.service + systemd_dounit "${FILESDIR}"/deluge-web.service +} + +pkg_postinst() { + elog + elog "If after upgrading it doesn't work, please remove the" + elog "'~/.config/deluge' directory and try again, but make a backup" + elog "first!" + elog + elog "To start the daemon either run 'deluged' as user" + elog "or modify /etc/conf.d/deluged and run" + elog "/etc/init.d/deluged start as root" + elog "You can still use deluge the old way" + elog + elog "For more information look at http://dev.deluge-torrent.org/wiki/Faq" + elog +} diff --git a/net-p2p/deluge/files/deluge-1.3.5-disable_libtorrent_internal_copy.patch b/net-p2p/deluge/files/deluge-1.3.5-disable_libtorrent_internal_copy.patch new file mode 100644 index 00000000..235b7f7c --- /dev/null +++ b/net-p2p/deluge/files/deluge-1.3.5-disable_libtorrent_internal_copy.patch @@ -0,0 +1,42 @@ +--- setup.py ++++ setup.py +@@ -205,38 +205,7 @@ + + _ext_modules = [] + +-# Check for a system libtorrent and if found, then do not build the libtorrent extension +-build_libtorrent = True +-try: +- from deluge._libtorrent import lt +-except ImportError: +- build_libtorrent = True +-else: +- build_libtorrent = False +- +-if build_libtorrent: +- got_libtorrent = False +- if not os.path.exists("libtorrent"): +- import subprocess +- if subprocess.call(['./get_libtorrent.sh']) > 0: +- got_libtorrent = False +- else: +- got_libtorrent = True +- else: +- got_libtorrent = True +- +- if got_libtorrent: +- # There isn't a system libtorrent library, so let's build the one included with deluge +- libtorrent = Extension( +- 'libtorrent', +- extra_compile_args = _extra_compile_args, +- include_dirs = _include_dirs, +- libraries = _libraries, +- library_dirs = _library_dirs, +- sources = _sources +- ) +- +- _ext_modules = [libtorrent] ++import deluge._libtorrent + + desktop_data = 'deluge/data/share/applications/deluge.desktop' + diff --git a/net-p2p/deluge/files/deluge-1.3.5-rb_libtorrent-disable-python-bindings b/net-p2p/deluge/files/deluge-1.3.5-rb_libtorrent-disable-python-bindings new file mode 100644 index 00000000..301019e0 --- /dev/null +++ b/net-p2p/deluge/files/deluge-1.3.5-rb_libtorrent-disable-python-bindings @@ -0,0 +1,60 @@ +https://bugs.gentoo.org/show_bug.cgi?id=437356 + +From 37ea2854a21e50debdf7bc953a3411e5934b74d9 Mon Sep 17 00:00:00 2001 +From: Calum Lind +Date: Thu, 27 Sep 2012 16:53:22 +0000 +Subject: Fix 2160 : Disable use of python bindings for libtorrent extensions and replace with session flag + +The fixes a GIL issue causing libtorrent segfault. https://code.google.com/p/libtorrent/issues/detail?id=369 + +Note: The ut_pex plugin (Peer Exchange) will now always be enabled. +--- +diff --git a/deluge/core/core.py b/deluge/core/core.py +index 4bda811..4ca3d96 100644 +--- a/deluge/core/core.py ++++ b/deluge/core/core.py +@@ -84,7 +84,10 @@ class Core(component.Component): + while len(version) < 4: + version.append(0) + +- self.session = lt.session(lt.fingerprint("DE", *version), flags=0) ++ # Note: All libtorrent python bindings to set plugins/extensions need to be disabled ++ # due to GIL issue. https://code.google.com/p/libtorrent/issues/detail?id=369 ++ # Setting session flags to 1 enables all libtorrent default plugins ++ self.session = lt.session(lt.fingerprint("DE", *version), flags=1) + + # Load the session state if available + self.__load_session_state() +@@ -103,9 +106,11 @@ class Core(component.Component): + self.session.set_settings(self.settings) + + # Load metadata extension +- self.session.add_extension(lt.create_metadata_plugin) +- self.session.add_extension(lt.create_ut_metadata_plugin) +- self.session.add_extension(lt.create_smart_ban_plugin) ++ # Note: All libtorrent python bindings to set plugins/extensions need to be disabled ++ # due to GIL issue. https://code.google.com/p/libtorrent/issues/detail?id=369 ++ # self.session.add_extension(lt.create_metadata_plugin) ++ # self.session.add_extension(lt.create_ut_metadata_plugin) ++ # self.session.add_extension(lt.create_smart_ban_plugin) + + # Create the components + self.eventmanager = EventManager() +diff --git a/deluge/core/preferencesmanager.py b/deluge/core/preferencesmanager.py +index 40070bb..2a5cb1b 100644 +--- a/deluge/core/preferencesmanager.py ++++ b/deluge/core/preferencesmanager.py +@@ -338,7 +338,10 @@ class PreferencesManager(component.Component): + def _on_set_utpex(self, key, value): + log.debug("utpex value set to %s", value) + if value: +- self.session.add_extension(lt.create_ut_pex_plugin) ++ # Note: All libtorrent python bindings to set plugins/extensions need to be disabled ++ # due to GIL issue. https://code.google.com/p/libtorrent/issues/detail?id=369 ++ #self.session.add_extension(lt.create_ut_pex_plugin) ++ pass + + def _on_set_encryption(self, key, value): + log.debug("encryption value %s set to %s..", key, value) +-- +cgit v0.9.0.2 diff --git a/net-p2p/deluge/files/deluge-web.service b/net-p2p/deluge/files/deluge-web.service new file mode 100644 index 00000000..426401a9 --- /dev/null +++ b/net-p2p/deluge/files/deluge-web.service @@ -0,0 +1,11 @@ +[Unit] +Description=Deluge WebUI +After=deluged.service + +[Service] +User=deluge +ExecStart=/usr/bin/deluge-web + +[Install] +WantedBy=multi-user.target + diff --git a/net-p2p/deluge/files/deluged.conf b/net-p2p/deluge/files/deluged.conf new file mode 100644 index 00000000..0918f45f --- /dev/null +++ b/net-p2p/deluge/files/deluged.conf @@ -0,0 +1,8 @@ +# /etc/conf.d/deluged +# Change this to the user you want to run deluged as. +# You may specify a group too, after a colon +DELUGED_USER="" +# DELUGED_OPTS="-p 58846" +DELUGEUI_START="false" +DELUGEUI_OPTS="-u web" + diff --git a/net-p2p/deluge/files/deluged.init b/net-p2p/deluge/files/deluged.init new file mode 100644 index 00000000..e60945df --- /dev/null +++ b/net-p2p/deluge/files/deluged.init @@ -0,0 +1,71 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# $Id$ + +depend() { + need net +} + +checkconfig() { + if [ "${DELUGED_USER}" = "" ] ; then + eerror "Please edit /etc/conf.d/deluged" + eerror "You have to specify a user to run deluged as, as we will not run it as root!" + eerror "Modify DELUGED_USER to your needs (you can also add a group, after a colon)" + return 1 + fi + if ! getent passwd "${DELUGED_USER%:*}" >/dev/null ; then + eerror "Please edit /etc/conf.d/deluged" + eerror "Your user has to exist!" + return 1 + fi + if [ "${DELUGED_USER%:*}" = "${DELUGED_USER}" ] ; then + return 0 + else + if ! getent group "${DELUGED_USER#*:}" >/dev/null ; then + eerror "Please edit /etc/conf.d/deluged" + eerror "Your group has to exist too!" + return 1 + fi + fi + return 0 +} + +start() { + checkconfig || return $? + if [ "${DELUGED_HOME}" = "" ] ; then + DELUGED_USER_HOME=$(getent passwd "${DELUGED_USER%:*}" | cut -d ':' -f 6) + else + DELUGED_USER_HOME=${DELUGED_HOME} + fi + ebegin "Starting Deluged" + start-stop-daemon --start --user "${DELUGED_USER%:*}" \ + --name deluged --pidfile /var/run/deluged.pid --background --make-pidfile \ + --exec /usr/bin/deluged -e HOME="${DELUGED_USER_HOME}" -- --do-not-daemonize "${DELUGED_OPTS}" + eend $? + + + if [ "${DELUGEUI_START}" = "true" ] ; then + ebegin "Starting Deluge" + start-stop-daemon --start --background --pidfile \ + /var/run/deluge.pid --make-pidfile \ + --exec /usr/bin/deluge --user "${DELUGED_USER%:*}" \ + -e HOME="${DELUGED_USER_HOME}" -- ${DELUGEUI_OPTS} + eend $? + fi +} + +stop() { + ebegin "Stopping Deluged" + start-stop-daemon --stop --user "${DELUGED_USER%:*}" \ + --name deluged --pidfile /var/run/deluged.pid + eend $? + + + if [ "${DELUGEUI_START}" = "true" ] ; then + ebegin "Stopping Deluge" + start-stop-daemon --stop --user "${DELUGED_USER%:*}" \ + --name deluge --pidfile /var/run/deluge.pid + eend $? + fi +} diff --git a/net-p2p/deluge/files/deluged.service b/net-p2p/deluge/files/deluged.service new file mode 100644 index 00000000..74876b00 --- /dev/null +++ b/net-p2p/deluge/files/deluged.service @@ -0,0 +1,13 @@ +[Unit] +Description=Deluge BitTorrent client +After=network.target local-fs.target +Wants=local-fs.target + +[Service] +EnvironmentFile=/etc/conf.d/deluged +User=deluge +Group=deluge +ExecStart=/usr/bin/deluged -d -p $DELUGED_PORT $DELUGED_OPTIONS + +[Install] +WantedBy=multi-user.target