From 72c8fdda15a36c0baff7a8b259e12c45472aa5f5 Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Thu, 21 Aug 2025 19:51:47 +0300
Subject: trinity-apps/tdesvn: fix testing

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
---
 .../tdesvn-14.1.4-Fix-build-run-of-tests.patch     | 248 +++++++++++++++++++++
 trinity-apps/tdesvn/tdesvn-14.1.1.ebuild           |  14 +-
 trinity-apps/tdesvn/tdesvn-14.1.2.ebuild           |  14 +-
 trinity-apps/tdesvn/tdesvn-9999.ebuild             |  10 +-
 4 files changed, 274 insertions(+), 12 deletions(-)
 create mode 100644 trinity-apps/tdesvn/files/tdesvn-14.1.4-Fix-build-run-of-tests.patch

diff --git a/trinity-apps/tdesvn/files/tdesvn-14.1.4-Fix-build-run-of-tests.patch b/trinity-apps/tdesvn/files/tdesvn-14.1.4-Fix-build-run-of-tests.patch
new file mode 100644
index 00000000..57a4a387
--- /dev/null
+++ b/trinity-apps/tdesvn/files/tdesvn-14.1.4-Fix-build-run-of-tests.patch
@@ -0,0 +1,248 @@
+From fb0dff6330956c282fda88bd4b625fcb7cb26142 Mon Sep 17 00:00:00 2001
+From: Alexander Golubev <fatzer2@gmail.com>
+Date: Wed, 20 Aug 2025 19:18:01 +0300
+Subject: [PATCH] Fix build&run of tests
+
+Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
+---
+ src/svnqt/cache/test/CMakeLists.txt |  7 ++++---
+ src/svnqt/cache/test/sqlite.cpp     | 19 -------------------
+ src/svnqt/testmain.cpp              |  7 +------
+ src/svnqt/tests/CMakeLists.txt      |  8 +++++---
+ src/svnqt/tests/ckpath.cpp          |  2 +-
+ src/svnqt/tests/crepo.cpp           |  6 ++++--
+ src/svnqt/tests/lsdir.cpp           | 12 ++++++------
+ 7 files changed, 21 insertions(+), 40 deletions(-)
+
+diff --git a/src/svnqt/cache/test/CMakeLists.txt b/src/svnqt/cache/test/CMakeLists.txt
+index 7ea8c33..29e6145 100644
+--- a/src/svnqt/cache/test/CMakeLists.txt
++++ b/src/svnqt/cache/test/CMakeLists.txt
+@@ -1,14 +1,15 @@
+ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
+ 
+-macro(build_TEST tname)
++macro(build_test tname)
+   set(${tname}-src ${tname}.cpp)
+   if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${tname}.h)
+         set(${tname}-src ${${tname}-src} ${tname}.h)
+   endif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${tname}.h)
+   add_executable(${tname} ${${tname}-src})
+   target_link_libraries(${tname} ${svnqt-name} ${TQT_LIBRARIES})
+-  add_test(${tname} ${CMAKE_CURRENT_BINARY_DIR}/${tname})
+-endmaCRO(BUILD_TEST)
++  # FIXME: sqlite test relies on now defunc web service
++  # add_test(${tname} ${CMAKE_CURRENT_BINARY_DIR}/${tname})
++endmaCRO(build_test)
+ 
+ if (BUILD_TESTS)
+     configure_file(
+diff --git a/src/svnqt/cache/test/sqlite.cpp b/src/svnqt/cache/test/sqlite.cpp
+index 78cfc30..fcb46a9 100644
+--- a/src/svnqt/cache/test/sqlite.cpp
++++ b/src/svnqt/cache/test/sqlite.cpp
+@@ -7,19 +7,12 @@
+ 
+ #include "svnqt/client.h"
+ #include "svnqt/svnqttypes.h"
+-#include "svnqt/log_entry.h"
+ 
+ #include "svnqt/cache/LogCache.h"
+ #include "svnqt/cache/ReposLog.h"
+ #include "svnqt/cache/test/testconfig.h"
+ #include "svnqt/cache/DatabaseException.h"
+ 
+-#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000
+-#else
+-#include <TQSqlQuery>
+-#include <TQSqlError>
+-#endif
+-
+ int main(int argc,char**argv)
+ {
+     TQApplication app(argc,argv);
+@@ -43,19 +36,11 @@ int main(int argc,char**argv)
+     }
+     svn::cache::ReposLog rl(m_Svnclient,"http://www.alwins-world.de/repos/tdesvn");
+     TQDataBase db = rl.Database();
+-#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000
+     if (!db) {
+-#else
+-    if (!db.isValid()) {
+-#endif
+         std::cerr << "No database object."<<std::endl;
+         exit(-1);
+     }
+-#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000
+     list = db->tables();
+-#else
+-    list = db.tables();
+-#endif
+     it = list.begin();
+     while( it != list.end() ) {
+         std::cout << ( *it ).TOUTF8().data() << std::endl;
+@@ -91,10 +76,6 @@ int main(int argc,char**argv)
+     q.exec();
+     std::cerr << "\n" << q.lastError().text().TOUTF8().data()<<std::endl;
+ 
+-#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000
+-#else
+-    db=TQSqlDatabase();
+-#endif
+     try {
+         rl.log("/trunk/src/svnqt",1,1000,svn::Revision::UNDEFINED,lm,false,-1);
+     }
+diff --git a/src/svnqt/testmain.cpp b/src/svnqt/testmain.cpp
+index 0795001..727e557 100644
+--- a/src/svnqt/testmain.cpp
++++ b/src/svnqt/testmain.cpp
+@@ -20,7 +20,6 @@
+ #include "client.h"
+ #include "repository.h"
+ #include "context.h"
+-#include "datetime.h"
+ 
+ #include <tqdatastream.h>
+ 
+@@ -31,9 +30,7 @@ int main(int,char**)
+     svn::ContextP myContext = new svn::Context();
+ 
+     TQByteArray tout;
+-#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000
+     TQDataStream out(tout,IO_WriteOnly);
+-#endif
+     svn::Client*m_Svnclient = svn::Client::getobject(0,0);
+     svn::ContextP m_CurrentContext = new svn::Context();
+     m_Svnclient->setContext(m_CurrentContext);
+@@ -45,7 +42,6 @@ int main(int,char**)
+     } catch (svn::ClientException ce) {
+         gotit = false;
+     }
+-#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000
+     if (gotit) {
+         out << m_OldHistory;
+         svn::LogEntriesMap m_NewHistory;
+@@ -57,6 +53,5 @@ int main(int,char**)
+             tqDebug("%lu %s %s",it.key(),it.data().author.ascii(),it.data().message.ascii());
+         }
+     }
+-#endif
+-  return 1;
++    return 1;
+ }
+diff --git a/src/svnqt/tests/CMakeLists.txt b/src/svnqt/tests/CMakeLists.txt
+index 6b15073..60193d0 100644
+--- a/src/svnqt/tests/CMakeLists.txt
++++ b/src/svnqt/tests/CMakeLists.txt
+@@ -1,3 +1,4 @@
++include_directories( ${CMAKE_SOURCE_DIR} )
+ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
+ 
+ macro(build_test tname)
+@@ -8,16 +9,17 @@ macro(build_test tname)
+   add_executable(${tname} ${${tname}-src})
+   target_link_libraries(${tname} ${svnqt-name} ${TQT_LIBRARIES})
+   add_test(${tname} ${CMAKE_CURRENT_BINARY_DIR}/${tname})
+-endmacro(BUILD_TEST)
++endmacro(build_test)
+ 
+ if (BUILD_TESTS)
+     configure_file(
+         ${CMAKE_CURRENT_SOURCE_DIR}/testconfig.h.in
+         ${CMAKE_CURRENT_BINARY_DIR}/testconfig.h
+     )
+-    add_test(rmrepo "/bin/rm" "-rvf" "${CMAKE_CURRENT_BINARY_DIR}/repo")
+-    add_test(rmco "/bin/rm" "-rvf" "${CMAKE_CURRENT_BINARY_DIR}/co")
+     build_test(crepo)
+     build_test(lsdir)
+     build_test(ckpath)
++
++    # lsdir relies on output from crepo
++    set_tests_properties(crepo lsdir PROPERTIES RUN_SERIAL TRUE)
+ endif(BUILD_TESTS)
+diff --git a/src/svnqt/tests/ckpath.cpp b/src/svnqt/tests/ckpath.cpp
+index 697e153..a404e50 100644
+--- a/src/svnqt/tests/ckpath.cpp
++++ b/src/svnqt/tests/ckpath.cpp
+@@ -15,7 +15,7 @@ int main(int,char**)
+     }
+     unsigned j = 0;
+     while (pa.length()>0) {
+-        std::cout << pa.path() << std::endl;
++        std::cout << pa.path().local8Bit() << std::endl;
+         pa.removeLast();
+         ++j;
+     }
+diff --git a/src/svnqt/tests/crepo.cpp b/src/svnqt/tests/crepo.cpp
+index b07c09a..baaf444 100644
+--- a/src/svnqt/tests/crepo.cpp
++++ b/src/svnqt/tests/crepo.cpp
+@@ -17,17 +17,19 @@ class Listener:public svn::repository::RepositoryListener
+         virtual ~Listener(){}
+         virtual void sendWarning(const TQString&msg)
+         {
+-            std::cout << msg << std::endl;
++            std::cout << msg.local8Bit() << std::endl;
+         }
+         virtual void sendError(const TQString&msg)
+         {
+-            std::cout << msg << std::endl;
++            std::cout << msg.local8Bit() << std::endl;
+         }
+         virtual bool isCanceld(){return false;}
+ };
+ 
+ int main(int,char**)
+ {
++    system("/bin/rm -rvf -- " TESTREPOPATH " " TESTCOPATH);
++
+     TQString p = TESTREPOPATH;
+     Listener ls;
+     svn::repository::Repository rp(&ls);
+diff --git a/src/svnqt/tests/lsdir.cpp b/src/svnqt/tests/lsdir.cpp
+index 9edbc25..c8db993 100644
+--- a/src/svnqt/tests/lsdir.cpp
++++ b/src/svnqt/tests/lsdir.cpp
+@@ -28,8 +28,8 @@ int main(int,char**)
+     std::cout << "List 1 "<<dlist.size()<<std::endl;
+     for (unsigned int i=0; i < dlist.size();++i) {
+         TQDateTime dt = svn::DateTime(dlist[i]->time());
+-        std::cout << dlist[i]->name() << " "
+-                << dlist[i]->lastAuthor() << " "
++        std::cout << dlist[i]->name().local8Bit() << " "
++                << dlist[i]->lastAuthor().local8Bit() << " "
+                 << dlist[i]->size() << " "
+                 << dt.toTime_t() << std::endl;
+     }
+@@ -44,8 +44,8 @@ int main(int,char**)
+     std::cout << "List 2 "<<dlist.size()<<std::endl;
+     for (unsigned int i=0; i < dlist.size();++i) {
+         TQDateTime dt = svn::DateTime(dlist[i]->time());
+-        std::cout << dlist[i]->name() << " "
+-                << dlist[i]->lastAuthor() << " "
++        std::cout << dlist[i]->name().local8Bit() << " "
++                << dlist[i]->lastAuthor().local8Bit() << " "
+                 << dlist[i]->size() << " "
+                 << dt.toTime_t() << std::endl;
+     }
+@@ -59,7 +59,7 @@ int main(int,char**)
+         return -1;
+     }
+     for (unsigned int i=0; i < slist.size();++i) {
+-        std::cout << slist[i]->path()<< std::endl;
++        std::cout << slist[i]->path().local8Bit() << std::endl;
+     }
+     std::cout << "================"<<std::endl;
+     std::cout << "Second status:"<<std::endl;
+@@ -71,7 +71,7 @@ int main(int,char**)
+         return -1;
+     }
+     for (unsigned int i=0; i < slist.size();++i) {
+-        std::cout << slist[i]->path()<< std::endl;
++        std::cout << slist[i]->path().local8Bit() << std::endl;
+     }
+ 
+     return 0;
+-- 
+2.49.1
+
diff --git a/trinity-apps/tdesvn/tdesvn-14.1.1.ebuild b/trinity-apps/tdesvn/tdesvn-14.1.1.ebuild
index eaace786..933558c2 100644
--- a/trinity-apps/tdesvn/tdesvn-14.1.1.ebuild
+++ b/trinity-apps/tdesvn/tdesvn-14.1.1.ebuild
@@ -1,5 +1,5 @@
 # Copyright 1999-2023 Gentoo Authors
