commit:     14100fce76cdbb0b029750a6c04f63d93736dca6
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 13 02:10:07 2024 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Wed Nov 13 10:03:31 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=14100fce

dev-qt/qt-creator: fix tests with Qt6.8.0 and build with 6.8.1

Possible this may be for nothing if a new qt-creator releases
before Qt6.8.1 (and 6.8.0 is still masked), but wanted to get
potential blockers for 6.8.1 out of the way now esp. given this
is not currently fixed in the 14.x branch upstream and would need
qt-creator-15.x

Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 .../qt-creator/files/qt-creator-14.0.2-qt681.patch | 141 +++++++++++++++++++++
 dev-qt/qt-creator/qt-creator-14.0.2.ebuild         |   1 +
 2 files changed, 142 insertions(+)

diff --git a/dev-qt/qt-creator/files/qt-creator-14.0.2-qt681.patch 
b/dev-qt/qt-creator/files/qt-creator-14.0.2-qt681.patch
new file mode 100644
index 000000000000..0dbe75feb7c4
--- /dev/null
+++ b/dev-qt/qt-creator/files/qt-creator-14.0.2-qt681.patch
@@ -0,0 +1,141 @@
+Backport of [1]+[2] to fix tests with Qt6.8.0 and build with Qt6.8.1.
+
+There was some refactoring in these files which prevent anything from
+applying cleanly, so this was manually rebased -- hopefully correct
+(fsengine tests pass again, so it should be fine).
+
+[1] https://github.com/qt-creator/qt-creator/commit/81d4e8a3742
+[2] https://github.com/qt-creator/qt-creator/commit/f993fb76ded
+--- a/src/libs/utils/fsengine/diriterator.h
++++ b/src/libs/utils/fsengine/diriterator.h
+@@ -16,4 +16,36 @@
+ namespace Internal {
+ 
++#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
++inline std::pair<QDir::Filters, QDirIterator::IteratorFlags> 
convertQDirListingIteratorFlags(
++    QDirListing::IteratorFlags flags)
++{
++    QDir::Filters filters = QDir::Files | QDir::Dirs | QDir::System | 
QDir::NoDotAndDotDot;
++    QDirIterator::IteratorFlags iteratorFlags = QDirIterator::NoIteratorFlags;
++
++    if (flags & QDirListing::IteratorFlag::ExcludeFiles)
++        filters.setFlag(QDir::Files, false);
++    if (flags & QDirListing::IteratorFlag::ExcludeDirs)
++        filters.setFlag(QDir::Dirs, false);
++    if (flags & QDirListing::IteratorFlag::ExcludeSpecial)
++        filters.setFlag(QDir::System, false);
++    if (flags & QDirListing::IteratorFlag::CaseSensitive)
++        filters.setFlag(QDir::CaseSensitive, true);
++    if (flags & QDirListing::IteratorFlag::IncludeHidden)
++        filters.setFlag(QDir::Hidden, true);
++
++    if (flags & QDirListing::IteratorFlag::IncludeDotAndDotDot) {
++        filters.setFlag(QDir::NoDot, false);
++        filters.setFlag(QDir::NoDotDot, false);
++    }
++
++    if (flags & QDirListing::IteratorFlag::Recursive)
++        iteratorFlags.setFlag(QDirIterator::Subdirectories, true);
++    if (flags & QDirListing::IteratorFlag::FollowDirSymlinks)
++        iteratorFlags.setFlag(QDirIterator::FollowSymlinks, true);
++
++    return {filters, iteratorFlags};
++}
++#endif
++
+ class DirIterator : public QAbstractFileEngineIterator
+ {
+--- a/src/libs/utils/fsengine/fixedlistfsengine.h
++++ b/src/libs/utils/fsengine/fixedlistfsengine.h
+@@ -67,8 +67,14 @@
+ 
+ #if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+-    IteratorUniquePtr beginEntryList(const QString &path,
+-                                     QDir::Filters filters,
+-                                     const QStringList &filterNames) override
++    QAbstractFileEngine::IteratorUniquePtr beginEntryList(
++        const QString &path,
++        QDirListing::IteratorFlags itFlags,
++        const QStringList &filterNames) override
+     {
++        // We do not support recursive or following symlinks for the Fixed 
List engine.
++        Q_ASSERT(itFlags.testFlag(QDirListing::IteratorFlag::Recursive) == 
false);
++
++        const auto [filters, _] = convertQDirListingIteratorFlags(itFlags);
++
+         return std::make_unique<DirIterator>(m_children, path, filters, 
filterNames);
+     }
+--- a/src/libs/utils/fsengine/fsengine_impl.cpp
++++ b/src/libs/utils/fsengine/fsengine_impl.cpp
+@@ -297,11 +297,25 @@
+ 
+ #if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+-QAbstractFileEngine::IteratorUniquePtr FSEngineImpl::beginEntryList(const 
QString &path,
+-                                                                    
QDir::Filters filters,
+-                                                                    const 
QStringList &filterNames)
++QAbstractFileEngine::IteratorUniquePtr FSEngineImpl::beginEntryList(
++    const QString &path, QDirListing::IteratorFlags itFlags, const 
QStringList &filterNames)
++{
++    const auto [filters, iteratorFlags] = 
convertQDirListingIteratorFlags(itFlags);
++
++    FilePaths paths{m_filePath.pathAppended(".")};
++    m_filePath.iterateDirectory(
++        [&paths](const FilePath &p, const FilePathInfo &fi) {
++            paths.append(p);
++            FilePathInfoCache::CachedData *data
++                = new FilePathInfoCache::CachedData{fi, 
QDateTime::currentDateTime().addSecs(60)};
++            g_filePathInfoCache.cache(p, data);
++            return IterationPolicy::Continue;
++        },
++        {filterNames, filters, iteratorFlags});
++
++    return std::make_unique<DirIterator>(std::move(paths), path, filters, 
filterNames);
++}
+ #else
+ QAbstractFileEngine::Iterator *FSEngineImpl::beginEntryList(QDir::Filters 
filters,
+                                                             const QStringList 
&filterNames)
+-#endif
+ {
+     FilePaths paths{m_filePath.pathAppended(".")};
+@@ -317,10 +331,7 @@
+         {filterNames, filters});
+ 
+-#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+-    return std::make_unique<DirIterator>(std::move(paths), path, filters, 
filterNames);
+-#else
+     return new DirIterator(std::move(paths));
+-#endif
+ }
++#endif
+ 
+ qint64 FSEngineImpl::read(char *data, qint64 maxlen)
+--- a/src/libs/utils/fsengine/fsengine_impl.h
++++ b/src/libs/utils/fsengine/fsengine_impl.h
+@@ -60,7 +60,10 @@
+ 
+ #if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+-    IteratorUniquePtr beginEntryList(const QString &path, QDir::Filters 
filters,
+-                                     const QStringList &filterNames) override;
+-    IteratorUniquePtr endEntryList() override { return {}; }
++    IteratorUniquePtr beginEntryList(
++        const QString &path,
++        QDirListing::IteratorFlags filters,
++        const QStringList &filterNames) final;
++
++    IteratorUniquePtr endEntryList() final { return {}; }
+ #else
+     Iterator *beginEntryList(QDir::Filters filters, const QStringList 
&filterNames) override;
+--- a/src/libs/utils/fsengine/fsenginehandler.cpp
++++ b/src/libs/utils/fsengine/fsenginehandler.cpp
+@@ -23,7 +23,8 @@
+ public:
+ #if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+-    IteratorUniquePtr beginEntryList(const QString &path,
+-                                     QDir::Filters filters,
+-                                     const QStringList &filterNames) override
++    IteratorUniquePtr beginEntryList(
++        const QString &path,
++        QDirListing::IteratorFlags filters,
++        const QStringList &filterNames) override
+     {
+         return std::make_unique<FileIteratorWrapper>(

diff --git a/dev-qt/qt-creator/qt-creator-14.0.2.ebuild 
b/dev-qt/qt-creator/qt-creator-14.0.2.ebuild
index 5c8f2609c396..3bd904903799 100644
--- a/dev-qt/qt-creator/qt-creator-14.0.2.ebuild
+++ b/dev-qt/qt-creator/qt-creator-14.0.2.ebuild
@@ -93,6 +93,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-11.0.2-musl-no-execinfo.patch
        "${FILESDIR}"/${PN}-12.0.0-musl-no-malloc-trim.patch
        "${FILESDIR}"/${PN}-14.0.1-clang19.patch
+       "${FILESDIR}"/${PN}-14.0.2-qt681.patch
 )
 
 pkg_setup() {

Reply via email to