mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
kde-frameworks/kdoctools: Switch back to simple Gentoo docbundledir patch
Bug: https://bugs.gentoo.org/705340 Package-Manager: Portage-2.3.84, Repoman-2.3.20 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
This commit is contained in:
@@ -1,160 +0,0 @@
|
||||
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
|
||||
--- a/autotests/CMakeLists.txt
|
||||
+++ b/autotests/CMakeLists.txt
|
||||
@@ -1,3 +1,40 @@
|
||||
+include(ECMMarkAsTest)
|
||||
+
|
||||
+find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Core Test)
|
||||
+
|
||||
+find_package(LibXslt REQUIRED)
|
||||
+find_package(LibXml2 REQUIRED)
|
||||
+
|
||||
+include_directories( ${LIBXML2_INCLUDE_DIR} ${LIBXSLT_INCLUDE_DIR} )
|
||||
+
|
||||
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src)
|
||||
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
+
|
||||
+add_definitions(-DSIMPLE_XSLT)
|
||||
+
|
||||
+function(kdoctools_define_document_test basetest)
|
||||
+ set(documentdirstest_SRCS
|
||||
+ ${basetest}.cpp
|
||||
+ ../src/xslt.cpp
|
||||
+ ${CMAKE_CURRENT_BINARY_DIR}/../src/loggingcategory.cpp
|
||||
+ )
|
||||
+
|
||||
+ add_executable(${basetest} ${documentdirstest_SRCS})
|
||||
+ target_link_libraries(${basetest}
|
||||
+ Qt5::Core Qt5::Test
|
||||
+ ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${LIBXSLT_EXSLT_LIBRARIES}
|
||||
+ )
|
||||
+
|
||||
+ add_test(NAME ${basetest} COMMAND ${basetest})
|
||||
+ ecm_mark_as_test(${basetest})
|
||||
+endfunction()
|
||||
+
|
||||
+kdoctools_define_document_test(documentdirstest)
|
||||
+
|
||||
+kdoctools_define_document_test(documentcustomdirtest)
|
||||
+# custom path, used by the test
|
||||
+target_compile_definitions(documentcustomdirtest PRIVATE KDOCTOOLS_CUSTOM_DOC_PATH="/usr/share/doc/kde/HTML")
|
||||
+
|
||||
add_test(
|
||||
NAME meinproc_template
|
||||
COMMAND meinproc5 --srcdir ${CMAKE_CURRENT_BINARY_DIR}/../src ${CMAKE_CURRENT_SOURCE_DIR}/../src/template.docbook
|
||||
diff --git a/autotests/documentcustomdirtest.cpp b/autotests/documentcustomdirtest.cpp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/autotests/documentcustomdirtest.cpp
|
||||
@@ -0,0 +1,37 @@
|
||||
+#include <QDebug>
|
||||
+#include <QRegularExpression>
|
||||
+#include <QTest>
|
||||
+
|
||||
+#include "../src/docbookxslt.h"
|
||||
+#include "config-kdoctools.h"
|
||||
+#include "loggingcategory.h"
|
||||
+
|
||||
+using namespace KDocTools;
|
||||
+
|
||||
+class documentCustomDirTest: public QObject
|
||||
+{
|
||||
+ Q_OBJECT
|
||||
+private Q_SLOTS:
|
||||
+ void testDirsContent();
|
||||
+};
|
||||
+
|
||||
+void documentCustomDirTest::testDirsContent()
|
||||
+{
|
||||
+ const QStringList docDirs = documentationDirs();
|
||||
+ QVERIFY(docDirs.size() >= 1);
|
||||
+ /* DOCBUNDLEDIR (one of its matches) must be the first element */
|
||||
+ QVERIFY(docDirs[0].indexOf(QRegularExpression(QStringLiteral(KDOCTOOLS_DOCBUNDLEDIR))) >= 0);
|
||||
+ /* Check all the other items that should be there;
|
||||
+ check the last occurrence, as each locateAll can return more items
|
||||
+ and also some of them may match KDOCTOOLS_DOCBUNDLEDIR */
|
||||
+ int position_dir_doc_HTML = docDirs.lastIndexOf(QRegularExpression(QStringLiteral(".*/doc/HTML$")));
|
||||
+ QVERIFY(position_dir_doc_HTML >= 0);
|
||||
+ int position_dir_help = docDirs.lastIndexOf(QRegularExpression(QStringLiteral(".*/help$")));
|
||||
+ QVERIFY(position_dir_help >= 0);
|
||||
+ /* The custom directory */
|
||||
+ int position_dir_custom = docDirs.lastIndexOf(QStringLiteral(KDOCTOOLS_CUSTOM_DOC_PATH));
|
||||
+ QVERIFY(position_dir_custom >= 0);
|
||||
+}
|
||||
+
|
||||
+QTEST_MAIN(documentCustomDirTest)
|
||||
+#include "documentcustomdirtest.moc"
|
||||
diff --git a/autotests/documentdirstest.cpp b/autotests/documentdirstest.cpp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/autotests/documentdirstest.cpp
|
||||
@@ -0,0 +1,34 @@
|
||||
+#include <QDebug>
|
||||
+#include <QRegularExpression>
|
||||
+#include <QTest>
|
||||
+
|
||||
+#include "../src/docbookxslt.h"
|
||||
+#include "config-kdoctools.h"
|
||||
+#include "loggingcategory.h"
|
||||
+
|
||||
+using namespace KDocTools;
|
||||
+
|
||||
+class documentDirsTest: public QObject
|
||||
+{
|
||||
+ Q_OBJECT
|
||||
+private Q_SLOTS:
|
||||
+ void testDirsContent();
|
||||
+};
|
||||
+
|
||||
+void documentDirsTest::testDirsContent()
|
||||
+{
|
||||
+ const QStringList docDirs = documentationDirs();
|
||||
+ QVERIFY(docDirs.size() >= 1);
|
||||
+ /* DOCBUNDLEDIR (one of its matches) must be the first element */
|
||||
+ QVERIFY(docDirs[0].indexOf(QRegularExpression(QStringLiteral(KDOCTOOLS_DOCBUNDLEDIR))) >= 0);
|
||||
+ /* Check all the other items that should be there;
|
||||
+ check the last occurrence, as each locateAll can return more items
|
||||
+ and also some of them may match KDOCTOOLS_DOCBUNDLEDIR */
|
||||
+ int position_dir_doc_HTML = docDirs.lastIndexOf(QRegularExpression(QStringLiteral(".*/doc/HTML$")));
|
||||
+ QVERIFY(position_dir_doc_HTML >= 0);
|
||||
+ int position_dir_help = docDirs.lastIndexOf(QRegularExpression(QStringLiteral(".*/help$")));
|
||||
+ QVERIFY(position_dir_help >= 0);
|
||||
+}
|
||||
+
|
||||
+QTEST_MAIN(documentDirsTest)
|
||||
+#include "documentdirstest.moc"
|
||||
diff --git a/config-kdoctools.h.cmake b/config-kdoctools.h.cmake
|
||||
--- a/config-kdoctools.h.cmake
|
||||
+++ b/config-kdoctools.h.cmake
|
||||
@@ -3,3 +3,13 @@
|
||||
#define DOCBOOK_XML_CURRDTD "@DocBookXML4_DTD_DIR@"
|
||||
|
||||
#define KDOCTOOLS_INSTALL_DATADIR_KF5 "${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_DATADIR_KF5}"
|
||||
+
|
||||
+#define KDOCTOOLS_DOCBUNDLEDIR "${KDE_INSTALL_DOCBUNDLEDIR}"
|
||||
+
|
||||
+/* Get the value set in the library at compile time, or allow the application
|
||||
+ to set it if the library has not defined it (useful for example for testing
|
||||
+ purposes)
|
||||
+*/
|
||||
+#ifndef KDOCTOOLS_CUSTOM_DOC_PATH
|
||||
+#define KDOCTOOLS_CUSTOM_DOC_PATH "${KDOCTOOLS_CUSTOM_DOC_PATH}"
|
||||
+#endif
|
||||
diff --git a/src/xslt.cpp b/src/xslt.cpp
|
||||
--- a/src/xslt.cpp
|
||||
+++ b/src/xslt.cpp
|
||||
@@ -489,5 +489,13 @@
|
||||
QStringList KDocTools::documentationDirs()
|
||||
{
|
||||
/* List of paths containing documentation */
|
||||
- return QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("doc/HTML"), QStandardPaths::LocateDirectory);
|
||||
+ QStringList allDocDirs;
|
||||
+ allDocDirs << QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral(KDOCTOOLS_DOCBUNDLEDIR), QStandardPaths::LocateDirectory)
|
||||
+ << QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("doc/HTML"), QStandardPaths::LocateDirectory)
|
||||
+ << QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("help"), QStandardPaths::LocateDirectory);
|
||||
+ if (!QStringLiteral(KDOCTOOLS_CUSTOM_DOC_PATH).isEmpty()) {
|
||||
+ allDocDirs << QStringLiteral(KDOCTOOLS_CUSTOM_DOC_PATH);
|
||||
+ }
|
||||
+ allDocDirs.removeDuplicates();
|
||||
+ return allDocDirs;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ DEPEND="
|
||||
"
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
PATCHES=( "${FILESDIR}/${PN}-5.66.0-docbundledir.patch" )
|
||||
PATCHES=( "${FILESDIR}/${PN}-5.54.0-gentoo-docbundledir.patch" )
|
||||
|
||||
src_configure() {
|
||||
local mycmakeargs=(
|
||||
|
||||
Reference in New Issue
Block a user