Skip to content

Commit 1d69b11

Browse files
committed
app-admin/clustershell: add 1.8.4
Multiple aspects of the ebuild were changed from previous versions: - it is converted to new PEP517 mode - it supports py3.9, py3.10 and py3.11 - homepage link is fixed - it uses .gh.tar.gz suffix for source archive as suggested in Gentoo Python Guide - the doc use is removed because it is not used anymore since commit 3ca0636 ("app-admin/clustershell: version bump.") - dev-libs/openssl dependency is removed, it is not used in sources code - working tests - most of tests work with an exception of those requiring remote ssh connections, which are removed in prepare step. It was necessary to apply few fixes [1-3] taken from upstream in order to make them work. The tests are executed with unittest rather than nose which makes py3.11 support possible. - it installs man pages again, this is basically resurrected from commit 3ca0636 ("app-admin/clustershell: version bump.") - unlike legacy mode, PEP517 installs etc/* files to /usr/etc, hence it was necessary to correct installation path with move (I didn't find any better solution, this one is used across repository) [1] cea-hpc/clustershell@314767d [2] cea-hpc/clustershell#487 [3] cea-hpc/clustershell#488 Closes: https://bugs.gentoo.org/866071 Bug: https://bugs.gentoo.org/845426 Signed-off-by: Petr Vaněk <[email protected]>
1 parent 664ef05 commit 1d69b11

File tree

5 files changed

+251
-0
lines changed

5 files changed

+251
-0
lines changed

app-admin/clustershell/Manifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
DIST clustershell-1.8.3.tar.gz 363975 BLAKE2B 3a7bb9103398e96f57f53d0d5d5edc6895ce02b6983e8fed34d65cad83a6d4e86f40b9576f41631e499a99adc8be5f4f422005b8ddc7ac8325fe11abd2c99477 SHA512 5108773e2958d1dae0aa6966d764e9af9d41024f65271005b202468f2bd1a3b63acc977729324fe1305d400dc8b06b0c4672e8d8ded207fa77cef69fb0005108
2+
DIST clustershell-1.8.4.gh.tar.gz 367622 BLAKE2B 1487697a49d37902f9763094da1a156f5e7cc2ab0487814207bb9da03b1109f1ce55034fc92e72262d4b9920d5c52b9f6de84ce1ff04b06d042b0a6d005f1049 SHA512 582393e56d94e62e126d91f8af074a7b57d0e781a5c929cfc374e61324c412c32fcf9a8e063a78cb805c2ff34641887a1adfc7ef9f377b881077f719dbc2adc3
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Copyright 1999-2022 Gentoo Authors
2+
# Distributed under the terms of the GNU General Public License v2
3+
4+
EAPI=8
5+
6+
DISTUTILS_USE_PEP517=setuptools
7+
PYTHON_COMPAT=( python3_{9..11} )
8+
PYTHON_REQ_USE="xml(+)"
9+
10+
inherit distutils-r1
11+
12+
DESCRIPTION="Python framework for efficient cluster administration"
13+
HOMEPAGE="https://github.com/cea-hpc/clustershell/"
14+
SRC_URI="
15+
https://github.com/cea-hpc/clustershell/archive/v${PV}.tar.gz
16+
-> ${P}.gh.tar.gz
17+
"
18+
19+
LICENSE="LGPL-2.1+"
20+
SLOT="0"
21+
KEYWORDS="~amd64 ~x86"
22+
IUSE="test"
23+
RESTRICT="!test? ( test )"
24+
25+
BDEPEND="
26+
test? (
27+
app-shells/pdsh
28+
net-misc/openssh
29+
sys-devel/bc
30+
)
31+
"
32+
33+
RDEPEND="dev-python/pyyaml[${PYTHON_USEDEP}]"
34+
35+
PATCHES=(
36+
# python3.10 related fixes taken from upstream
37+
"${FILESDIR}/${P}-setrlimit-division.patch"
38+
"${FILESDIR}/${P}-current-thread.patch"
39+
40+
"${FILESDIR}/${P}-skip-tests.patch"
41+
)
42+
43+
src_prepare() {
44+
default
45+
46+
# remove test sets that require working ssh connection
47+
rm tests/{CLIClush,TaskDistant*,TreeWorker}Test.py || die
48+
}
49+
50+
distutils_enable_tests unittest
51+
52+
python_test() {
53+
cd tests || die
54+
# Automatic discovery does not work
55+
"${EPYTHON}" -m unittest_or_fail -v *.py || die "Tests failed with ${EPYTHON}"
56+
}
57+
58+
src_install() {
59+
distutils-r1_src_install
60+
61+
doman doc/man/man*/*
62+
63+
mv "${ED}/usr/etc" "${ED}/etc" || die
64+
}
65+
66+
pkg_postinst() {
67+
einfo
68+
einfo "Some default system-wide config files have been installed into"
69+
einfo "/etc/${PN}"
70+
einfo
71+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
Backported from upstream commit 314767d65c39 ("Fix for python-3.10") [1].
2+
3+
[1] https://github.com/cea-hpc/clustershell/commit/314767d65c397fadc5ce0ae205a35d7bb47a68a8
4+
5+
diff --git a/lib/ClusterShell/Task.py b/lib/ClusterShell/Task.py
6+
index b9142e6..8c9e1b9 100644
7+
--- a/lib/ClusterShell/Task.py
8+
+++ b/lib/ClusterShell/Task.py
9+
@@ -254,7 +254,7 @@ class Task(object):
10+
self._cond.acquire()
11+
try:
12+
self.suspend_count = min(self.suspend_count, 0)
13+
- self._cond.notifyAll()
14+
+ self._cond.notify_all()
15+
finally:
16+
self._cond.release()
17+
18+
@@ -347,7 +347,7 @@ class Task(object):
19+
def _is_task_self(self):
20+
"""Private method used by the library to check if the task is
21+
task_self(), but do not create any task_self() instance."""
22+
- return self.thread == threading.currentThread()
23+
+ return self.thread == threading.current_thread()
24+
25+
def default_excepthook(self, exc_type, exc_value, tb):
26+
"""Default excepthook for a newly Task. When an exception is
27+
@@ -765,7 +765,7 @@ class Task(object):
28+
29+
def _resume(self):
30+
"""Resume task - called from self thread."""
31+
- assert self.thread == threading.currentThread()
32+
+ assert self.thread == threading.current_thread()
33+
try:
34+
try:
35+
self._reset()
36+
@@ -780,7 +780,7 @@ class Task(object):
37+
# task becomes joinable
38+
self._join_cond.acquire()
39+
self._suspend_cond.atomic_inc()
40+
- self._join_cond.notifyAll()
41+
+ self._join_cond.notify_all()
42+
self._join_cond.release()
43+
44+
def resume(self, timeout=None):
45+
@@ -954,14 +954,14 @@ class Task(object):
46+
# termination (late join()s)
47+
# must be called after _terminated is set to True
48+
self._join_cond.acquire()
49+
- self._join_cond.notifyAll()
50+
+ self._join_cond.notify_all()
51+
self._join_cond.release()
52+
53+
# destroy task if needed
54+
if kill:
55+
Task._task_lock.acquire()
56+
try:
57+
- del Task._tasks[threading.currentThread()]
58+
+ del Task._tasks[threading.current_thread()]
59+
finally:
60+
Task._task_lock.release()
61+
62+
@@ -1376,7 +1376,7 @@ def task_self(defaults=None):
63+
provided as a convenience is available in the top-level ClusterShell.Task
64+
package namespace.
65+
"""
66+
- return Task(thread=threading.currentThread(), defaults=defaults)
67+
+ return Task(thread=threading.current_thread(), defaults=defaults)
68+
69+
def task_wait():
70+
"""
71+
@@ -1385,7 +1385,7 @@ def task_wait():
72+
convenience and is available in the top-level ClusterShell.Task package
73+
namespace.
74+
"""
75+
- Task.wait(threading.currentThread())
76+
+ Task.wait(threading.current_thread())
77+
78+
def task_terminate():
79+
"""
80+
diff --git a/tests/TaskPortTest.py b/tests/TaskPortTest.py
81+
index 697f144..4014a89 100644
82+
--- a/tests/TaskPortTest.py
83+
+++ b/tests/TaskPortTest.py
84+
@@ -28,7 +28,7 @@ class TaskPortTest(unittest.TestCase):
85+
def ev_msg(self, port, msg):
86+
# receive msg
87+
assert msg == "toto"
88+
- assert port.task.thread == threading.currentThread()
89+
+ assert port.task.thread == threading.current_thread()
90+
TaskPortTest.got_msg = True
91+
port.task.abort()
92+
93+
--
94+
2.35.1
95+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Python3.10 related fix taken from upstream [1,2].
2+
3+
[1] https://github.com/cea-hpc/clustershell/pull/487
4+
[2] https://github.com/cea-hpc/clustershell/commit/5ac85daf74056ec7e60778efec94c746a150142c
5+
6+
diff --git a/tests/CLIConfigTest.py b/tests/CLIConfigTest.py
7+
index 2853398..db6cec5 100644
8+
--- a/tests/CLIConfigTest.py
9+
+++ b/tests/CLIConfigTest.py
10+
@@ -229,7 +229,7 @@ class CLIClushConfigTest(unittest.TestCase):
11+
display = Display(options, config)
12+
13+
# force a lower soft limit
14+
- resource.setrlimit(resource.RLIMIT_NOFILE, (hard2/2, hard))
15+
+ resource.setrlimit(resource.RLIMIT_NOFILE, (hard2//2, hard))
16+
# max_fdlimit should increase soft limit again
17+
set_fdlimit(config.fd_max, display)
18+
# verify
19+
--
20+
2.35.1
21+
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
This is a Gentoo specific patch for skipping tests that do not work due
2+
to various reasons:
3+
1. hostname may be set to localhost
4+
2. test fails which are most probably caused by weird test interaction.
5+
The issue is reported to upstream in [1].
6+
7+
[1] https://github.com/cea-hpc/clustershell/issues/488
8+
9+
diff --git a/tests/TaskEventTest.py b/tests/TaskEventTest.py
10+
index f8a4048..900008b 100644
11+
--- a/tests/TaskEventTest.py
12+
+++ b/tests/TaskEventTest.py
13+
@@ -475,6 +475,7 @@ class TaskEventTest(unittest.TestCase):
14+
self.assertEqual(eh.cnt_pickup, 3)
15+
self.assertEqual(eh.cnt_hup, 3)
16+
17+
+ @unittest.skip("because of an issue https://github.com/cea-hpc/clustershell/issues/488")
18+
def test_ev_pickup_fanout_legacy(self):
19+
"""test ev_pickup event with fanout (legacy)"""
20+
task = task_self()
21+
@@ -498,6 +499,7 @@ class TaskEventTest(unittest.TestCase):
22+
finally:
23+
task.set_info("fanout", fanout)
24+
25+
+ @unittest.skip("because of an issue https://github.com/cea-hpc/clustershell/issues/488")
26+
def test_ev_pickup_fanout(self):
27+
"""test ev_pickup event with fanout"""
28+
task = task_self()
29+
diff --git a/tests/TreeWorkerTest.py b/tests/TreeWorkerTest.py
30+
index d5c221a..969d3c9 100644
31+
--- a/tests/TreeWorkerTest.py
32+
+++ b/tests/TreeWorkerTest.py
33+
@@ -99,6 +99,7 @@ class TEventHandler(TEventHandlerBase):
34+
self.ev_timedout_cnt += 1
35+
36+
37+
+@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
38+
class TreeWorkerTest(unittest.TestCase):
39+
"""
40+
TreeWorkerTest: test TreeWorker
41+
diff --git a/tests/WorkerExecTest.py b/tests/WorkerExecTest.py
42+
index 6f99f10..0894f99 100644
43+
--- a/tests/WorkerExecTest.py
44+
+++ b/tests/WorkerExecTest.py
45+
@@ -45,6 +45,7 @@ class ExecTest(unittest.TestCase):
46+
self.assertEqual(task_self().max_retcode(), 1)
47+
self.assertEqual(task_self().node_buffer('localhost'), b'')
48+
49+
+ @unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
50+
def test_timeout(self):
51+
"""test ExecWorker with a timeout"""
52+
nodes = "localhost,%s" % HOSTNAME
53+
@@ -67,6 +68,7 @@ class ExecTest(unittest.TestCase):
54+
self.assertRaises(WorkerError, self.execw,
55+
nodes="localhost", handler=None, command="echo %")
56+
57+
+ @unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
58+
def test_rank_placeholder(self):
59+
"""test ExecWorker with several nodes and %n (rank)"""
60+
nodes = "localhost,%s" % HOSTNAME
61+
--
62+
2.35.1
63+

0 commit comments

Comments
 (0)