ParallelSSH / ssh2-python

Python bindings for libssh2 C library.
https://parallel-ssh.org
GNU Lesser General Public License v2.1
228 stars 70 forks source link

Add debian packaging files #190

Open SCOTT-HAMILTON opened 12 months ago

SCOTT-HAMILTON commented 12 months ago

This PR is a starting point for packaging all the parallel-ssh ecosystem to debian, the end goal being to have a python3-parallel-ssh package. I've already started working on parallel-ssh and ssh-python so those are coming next.

I had to disable one test: tests/test_sftp.py:test_mkdir in order to make it build locally, otherwise I had this error:

======================================================================
ERROR: test_mkdir (tests.test_sftp.SFTPTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/patrick/Packaging/ssh2-python/python3-ssh2-1.0.0/.pybuild/cpython3_3.8_ssh2-python/build/tests/test_sftp.py", line 311, in test_mkdir
    sftp.mkdir(_path, mode)
  File "ssh2/sftp.pyx", line 352, in ssh2.sftp.SFTP.mkdir
  File "ssh2/utils.pyx", line 192, in ssh2.utils.handle_error_codes
ssh2.exceptions.SFTPProtocolError

----------------------------------------------------------------------

This builds fine locally, the steps are as follow (on a debian machine with buildessentials and debhelper installed, and maybe more):

# We copy the debian folder but we want to build with the 1.0.0 tree
git clone https://github.com/SCOTT-HAMILTON/ssh2-python
mv ssh2-python/debian .
rm -rf ssh2-python

# we get the 1.0.0 tree
wget https://github.com/ParallelSSH/ssh2-python/archive/refs/tags/1.0.0.tar.gz
tar -xf 1.0.0.tar.gz
mv ssh2-python-1.0.0/ python3-ssh2-1.0.0
mv debian python3-ssh2-1.0.0

# we make the tar file
tar -czf python3-ssh2_1.0.0.orig.tar.gz python3-ssh2-1.0.0

# we install the build deps
cd python3-ssh2-1.0.0
sudo mk-build-deps --install debian/control
rm -f python3-ssh2-build-deps_1.0.0-1_all.deb

# and we finally build
debuild -us -uc

This works for me locally on ZorinOS 16.2 but I can't make it work on SUSE's OpenBuildService see https://build.opensuse.org/package/show/home:ScottHamilton/python3-ssh2 and the build logs on the debian machine: https://build.opensuse.org/public/build/home:ScottHamilton/Debian_Testing/x86_64/python3-ssh2/_log.

Contrary to locally, on the OBS, almost all the remaining tests fail with the same error ssh2.exceptions.KexFailureError. I don't really no much about ssh2 internals so I have no idea what could go wrong on OBS and also on the tests that I've disabled (which I've skipped because they were running into ssh2.exceptions.AgentConnectionError: Unable to connect to agent)

I've noticed that the tests don't buid locally if the working directory is under /tmp. Maybe this is why the OBS build is failing, very strange ?