You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
4.0 KiB
102 lines
4.0 KiB
From 0f816ab3fada9f57e836da78470003dd24d26a27 Mon Sep 17 00:00:00 2001
|
|
From: David Faure <faure@kde.org>
|
|
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<QString, QByteArray>::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
|
|
|