commit:     8628153ddde353e830573c4569c99f9c23ea6eb1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 15 09:02:53 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Nov 15 09:05:49 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8628153d

net-misc/dropbear: work towards fixing tests

Restrict for now as they end up wanting interactive input.

Closes: https://bugs.gentoo.org/836990
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-misc/dropbear/dropbear-2022.82.ebuild          | 36 ++++++++++++++++++++--
 .../dropbear/files/dropbear-2022.82-tests.patch    | 25 +++++++++++++++
 2 files changed, 58 insertions(+), 3 deletions(-)

diff --git a/net-misc/dropbear/dropbear-2022.82.ebuild 
b/net-misc/dropbear/dropbear-2022.82.ebuild
index 2538b0bcfa84..e9746bf468b8 100644
--- a/net-misc/dropbear/dropbear-2022.82.ebuild
+++ b/net-misc/dropbear/dropbear-2022.82.ebuild
@@ -3,8 +3,9 @@
 
 EAPI=7
 
+PYTHON_COMPAT=( python3_{8..11} )
 VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/dropbear.asc
-inherit savedconfig pam verify-sig
+inherit savedconfig pam python-any-r1 verify-sig
 
 DESCRIPTION="Small SSH 2 client/server designed for small memory environments"
 HOMEPAGE="https://matt.ucc.asn.au/dropbear/dropbear.html";
@@ -18,7 +19,8 @@ SRC_URI+=" verify-sig? (
 LICENSE="MIT GPL-2" # (init script is GPL-2 #426056)
 SLOT="0"
 KEYWORDS="~alpha ~amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos"
-IUSE="bsdpty minimal multicall pam +shadow static +syslog zlib"
+IUSE="bsdpty minimal multicall pam +shadow static +syslog test zlib"
+RESTRICT="!test? ( test ) test"
 
 LIB_DEPEND="
        virtual/libcrypt[static-libs(+)]
@@ -39,13 +41,28 @@ DEPEND="
        static? ( ${LIB_DEPEND} )
 "
 RDEPEND+=" pam? ( >=sys-auth/pambase-20080219.1 )"
-BDEPEND="verify-sig? ( sec-keys/openpgp-keys-dropbear )"
+BDEPEND="
+       test? (
+               $(python_gen_any_dep '
+                       dev-python/attrs[${PYTHON_USEDEP}]
+                       dev-python/iniconfig[${PYTHON_USEDEP}]
+                       dev-python/packaging[${PYTHON_USEDEP}]
+                       dev-python/pluggy[${PYTHON_USEDEP}]
+                       dev-python/py[${PYTHON_USEDEP}]
+                       dev-python/pyparsing[${PYTHON_USEDEP}]
+                       dev-python/pytest[${PYTHON_USEDEP}]
+                       dev-python/psutil[${PYTHON_USEDEP}]
+               ')
+       )
+       verify-sig? ( sec-keys/openpgp-keys-dropbear )
+"
 
 REQUIRED_USE="pam? ( !static )"
 
 PATCHES=(
        "${FILESDIR}"/${PN}-0.46-dbscp.patch
        "${FILESDIR}"/${PN}-2022.82-x11.patch
+       "${FILESDIR}"/${PN}-2022.82-tests.patch
 )
 
 set_options() {
@@ -58,7 +75,20 @@ set_options() {
        )
 }
 
+python_check_deps() {
+       python_has_version "dev-python/attrs[${PYTHON_USEDEP}]" && \
+               python_has_version "dev-python/iniconfig[${PYTHON_USEDEP}]" && \
+               python_has_version "dev-python/packaging[${PYTHON_USEDEP}]" && \
+               python_has_version "dev-python/pluggy[${PYTHON_USEDEP}]" && \
+               python_has_version "dev-python/py[${PYTHON_USEDEP}]" && \
+               python_has_version "dev-python/pyparsing[${PYTHON_USEDEP}]" && \
+               python_has_version "dev-python/pytest[${PYTHON_USEDEP}]" && \
+               python_has_version "dev-python/psutil[${PYTHON_USEDEP}]"
+}
+
 pkg_setup() {
+       use test && python-any-r1_pkg_setup
+
        if use static ; then
                ewarn "Using bundled copies of libtommath and libtomcrypt"
        fi

diff --git a/net-misc/dropbear/files/dropbear-2022.82-tests.patch 
b/net-misc/dropbear/files/dropbear-2022.82-tests.patch
new file mode 100644
index 000000000000..6619e6c07551
--- /dev/null
+++ b/net-misc/dropbear/files/dropbear-2022.82-tests.patch
@@ -0,0 +1,25 @@
+--- a/test/Makefile.in
++++ b/test/Makefile.in
+@@ -4,18 +4,13 @@ SHELL=bash
+ 
+ all: test
+ 
+-test: venv/bin/pytest fakekey
+-      (source ./venv/bin/activate; pytest --hostkey=fakekey 
--dbclient=../dbclient --dropbear=../dropbear $(srcdir) )
++test: fakekey
++      pytest --hostkey=fakekey --dbclient=../dbclient --dropbear=../dropbear 
$(srcdir)
+ 
+-one: venv/bin/pytest fakekey
+-      (source ./venv/bin/activate; pytest --hostkey=fakekey 
--dbclient=../dbclient --dropbear=../dropbear $(srcdir) -k exit)
++one: fakekey
++      pytest --hostkey=fakekey --dbclient=../dbclient --dropbear=../dropbear 
$(srcdir) -k exit
+ 
+ fakekey:
+       ../dropbearkey -t ecdsa -f $@
+ 
+-venv/bin/pytest: $(srcdir)/requirements.txt
+-      python3 -m venv init venv
+-      ./venv/bin/pip install --upgrade pip
+-      ./venv/bin/pip install -r $(srcdir)/requirements.txt
+-
+ .PHONY: test

Reply via email to