-# Copyright 2020-2023 The Trinity Desktop Project
+# Copyright 2020-2025 The Trinity Desktop Project
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="8"
@@ -20,12 +20,18 @@ if [[ ${PV} != *9999* ]] ; then
 	KEYWORDS="~amd64 ~arm64 ~x86"
 fi
 IUSE="test"
+RESTRICT="!test? ( test )"
 
-RESTRICT+=" !test? ( test )"
-
-DEPEND="dev-vcs/subversion"
+DEPEND="
+	dev-vcs/subversion
+	dev-libs/apr
+"
 RDEPEND="${DEPEND}"
 
+PATCHES=(
+	"${FILESDIR}/${PN}-14.1.4-Fix-build-run-of-tests.patch"
+)
+
 src_configure() {
 	local mycmakeargs=(
 		-DBUILD_TESTS="$(usex test)"
diff --git a/trinity-apps/tdesvn/tdesvn-14.1.2.ebuild b/trinity-apps/tdesvn/tdesvn-14.1.2.ebuild
index 23fd36bc..03219f85 100644
--- a/trinity-apps/tdesvn/tdesvn-14.1.2.ebuild
+++ b/trinity-apps/tdesvn/tdesvn-14.1.2.ebuild
@@ -1,5 +1,5 @@
 # Copyright 1999-2024 Gentoo Authors
-# Copyright 2020-2024 The Trinity Desktop Project
+# Copyright 2020-2025 The Trinity Desktop Project
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="8"
@@ -20,12 +20,18 @@ if [[ ${PV} != *9999* ]] ; then
 	KEYWORDS="~amd64 ~arm64 ~x86"
 fi
 IUSE="test"
+RESTRICT="!test? ( test )"
 
-RESTRICT+=" !test? ( test )"
-
-DEPEND="dev-vcs/subversion"
+DEPEND="
+	dev-vcs/subversion
+	dev-libs/apr
+"
 RDEPEND="${DEPEND}"
 
+PATCHES=(
+	"${FILESDIR}/${PN}-14.1.4-Fix-build-run-of-tests.patch"
+)
+
 src_configure() {
 	local mycmakeargs=(
 		-DBUILD_TESTS="$(usex test)"
diff --git a/trinity-apps/tdesvn/tdesvn-9999.ebuild b/trinity-apps/tdesvn/tdesvn-9999.ebuild
index 4b5ae2d6..6fdf3687 100644
--- a/trinity-apps/tdesvn/tdesvn-9999.ebuild
+++ b/trinity-apps/tdesvn/tdesvn-9999.ebuild
@@ -1,5 +1,5 @@
 # Copyright 1999-2020 Gentoo Authors
-# Copyright 2020 The Trinity Desktop Project
+# Copyright 2020-2025 The Trinity Desktop Project
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="8"
@@ -20,10 +20,12 @@ if [[ ${PV} != *9999* ]] ; then
 	KEYWORDS="~amd64 ~arm64 ~x86"
 fi
 IUSE="test"
+RESTRICT="!test? ( test )"
 
-RESTRICT+=" !test? ( test )"
-
-DEPEND="dev-vcs/subversion"
+DEPEND="
+	dev-vcs/subversion
+	dev-libs/apr
+"
 RDEPEND="${DEPEND}"
 
 src_configure() {
-- 
cgit v1.2.3

