commit:     93e60138b73fb5f06b207c433976881aa25a2226
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 31 19:13:11 2019 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Dec 31 19:14:53 2019 +0000
URL:        https://gitweb.gentoo.org/proj/kde.git/commit/?id=93e60138

kde-frameworks/kdoctools: Use upstream docbundledir patch

See also: https://phabricator.kde.org/D26306

Package-Manager: Portage-2.3.84, Repoman-2.3.20
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../kdoctools-5.54.0-gentoo-docbundledir.patch     |  26 ----
 .../files/kdoctools-5.66.0-docbundledir.patch      | 160 +++++++++++++++++++++
 kde-frameworks/kdoctools/kdoctools-9999.ebuild     |   2 +-
 3 files changed, 161 insertions(+), 27 deletions(-)

diff --git 
a/kde-frameworks/kdoctools/files/kdoctools-5.54.0-gentoo-docbundledir.patch 
b/kde-frameworks/kdoctools/files/kdoctools-5.54.0-gentoo-docbundledir.patch
deleted file mode 100644
index cb6c35f19f..0000000000
--- a/kde-frameworks/kdoctools/files/kdoctools-5.54.0-gentoo-docbundledir.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 79f31819b95fcb0bd3d30630f769706923d41609 Mon Sep 17 00:00:00 2001
-From: Andreas Sturmlechner <[email protected]>
-Date: Mon, 28 Jan 2019 22:50:56 +0100
-Subject: [PATCH] xslt.cpp: Add /usr/share/help dir to list of paths containing
- documentation
-
----
- src/xslt.cpp | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/src/xslt.cpp b/src/xslt.cpp
-index 1000e33..a0fbe4c 100644
---- a/src/xslt.cpp
-+++ b/src/xslt.cpp
-@@ -494,5 +494,7 @@ QStringList getKDocToolsCatalogs()
- QStringList KDocTools::documentationDirs()
- {
-     /* List of paths containing documentation */
--    return QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, 
QStringLiteral("doc/HTML"), QStandardPaths::LocateDirectory);
-+    QStringList docDirs = 
QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, 
QStringLiteral("help"), QStandardPaths::LocateDirectory);
-+    
docDirs.append(QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, 
QStringLiteral("doc/HTML"), QStandardPaths::LocateDirectory));
-+    return docDirs;
- }
--- 
-2.20.1
-

diff --git a/kde-frameworks/kdoctools/files/kdoctools-5.66.0-docbundledir.patch 
b/kde-frameworks/kdoctools/files/kdoctools-5.66.0-docbundledir.patch
new file mode 100644
index 0000000000..640e4d8342
--- /dev/null
+++ b/kde-frameworks/kdoctools/files/kdoctools-5.66.0-docbundledir.patch
@@ -0,0 +1,160 @@
+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;
+ }

diff --git a/kde-frameworks/kdoctools/kdoctools-9999.ebuild 
b/kde-frameworks/kdoctools/kdoctools-9999.ebuild
index 1a3604cc37..b367c26dc9 100644
--- a/kde-frameworks/kdoctools/kdoctools-9999.ebuild
+++ b/kde-frameworks/kdoctools/kdoctools-9999.ebuild
@@ -28,7 +28,7 @@ DEPEND="
 "
 RDEPEND="${DEPEND}"
 
-PATCHES=( "${FILESDIR}/${PN}-5.54.0-gentoo-docbundledir.patch" )
+PATCHES=( "${FILESDIR}/${PN}-5.66.0-docbundledir.patch" )
 
 src_configure() {
        local mycmakeargs=(

Reply via email to