1 |
commit: eaceccfa7548d133e33add079ba76618a39730f8 |
2 |
Author: Paolo Pedroni <paolo.pedroni <AT> iol <DOT> it> |
3 |
AuthorDate: Mon Nov 7 15:23:07 2022 +0000 |
4 |
Commit: Craig Andrews <candrews <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Nov 7 15:35:23 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eaceccfa |
7 |
|
8 |
net-p2p/deluge: Fix deluge-web execution with twisted-22.10.0 |
9 |
|
10 |
Closes: https://bugs.gentoo.org/879351 |
11 |
Signed-off-by: Paolo Pedroni <paolo.pedroni <AT> iol.it> |
12 |
Closes: https://github.com/gentoo/gentoo/pull/28167 |
13 |
Signed-off-by: Craig Andrews <candrews <AT> gentoo.org> |
14 |
|
15 |
net-p2p/deluge/deluge-2.1.1-r1.ebuild | 171 +++++++++++++++++++++ |
16 |
.../deluge/files/deluge-2.1.1-twisted-22.10.patch | 31 ++++ |
17 |
2 files changed, 202 insertions(+) |
18 |
|
19 |
diff --git a/net-p2p/deluge/deluge-2.1.1-r1.ebuild b/net-p2p/deluge/deluge-2.1.1-r1.ebuild |
20 |
new file mode 100644 |
21 |
index 000000000000..49f330c238b3 |
22 |
--- /dev/null |
23 |
+++ b/net-p2p/deluge/deluge-2.1.1-r1.ebuild |
24 |
@@ -0,0 +1,171 @@ |
25 |
+# Copyright 1999-2022 Gentoo Authors |
26 |
+# Distributed under the terms of the GNU General Public License v2 |
27 |
+ |
28 |
+EAPI=8 |
29 |
+ |
30 |
+PYTHON_COMPAT=( python3_{8..10} ) |
31 |
+DISTUTILS_USE_PEP517=setuptools |
32 |
+DISTUTILS_SINGLE_IMPL=1 |
33 |
+inherit distutils-r1 systemd xdg |
34 |
+ |
35 |
+DESCRIPTION="BitTorrent client with a client/server model" |
36 |
+HOMEPAGE="https://deluge-torrent.org/" |
37 |
+ |
38 |
+if [[ ${PV} == 9999 ]]; then |
39 |
+ inherit git-r3 |
40 |
+ EGIT_REPO_URI="https://git.deluge-torrent.org/${PN}" |
41 |
+else |
42 |
+ SRC_URI="http://download.deluge-torrent.org/source/$(ver_cut 1-2)/${P}.tar.xz" |
43 |
+ KEYWORDS="amd64 ~arm ~arm64 ~ppc ~riscv x86" |
44 |
+fi |
45 |
+ |
46 |
+LICENSE="GPL-2" |
47 |
+SLOT="0" |
48 |
+IUSE="console gui libnotify sound webinterface" |
49 |
+REQUIRED_USE=" |
50 |
+ ${PYTHON_REQUIRED_USE} |
51 |
+ libnotify? ( gui ) |
52 |
+ sound? ( gui ) |
53 |
+" |
54 |
+ |
55 |
+BDEPEND=" |
56 |
+ dev-util/intltool |
57 |
+ test? ( |
58 |
+ $(python_gen_cond_dep ' |
59 |
+ >=dev-python/pytest-twisted-1.13.4-r1[${PYTHON_USEDEP}] |
60 |
+ ') |
61 |
+ ) |
62 |
+" |
63 |
+ |
64 |
+RDEPEND=" |
65 |
+ acct-group/deluge |
66 |
+ acct-user/deluge |
67 |
+ net-libs/libtorrent-rasterbar:=[python,${PYTHON_SINGLE_USEDEP}] |
68 |
+ $(python_gen_cond_dep ' |
69 |
+ gui? ( |
70 |
+ sound? ( dev-python/pygame[${PYTHON_USEDEP}] ) |
71 |
+ dev-python/pygobject:3[${PYTHON_USEDEP}] |
72 |
+ gnome-base/librsvg |
73 |
+ libnotify? ( x11-libs/libnotify ) |
74 |
+ ) |
75 |
+ dev-python/chardet[${PYTHON_USEDEP}] |
76 |
+ dev-python/distro[${PYTHON_USEDEP}] |
77 |
+ dev-python/pillow[${PYTHON_USEDEP}] |
78 |
+ dev-python/pyopenssl[${PYTHON_USEDEP}] |
79 |
+ dev-python/pyxdg[${PYTHON_USEDEP}] |
80 |
+ dev-python/rencode[${PYTHON_USEDEP}] |
81 |
+ dev-python/setproctitle[${PYTHON_USEDEP}] |
82 |
+ || ( |
83 |
+ >=dev-python/twisted-17.1.0[ssl(-),${PYTHON_USEDEP}] |
84 |
+ >=dev-python/twisted-17.1.0[crypt(-),${PYTHON_USEDEP}] |
85 |
+ ) |
86 |
+ >=dev-python/zope-interface-4.4.2[${PYTHON_USEDEP}] |
87 |
+ dev-python/mako[${PYTHON_USEDEP}] |
88 |
+ ') |
89 |
+" |
90 |
+ |
91 |
+PATCHES=( "${FILESDIR}/${P}-twisted-22.10.patch" ) |
92 |
+ |
93 |
+distutils_enable_tests pytest |
94 |
+ |
95 |
+python_prepare_all() { |
96 |
+ local args=( |
97 |
+ -e 's|"new_release_check": True|"new_release_check": False|' |
98 |
+ -e 's|"check_new_releases": True|"check_new_releases": False|' |
99 |
+ -e 's|"show_new_releases": True|"show_new_releases": False|' |
100 |
+ ) |
101 |
+ sed -i "${args[@]}" -- 'deluge/core/preferencesmanager.py' || die |
102 |
+ |
103 |
+ distutils-r1_python_prepare_all |
104 |
+} |
105 |
+ |
106 |
+python_test() { |
107 |
+ local EPYTEST_IGNORE=( |
108 |
+ # Upstream CI/CD skips these and they seem to intentionally segfault to collect core dumps... |
109 |
+ deluge/plugins/Stats/deluge_stats/tests/test_stats.py |
110 |
+ # Skipped upstream |
111 |
+ deluge/tests/test_security.py |
112 |
+ ) |
113 |
+ local EPYTEST_DESELECT=( |
114 |
+ # Skipped upstream |
115 |
+ 'deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py::TestWebUIPlugin::test_enable_webui' |
116 |
+ 'deluge/tests/test_torrent.py::TestTorrent::test_torrent_error_resume_data_unaltered' |
117 |
+ 'deluge/tests/test_tracker_icons.py::TestTrackerIcons::test_get_seo_svg_with_sni' |
118 |
+ # never returns |
119 |
+ 'deluge/tests/test_ui_entry.py::TestConsoleScriptEntryWithDaemon' |
120 |
+ # failing network(?)-related tests, even with sandbox disabled |
121 |
+ 'deluge/tests/test_common.py::TestCommon::test_is_interface' |
122 |
+ # fails |
123 |
+ 'deluge/tests/test_core.py::TestCore::test_pause_torrents' |
124 |
+ # fails because of network sandbox |
125 |
+ 'deluge/tests/test_core.py::TestCore::test_test_listen_port' |
126 |
+ 'deluge/tests/test_tracker_icons.py::TestTrackerIcons::test_get_deluge_png' |
127 |
+ 'deluge/tests/test_tracker_icons.py::TestTrackerIcons::test_get_google_ico' |
128 |
+ 'deluge/tests/test_tracker_icons.py::TestTrackerIcons::test_get_google_ico_hebrew' |
129 |
+ 'deluge/tests/test_tracker_icons.py::TestTrackerIcons::test_get_google_ico_with_redirect' |
130 |
+ # segfaults with FEATURES="network-sandbox" |
131 |
+ 'deluge/tests/test_core.py::TestCore::test_pause_torrent' |
132 |
+ ) |
133 |
+ |
134 |
+ # dev-python/pytest-twisted has disabled autoloading |
135 |
+ epytest -m "not (todo or gtkui)" -p pytest_twisted -v |
136 |
+} |
137 |
+ |
138 |
+python_install_all() { |
139 |
+ distutils-r1_python_install_all |
140 |
+ if ! use console ; then |
141 |
+ rm -r "${D}/$(python_get_sitedir)/deluge/ui/console/" || die |
142 |
+ rm "${ED}/usr/bin/deluge-console" || die |
143 |
+ rm "${ED}/usr/share/man/man1/deluge-console.1" ||die |
144 |
+ fi |
145 |
+ if ! use gui ; then |
146 |
+ rm -r "${D}/$(python_get_sitedir)/deluge/ui/gtk3/" || die |
147 |
+ rm -r "${ED}/usr/share/icons/" || die |
148 |
+ rm "${ED}/usr/bin/deluge-gtk" || die |
149 |
+ rm "${ED}/usr/share/man/man1/deluge-gtk.1" || die |
150 |
+ else |
151 |
+ mkdir -p "${ED}/usr/share/applications/" || die |
152 |
+ cp "${WORKDIR}/${P}/deluge/ui/data/share/applications/deluge.desktop" "${ED}/usr/share/applications/" || die |
153 |
+ mkdir -p "${ED}/usr/share/metainfo" || die |
154 |
+ cp "${WORKDIR}/${P}/deluge/ui/data/share/appdata/deluge.appdata.xml" "${ED}/usr/share/metainfo/" || die |
155 |
+ fi |
156 |
+ |
157 |
+ if use webinterface; then |
158 |
+ newinitd "${FILESDIR}/deluge-web.init-2" deluge-web |
159 |
+ newconfd "${FILESDIR}/deluge-web.conf" deluge-web |
160 |
+ systemd_newunit "${FILESDIR}/deluge-web.service-3" deluge-web.service |
161 |
+ systemd_install_serviced "${FILESDIR}/deluge-web.service.conf" |
162 |
+ else |
163 |
+ rm -r "${D}/$(python_get_sitedir)/deluge/ui/web/" || die |
164 |
+ rm "${ED}/usr/bin/deluge-web" || die |
165 |
+ rm "${ED}/usr/share/man/man1/deluge-web.1" || die |
166 |
+ fi |
167 |
+ |
168 |
+ newinitd "${FILESDIR}"/deluged.init-2 deluged |
169 |
+ newconfd "${FILESDIR}"/deluged.conf-2 deluged |
170 |
+ systemd_newunit "${FILESDIR}"/deluged.service-2 deluged.service |
171 |
+ systemd_install_serviced "${FILESDIR}"/deluged.service.conf |
172 |
+ |
173 |
+ python_optimize |
174 |
+} |
175 |
+ |
176 |
+pkg_postinst() { |
177 |
+ xdg_pkg_postinst |
178 |
+ |
179 |
+ elog |
180 |
+ elog "If, after upgrading, deluge doesn't work please back up and then" |
181 |
+ elog "remove your '~/.config/deluge' directory and try again" |
182 |
+ elog |
183 |
+ elog "To start the daemon either run 'deluged' as user" |
184 |
+ elog "or modify /etc/conf.d/deluged and run" |
185 |
+ elog "/etc/init.d/deluged start as root" |
186 |
+ elog "You can still use deluge the old way" |
187 |
+ elog |
188 |
+ elog "Systemd unit files for deluged and deluge-web no longer source" |
189 |
+ elog "/etc/conf.d/deluge* files. Environment variable customization now" |
190 |
+ elog "happens in /etc/systemd/system/deluged.service.d/00gentoo.conf" |
191 |
+ elog "and /etc/systemd/system/deluge-web.service.d/00gentoo.conf" |
192 |
+ elog |
193 |
+ elog "For more information see https://dev.deluge-torrent.org/wiki/Faq" |
194 |
+ elog |
195 |
+} |
196 |
|
197 |
diff --git a/net-p2p/deluge/files/deluge-2.1.1-twisted-22.10.patch b/net-p2p/deluge/files/deluge-2.1.1-twisted-22.10.patch |
198 |
new file mode 100644 |
199 |
index 000000000000..689721e76266 |
200 |
--- /dev/null |
201 |
+++ b/net-p2p/deluge/files/deluge-2.1.1-twisted-22.10.patch |
202 |
@@ -0,0 +1,31 @@ |
203 |
+From 29dd0fcf8a6b6256d111b2ceb67798ae73c3e0b1 Mon Sep 17 00:00:00 2001 |
204 |
+From: DjLegolas <djlegolas@××××××××××.com> |
205 |
+Date: Mon, 7 Nov 2022 01:05:55 +0200 |
206 |
+Subject: [PATCH] [WebUI] Fix `TypeError` in DelugeWeb constractor |
207 |
+ |
208 |
+In `twisted 22.10`, a check new for passing the `path` variable as |
209 |
+`bytes` in the `putChild` method. |
210 |
+We were enforcing this on every other place but the `__init__` of |
211 |
+`DelugeWeb` itself. |
212 |
+ |
213 |
+Ref: https://github.com/twisted/twisted/pull/11718 |
214 |
+Closes: https://dev.deluge-torrent.org/ticket/3566 |
215 |
+--- |
216 |
+ deluge/ui/web/server.py | 4 +++- |
217 |
+ 1 file changed, 3 insertions(+), 1 deletion(-) |
218 |
+ |
219 |
+diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py |
220 |
+index f391a78d27..020cf9ef4f 100644 |
221 |
+--- a/deluge/ui/web/server.py |
222 |
++++ b/deluge/ui/web/server.py |
223 |
+@@ -682,7 +682,9 @@ def __init__(self, options=None, daemon=True): |
224 |
+ |
225 |
+ if self.base != '/': |
226 |
+ # Strip away slashes and serve on the base path as well as root path |
227 |
+- self.top_level.putChild(self.base.strip('/'), self.top_level) |
228 |
++ self.top_level.putChild( |
229 |
++ self.base.strip('/').encode('utf-8'), self.top_level |
230 |
++ ) |
231 |
+ |
232 |
+ setup_translation() |
233 |
+ |