From 71a60df367f9788a674bb926369e68c30836c10a Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Tue, 27 Oct 2015 09:43:10 -0500 Subject: [PATCH] backport 'kbuildsysoca always save' commit --- ...ays-save-even-if-no-change-in-.deskt.patch | 101 ++++++++++++++++++ kf5-kservice.spec | 12 ++- 2 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 0013-KBuildSycoca-always-save-even-if-no-change-in-.deskt.patch diff --git a/0013-KBuildSycoca-always-save-even-if-no-change-in-.deskt.patch b/0013-KBuildSycoca-always-save-even-if-no-change-in-.deskt.patch new file mode 100644 index 0000000..0744547 --- /dev/null +++ b/0013-KBuildSycoca-always-save-even-if-no-change-in-.deskt.patch @@ -0,0 +1,101 @@ +From 0f816ab3fada9f57e836da78470003dd24d26a27 Mon Sep 17 00:00:00 2001 +From: David Faure +Date: Mon, 26 Oct 2015 08:59:44 +0100 +Subject: [PATCH 13/13] KBuildSycoca: always save, even if no change in + .desktop file was noticed. + +This fixes the case where a directory is "touched", so when KSycoca +compares directory timestamps it decides to rebuild, but then KBuildSycoca +doesn't find any real change and doesn't save. This can then happen +all over again at the next timestamp check. + +CCBUG: 353203 +REVIEW: 125803 +--- + autotests/ksycocatest.cpp | 3 +++ + src/sycoca/kbuildsycoca.cpp | 12 +++++------- + src/sycoca/ksycoca.cpp | 2 +- + 3 files changed, 9 insertions(+), 8 deletions(-) + +diff --git a/autotests/ksycocatest.cpp b/autotests/ksycocatest.cpp +index f0df0b2..4af759c 100644 +--- a/autotests/ksycocatest.cpp ++++ b/autotests/ksycocatest.cpp +@@ -65,6 +65,9 @@ private Q_SLOTS: + + #ifdef Q_XDG_PLATFORM + qputenv("XDG_DATA_DIRS", QFile::encodeName(m_tempDir.path())); ++ ++ // so that vfolder_menu doesn't go look into /etc and /usr ++ qputenv("XDG_CONFIG_DIRS", QFile::encodeName(m_tempDir.path())); + #else + // We need to make changes to a global dir without messing up the system + QSKIP("This test requires XDG_DATA_DIRS"); +diff --git a/src/sycoca/kbuildsycoca.cpp b/src/sycoca/kbuildsycoca.cpp +index 1deae14..650526b 100644 +--- a/src/sycoca/kbuildsycoca.cpp ++++ b/src/sycoca/kbuildsycoca.cpp +@@ -197,7 +197,6 @@ bool KBuildSycoca::build() + } + + m_ctimeFactory = new KCTimeFactory(this); // This is a build factory too, don't delete!! +- bool uptodate = true; + for (QMap::ConstIterator it1 = allResourcesSubDirs.constBegin(); + it1 != allResourcesSubDirs.constEnd(); + ++it1) { +@@ -255,18 +254,16 @@ bool KBuildSycoca::build() + } + } + if (m_changed || !m_allEntries) { +- uptodate = false; +- //qDebug() << "CHANGED:" << resource; ++ //qDebug() << "CHANGED:" << m_resource; + m_changedResources.append(m_resource); + } + } + +- bool result = !uptodate || (m_ctimeDict && !m_ctimeDict->isEmpty()); + if (m_ctimeDict && !m_ctimeDict->isEmpty()) { + //qDebug() << "Still in time dict:"; + //m_ctimeDict->dump(); + // ## It seems entries filtered out by vfolder are still in there, +- // so we end up always saving ksycoca, i.e. this method never returns false ++ // so on a real system we end up always adding "apps" to m_changedResources + + // Get the list of resources from which some files were deleted + const QStringList resources = m_ctimeDict->remainingResourceList(); +@@ -274,7 +271,9 @@ bool KBuildSycoca::build() + m_changedResources += resources; + } + +- if (result || m_menuTest) { ++ bool result = true; ++ const bool createVFolder = !m_changedResources.isEmpty() || (m_ctimeDict && !m_ctimeDict->isEmpty()); ++ if (createVFolder || m_menuTest) { + m_resource = "apps"; + m_resourceSubdir = QStringLiteral("applications"); + m_currentFactory = d->m_serviceFactory; +@@ -309,7 +308,6 @@ bool KBuildSycoca::build() + } + + if (m_changed || !m_allEntries) { +- uptodate = false; + //qDebug() << "CHANGED:" << m_resource; + m_changedResources.append(m_resource); + } +diff --git a/src/sycoca/ksycoca.cpp b/src/sycoca/ksycoca.cpp +index a692bc8..5744e95 100644 +--- a/src/sycoca/ksycoca.cpp ++++ b/src/sycoca/ksycoca.cpp +@@ -635,7 +635,7 @@ public: + if (mtime > m_now) { + qCDebug(SYCOCA) << fi.filePath() << "has a modification time in the future" << mtime; + } +- qCDebug(SYCOCA) << "timestamp changed:" << fi.filePath() << mtime << ">" << lastStamp; ++ qCDebug(SYCOCA) << "timestamp changed:" << fi.filePath() << mtime << ">" << QDateTime::fromMSecsSinceEpoch(lastStamp); + // no need to continue search + return false; + } +-- +2.5.0 + diff --git a/kf5-kservice.spec b/kf5-kservice.spec index f4b9ba3..3414e6b 100644 --- a/kf5-kservice.spec +++ b/kf5-kservice.spec @@ -3,7 +3,7 @@ Name: kf5-%{framework} Summary: KDE Frameworks 5 Tier 3 solution for advanced plugin and service introspection Version: 5.15.0 -Release: 1%{?dist} +Release: 2%{?dist} # mixture of LGPLv2 and LGPLv2+ (mostly the latter) License: LGPLv2 @@ -23,6 +23,9 @@ Source0: http://download.kde.org/%{stable}/frameworks/%{versiondir}/%{fra # This prevents the stuff getting listed twice, under both System and Settings. Patch0: kservice-5.15.0-xdg-menu.patch +## upstream patches +Patch13: 0013-KBuildSycoca-always-save-even-if-no-change-in-.deskt.patch + BuildRequires: cmake BuildRequires: extra-cmake-modules >= %{versiondir} BuildRequires: kf5-kconfig-devel >= %{versiondir} @@ -53,9 +56,7 @@ developing applications that use %{name}. %prep -%setup -q -n %{framework}-%{version} - -%patch0 -p1 -b .xdg-menu +%autosetup -n %{framework}-%{version} -p1 %build @@ -100,6 +101,9 @@ mkdir -p %{buildroot}%{_kf5_datadir}/kservicetypes5 %changelog +* Tue Oct 27 2015 Rex Dieter 5.15.0-2 +- backport 'kbuildsysoca always save' commit + * Thu Oct 08 2015 Daniel Vrátil - 5.15.0-1 - KDE Frameworks 5.15.0