1 |
commit: b18c65f6d5aca4149c87c62e2b82d529adebadda |
2 |
Author: Marek Szuba <marecki <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 7 11:40:14 2022 +0000 |
4 |
Commit: Marek Szuba <marecki <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 7 12:26:03 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b18c65f6 |
7 |
|
8 |
net-libs/xrootd: use distutils-r1 to handle Python bindings |
9 |
|
10 |
Now we can finally install the bindings for multiple Python implementations! |
11 |
|
12 |
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org> |
13 |
|
14 |
.../files/xrootd-5.4.3-cmake_no_python.patch | 15 ++ |
15 |
.../files/xrootd-5.4.3-python_tests_py3.patch | 169 ++++++++++++++++++++ |
16 |
net-libs/xrootd/xrootd-5.4.3-r2.ebuild | 173 +++++++++++++++++++++ |
17 |
3 files changed, 357 insertions(+) |
18 |
|
19 |
diff --git a/net-libs/xrootd/files/xrootd-5.4.3-cmake_no_python.patch b/net-libs/xrootd/files/xrootd-5.4.3-cmake_no_python.patch |
20 |
new file mode 100644 |
21 |
index 000000000000..04607cdd7b04 |
22 |
--- /dev/null |
23 |
+++ b/net-libs/xrootd/files/xrootd-5.4.3-cmake_no_python.patch |
24 |
@@ -0,0 +1,15 @@ |
25 |
+--- a/bindings/python/CMakeLists.txt |
26 |
++++ b/bindings/python/CMakeLists.txt |
27 |
+@@ -32,6 +32,7 @@ |
28 |
+ |
29 |
+ configure_file(${SETUP_PY_IN} ${SETUP_PY}) |
30 |
+ |
31 |
++if (0) |
32 |
+ string(FIND "${PIP_OPTIONS}" "--prefix" PIP_OPTIONS_PREFIX_POSITION) |
33 |
+ if( "${PIP_OPTIONS_PREFIX_POSITION}" EQUAL "-1" ) |
34 |
+ string(APPEND PIP_OPTIONS " --prefix \$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}") |
35 |
+@@ -100,3 +101,4 @@ |
36 |
+ )" |
37 |
+ ) |
38 |
+ endif() |
39 |
++endif() |
40 |
|
41 |
diff --git a/net-libs/xrootd/files/xrootd-5.4.3-python_tests_py3.patch b/net-libs/xrootd/files/xrootd-5.4.3-python_tests_py3.patch |
42 |
new file mode 100644 |
43 |
index 000000000000..e20e45309e39 |
44 |
--- /dev/null |
45 |
+++ b/net-libs/xrootd/files/xrootd-5.4.3-python_tests_py3.patch |
46 |
@@ -0,0 +1,169 @@ |
47 |
+--- a/bindings/python/tests/test_copy.py |
48 |
++++ b/bindings/python/tests/test_copy.py |
49 |
+@@ -61,15 +61,15 @@ |
50 |
+ |
51 |
+ class TestProgressHandler(object): |
52 |
+ def begin(self, id, total, source, target): |
53 |
+- print '+++ begin(): %d, total: %d' % (id, total) |
54 |
+- print '+++ source: %s' % source |
55 |
+- print '+++ target: %s' % target |
56 |
++ print('+++ begin(): %d, total: %d' % (id, total)) |
57 |
++ print('+++ source: %s' % source) |
58 |
++ print('+++ target: %s' % target) |
59 |
+ |
60 |
+ def end(self, jobId, status): |
61 |
+- print '+++ end(): jobId: %s, status: %s' % (jobId, status) |
62 |
++ print('+++ end(): jobId: %s, status: %s' % (jobId, status)) |
63 |
+ |
64 |
+ def update(self, jobId, processed, total): |
65 |
+- print '+++ update(): jobid: %s, processed: %d, total: %d' % (jobId, processed, total) |
66 |
++ print('+++ update(): jobid: %s, processed: %d, total: %d' % (jobId, processed, total)) |
67 |
+ |
68 |
+ def test_copy_progress_handler(): |
69 |
+ c = client.CopyProcess() |
70 |
+--- a/bindings/python/tests/test_file.py |
71 |
++++ b/bindings/python/tests/test_file.py |
72 |
+@@ -289,9 +289,9 @@ |
73 |
+ for i, l in enumerate(lines): |
74 |
+ total += len(l) |
75 |
+ if l != pylines[i]: |
76 |
+- print '!!!!!', total, i |
77 |
+- print '+++++ py: %r' % pylines[i] |
78 |
+- print '+++++ me: %r' % l |
79 |
++ print('!!!!!', total, i) |
80 |
++ print('+++++ py: %r' % pylines[i]) |
81 |
++ print('+++++ me: %r' % l) |
82 |
+ break |
83 |
+ if pylines[i].endswith('\n'): |
84 |
+ assert l.endswith('\n') |
85 |
+--- a/bindings/python/tests/test_filesystem.py |
86 |
++++ b/bindings/python/tests/test_filesystem.py |
87 |
+@@ -37,20 +37,20 @@ |
88 |
+ status, response = f.open(smallfile, OpenFlags.NEW) |
89 |
+ |
90 |
+ for func, args, hasReturnObject in funcspecs: |
91 |
+- async(func, args, hasReturnObject) |
92 |
++ run_async(func, args, hasReturnObject) |
93 |
+ |
94 |
+ def sync(func, args, hasReturnObject): |
95 |
+ status, response = func(*args) |
96 |
+- print status |
97 |
++ print(status) |
98 |
+ assert status.ok |
99 |
+ if hasReturnObject: |
100 |
+- print response |
101 |
++ print(response) |
102 |
+ assert response |
103 |
+ |
104 |
+-def async(func, args, hasReturnObject): |
105 |
++def run_async(func, args, hasReturnObject): |
106 |
+ handler = AsyncResponseHandler() |
107 |
+ status = func(callback=handler, *args) |
108 |
+- print status |
109 |
++ print(status) |
110 |
+ assert status.ok |
111 |
+ status, response, hostlist = handler.wait() |
112 |
+ |
113 |
+@@ -60,7 +60,7 @@ |
114 |
+ |
115 |
+ for host in hostlist: |
116 |
+ assert host.url |
117 |
+- print host.url |
118 |
++ print(host.url) |
119 |
+ |
120 |
+ if hasReturnObject: |
121 |
+ assert response |
122 |
+@@ -79,7 +79,7 @@ |
123 |
+ |
124 |
+ try: |
125 |
+ os.remove('/tmp/eggs') |
126 |
+- except OSError, __: |
127 |
++ except OSError as __: |
128 |
+ pass |
129 |
+ |
130 |
+ def test_locate_sync(): |
131 |
+@@ -127,7 +127,7 @@ |
132 |
+ |
133 |
+ for item in response: |
134 |
+ assert item.name |
135 |
+- print item.statinfo |
136 |
++ print(item.statinfo) |
137 |
+ assert item.statinfo |
138 |
+ assert item.hostaddr |
139 |
+ |
140 |
+@@ -143,11 +143,11 @@ |
141 |
+ assert status.ok |
142 |
+ |
143 |
+ for h in hostlist: |
144 |
+- print h.url |
145 |
++ print(h.url) |
146 |
+ |
147 |
+ for item in response: |
148 |
+ assert item.name |
149 |
+- print item.statinfo |
150 |
++ print(item.statinfo) |
151 |
+ assert item.statinfo |
152 |
+ assert item.hostaddr |
153 |
+ |
154 |
+@@ -158,7 +158,7 @@ |
155 |
+ status, response = c.query(QueryCode.STATS, 'a') |
156 |
+ assert status.ok |
157 |
+ assert response |
158 |
+- print response |
159 |
++ print(response) |
160 |
+ |
161 |
+ def test_query_async(): |
162 |
+ c = client.FileSystem(SERVER_URL) |
163 |
+@@ -169,7 +169,7 @@ |
164 |
+ status, response, hostlist = handler.wait() |
165 |
+ assert status.ok |
166 |
+ assert response |
167 |
+- print response |
168 |
++ print(response) |
169 |
+ |
170 |
+ def test_mkdir_flags(): |
171 |
+ c = client.FileSystem(SERVER_URL) |
172 |
+--- a/bindings/python/tests/test_glob.py |
173 |
++++ b/bindings/python/tests/test_glob.py |
174 |
+@@ -2,7 +2,7 @@ |
175 |
+ import os |
176 |
+ import glob as norm_glob |
177 |
+ import XRootD.client.glob_funcs as glob |
178 |
+-from pathlib2 import Path |
179 |
++from pathlib import Path |
180 |
+ |
181 |
+ |
182 |
+ @pytest.fixture |
183 |
+@@ -13,7 +13,7 @@ |
184 |
+ subdir2.mkdir() |
185 |
+ for i in range(3): |
186 |
+ dummy = subdir1 / ("a_file_%d.txt" % i) |
187 |
+- dummy.write_text(u"This is file %d\n" % i, encoding="utf-8") |
188 |
++ dummy.write_text("This is file %d\n" % i, encoding="utf-8") |
189 |
+ return tmpdir |
190 |
+ |
191 |
+ |
192 |
+--- a/bindings/python/tests/test_threads.py |
193 |
++++ b/bindings/python/tests/test_threads.py |
194 |
+@@ -15,10 +15,10 @@ |
195 |
+ s, _ = self.file.write(smallbuffer) |
196 |
+ assert s.ok |
197 |
+ |
198 |
+- print '+++ thread %d says: %s' % (self.id, self.file.read()) |
199 |
++ print('+++ thread %d says: %s' % (self.id, self.file.read())) |
200 |
+ |
201 |
+ for line in self.file: |
202 |
+- print '+++ thread %d says: %s' % (self.id, line) |
203 |
++ print('+++ thread %d says: %s' % (self.id, line)) |
204 |
+ |
205 |
+ self.file.close() |
206 |
+ |
207 |
+@@ -28,7 +28,7 @@ |
208 |
+ # assert f.is_open() |
209 |
+ # f.write(smallbuffer) |
210 |
+ |
211 |
+- for i in xrange(3): |
212 |
++ for i in range(3): |
213 |
+ tt = TestThread(f, i) |
214 |
+ tt.start() |
215 |
+ tt.join() |
216 |
|
217 |
diff --git a/net-libs/xrootd/xrootd-5.4.3-r2.ebuild b/net-libs/xrootd/xrootd-5.4.3-r2.ebuild |
218 |
new file mode 100644 |
219 |
index 000000000000..e0c005ecfcb9 |
220 |
--- /dev/null |
221 |
+++ b/net-libs/xrootd/xrootd-5.4.3-r2.ebuild |
222 |
@@ -0,0 +1,173 @@ |
223 |
+# Copyright 1999-2022 Gentoo Authors |
224 |
+# Distributed under the terms of the GNU General Public License v2 |
225 |
+ |
226 |
+EAPI=8 |
227 |
+ |
228 |
+PYTHON_COMPAT=( python3_{8..11} ) |
229 |
+DISTUTILS_OPTIONAL=1 |
230 |
+DISTUTILS_USE_PEP571="setuptools" |
231 |
+ |
232 |
+inherit cmake distutils-r1 |
233 |
+ |
234 |
+DESCRIPTION="Extended ROOT remote file server" |
235 |
+HOMEPAGE="https://xrootd.slac.stanford.edu/" |
236 |
+SRC_URI="https://xrootd.slac.stanford.edu/download/v${PV}/${P}.tar.gz" |
237 |
+ |
238 |
+LICENSE="LGPL-3" |
239 |
+SLOT="0" |
240 |
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" |
241 |
+IUSE="doc examples fuse http kerberos +libxml2 python readline +server systemd test test-suite" |
242 |
+ |
243 |
+# Python tests currently require manual configuration and start-up of an xrootd server. |
244 |
+# No actual build-time test suite for native code. |
245 |
+RESTRICT="test" |
246 |
+ |
247 |
+CDEPEND="acct-group/xrootd |
248 |
+ acct-user/xrootd |
249 |
+ dev-libs/openssl:0= |
250 |
+ sys-libs/zlib |
251 |
+ virtual/libcrypt:= |
252 |
+ fuse? ( sys-fs/fuse:0= ) |
253 |
+ http? ( net-misc/curl:= ) |
254 |
+ kerberos? ( virtual/krb5 ) |
255 |
+ libxml2? ( dev-libs/libxml2:2= ) |
256 |
+ python? ( ${PYTHON_DEPS} ) |
257 |
+ readline? ( sys-libs/readline:0= ) |
258 |
+ systemd? ( sys-apps/systemd:= ) |
259 |
+ test-suite? ( dev-util/cppunit ) |
260 |
+" |
261 |
+DEPEND="${CDEPEND}" |
262 |
+BDEPEND=" |
263 |
+ doc? ( |
264 |
+ app-doc/doxygen[dot] |
265 |
+ virtual/latex-base |
266 |
+ python? ( dev-python/sphinx ) |
267 |
+ ) |
268 |
+ python? ( |
269 |
+ ${PYTHON_DEPS} |
270 |
+ ${DISTUTILS_DEPS} |
271 |
+ test? ( >=dev-python/pytest-7.1.2[${PYTHON_USEDEP}] ) |
272 |
+ ) |
273 |
+" |
274 |
+RDEPEND="${CDEPEND} |
275 |
+ dev-lang/perl |
276 |
+" |
277 |
+REQUIRED_USE=" |
278 |
+ http? ( kerberos ) |
279 |
+ python? ( ${PYTHON_REQUIRED_USE} ) |
280 |
+ test? ( server ) |
281 |
+ test-suite? ( server ) |
282 |
+" |
283 |
+ |
284 |
+PATCHES=( |
285 |
+ "${FILESDIR}"/${PN}-4.8.3-crc32.patch |
286 |
+ "${FILESDIR}"/${PN}-5.4.3-no_automagic.patch |
287 |
+ "${FILESDIR}"/${PN}-5.4.3-cmake_no_python.patch |
288 |
+ "${FILESDIR}"/${PN}-5.4.3-python_tests_py3.patch |
289 |
+) |
290 |
+ |
291 |
+# xrootd plugins are not intended to be linked with, |
292 |
+# they are to be loaded at runtime by xrootd, |
293 |
+# see https://github.com/xrootd/xrootd/issues/447 |
294 |
+QA_SONAME="/usr/lib.*/libXrd.*-$(ver_cut 1)\.so |
295 |
+ /usr/lib.*/libXrdClTests\.so" |
296 |
+ |
297 |
+pkg_setup() { |
298 |
+ use python && python_setup |
299 |
+} |
300 |
+ |
301 |
+src_prepare() { |
302 |
+ cmake_src_prepare |
303 |
+ |
304 |
+ if use python; then |
305 |
+ pushd "${S}"/bindings/python > /dev/null || die |
306 |
+ distutils-r1_src_prepare |
307 |
+ popd > /dev/null || die |
308 |
+ fi |
309 |
+} |
310 |
+ |
311 |
+# FIXME: support xrdec - currently only builds against bundled isa-l |
312 |
+src_configure() { |
313 |
+ local mycmakeargs=( |
314 |
+ -DENABLE_FUSE=$(usex fuse) |
315 |
+ -DENABLE_HTTP=$(usex http) |
316 |
+ -DENABLE_KRB5=$(usex kerberos) |
317 |
+ -DENABLE_LIBXML2=$(usex libxml2) |
318 |
+ -DENABLE_PYTHON=$(usex python) |
319 |
+ -DENABLE_READLINE=$(usex readline) |
320 |
+ -DENABLE_TESTS=$(usex test-suite) |
321 |
+ -DENABLE_VOMS=no |
322 |
+ -DFORCE_ENABLED=yes |
323 |
+ -DXRDCL_ONLY=$(usex server "no" "yes") |
324 |
+ ) |
325 |
+ cmake_src_configure |
326 |
+ |
327 |
+ if use python; then |
328 |
+ pushd "${BUILD_DIR}"/bindings/python > /dev/null || die |
329 |
+ distutils-r1_src_configure |
330 |
+ popd > /dev/null || die |
331 |
+ fi |
332 |
+} |
333 |
+ |
334 |
+src_compile() { |
335 |
+ cmake_src_compile |
336 |
+ if use doc; then |
337 |
+ doxygen Doxyfile || die |
338 |
+ if use python; then |
339 |
+ emake -C bindings/python/docs html |
340 |
+ fi |
341 |
+ fi |
342 |
+ if use python; then |
343 |
+ pushd "${BUILD_DIR}"/bindings/python > /dev/null || die |
344 |
+ distutils-r1_src_compile |
345 |
+ popd > /dev/null || die |
346 |
+ fi |
347 |
+} |
348 |
+ |
349 |
+python_test() { |
350 |
+ epytest |
351 |
+} |
352 |
+ |
353 |
+src_test() { |
354 |
+ use python && distutils-r1_src_test |
355 |
+} |
356 |
+ |
357 |
+src_install() { |
358 |
+ use doc && HTML_DOCS=( doxydoc/html/. ) |
359 |
+ dodoc docs/ReleaseNotes.txt |
360 |
+ cmake_src_install |
361 |
+ find "${D}" \( -iname '*.md5' -o -iname '*.map' \) -delete || die |
362 |
+ |
363 |
+ # base configs |
364 |
+ insinto /etc/xrootd |
365 |
+ doins packaging/common/*.cfg |
366 |
+ |
367 |
+ fowners root:xrootd /etc/xrootd |
368 |
+ keepdir /var/log/xrootd |
369 |
+ fowners xrootd:xrootd /var/log/xrootd |
370 |
+ |
371 |
+ if use server; then |
372 |
+ local i |
373 |
+ for i in cmsd frm_purged frm_xfrd xrootd; do |
374 |
+ newinitd "${FILESDIR}"/${i}.initd ${i} |
375 |
+ done |
376 |
+ # all daemons MUST use single master config file |
377 |
+ newconfd "${FILESDIR}"/xrootd.confd xrootd |
378 |
+ fi |
379 |
+ |
380 |
+ if use python; then |
381 |
+ pushd "${BUILD_DIR}"/bindings/python > /dev/null || die |
382 |
+ distutils-r1_src_install |
383 |
+ popd > /dev/null || die |
384 |
+ |
385 |
+ if use doc; then |
386 |
+ docinto python |
387 |
+ docompress -x "/usr/share/doc/${PF}/python/html" |
388 |
+ dodoc -r bindings/python/docs/build/html |
389 |
+ fi |
390 |
+ if use examples; then |
391 |
+ docinto python |
392 |
+ dodoc -r bindings/python/examples |
393 |
+ fi |
394 |
+ fi |
395 |
+} |