[kde-doc-english] [kservice] /: Remove code for --checkstamps and --nocheckfiles.
David Faure
faure at kde.org
Thu Sep 10 06:39:51 UTC 2015
Git commit b0c8fd8e64f6e02b781270e548c684a06e3e2948 by David Faure.
Committed on 09/09/2015 at 21:21.
Pushed by dfaure into branch 'master'.
Remove code for --checkstamps and --nocheckfiles.
(the options are kept to avoid breaking hypothetic callers, but do nothing anymore)
--checkstamps was a timestamp comparison to find out if kbuildsycoca should
do nothing. Let's not just call it in that case ;) A similar timestamp check
is in ksycoca.cpp since recently.
--nocheckfiles was an experimental and marked dangerous option,
to speed up KDE startup by only checking the global header (lang and dirs),
but not checking for modified desktop files. I guess the idea was for
binary packages to always ensure that ksycoca is updated. That's a very
long term plan with a fdo desktop-file-index, but not really applicable until then
(what if you install something from sources, on a distro set up that way...).
REVIEW: 125108
M +0 -14 docs/kbuildsycoca5/man-kbuildsycoca5.8.docbook
M +11 -99 src/kbuildsycoca/kbuildsycoca.cpp
http://commits.kde.org/kservice/b0c8fd8e64f6e02b781270e548c684a06e3e2948
diff --git a/docs/kbuildsycoca5/man-kbuildsycoca5.8.docbook b/docs/kbuildsycoca5/man-kbuildsycoca5.8.docbook
index 68e58db..3419e42 100644
--- a/docs/kbuildsycoca5/man-kbuildsycoca5.8.docbook
+++ b/docs/kbuildsycoca5/man-kbuildsycoca5.8.docbook
@@ -80,13 +80,6 @@ it if necessary, when any of the files whose data is cached are changed.
<variablelist>
<varlistentry>
-<term><option>--checkstamps</option></term>
-<listitem>
-<para>Checks the file timestamps of the cache and the resource directories containing the data to be cached, and only updates the database if any of the resource directories have been modified more recently than the cache. Ignored if <option>--nocheckfiles</option> or <option>--noincremental</option> is set.</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
<term><option>--global</option></term>
<listitem>
<para>Ignores any user-set files (in <varname>XDG_DATA_HOME</varname>). This is currently only supported on Unix systems.</para>
@@ -94,13 +87,6 @@ it if necessary, when any of the files whose data is cached are changed.
</varlistentry>
<varlistentry>
-<term><option>--nocheckfiles</option></term>
-<listitem>
-<para>Does not rebuild the cache unless something other than a change in the resource files requires it (such as the format of the cache changing, or <varname>XDG_DATA_DIRS</varname> being changed on a Unix system). Ignored if <option>--global</option> is set.</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
<term><option>--noincremental</option></term>
<listitem>
<para>Rather than using the existing cache and only updating the information that has changed or been added, start with an empty cache. Ignored if <option>--global</option> is set.</para>
diff --git a/src/kbuildsycoca/kbuildsycoca.cpp b/src/kbuildsycoca/kbuildsycoca.cpp
index 3ce7ae4..fc0917d 100644
--- a/src/kbuildsycoca/kbuildsycoca.cpp
+++ b/src/kbuildsycoca/kbuildsycoca.cpp
@@ -559,53 +559,6 @@ void KBuildSycoca::save(QDataStream *str)
str->device()->seek(endOfData);
}
-static bool checkDirTimestamps(const QString &dirname, const QDateTime &stamp)
-{
- QDir dir(dirname);
- const QFileInfoList list = dir.entryInfoList(QDir::NoFilter, QDir::Unsorted);
- if (list.isEmpty()) {
- return true;
- }
-
- foreach (const QFileInfo &fi, list) {
- if (fi.fileName() == "." || fi.fileName() == "..") {
- continue;
- }
- if (fi.lastModified() > stamp) {
- qDebug() << "timestamp changed:" << fi.filePath() << fi.lastModified() << ">" << stamp;
- return false;
- }
- if (fi.isDir() && !checkDirTimestamps(fi.filePath(), stamp)) {
- return false;
- }
- }
- return true;
-}
-
-// check times of last modification of all files on which ksycoca depends,
-// and also their directories
-// if all of them are older than the timestamp in file ksycocastamp, this
-// means that there's no need to rebuild ksycoca
-static bool checkTimestamps(qint64 timestamp, const QStringList &dirs)
-{
- qDebug() << "checking file timestamps";
- const QDateTime stamp = QDateTime::fromMSecsSinceEpoch(timestamp);
- for (QStringList::ConstIterator it = dirs.begin();
- it != dirs.end();
- ++it) {
- QFileInfo inf(*it);
- if (inf.lastModified() > stamp) {
- qDebug() << "timestamp changed:" << *it;
- return false;
- }
- if (!checkDirTimestamps(*it, stamp)) {
- return false;
- }
- }
- qDebug() << "timestamps check ok";
- return true;
-}
-
QStringList KBuildSycoca::factoryResourceDirs()
{
static QStringList *dirs = NULL;
@@ -675,10 +628,10 @@ int main(int argc, char **argv)
"Disable incremental update, re-read everything")));
parser.addOption(QCommandLineOption(QStringLiteral("checkstamps"),
i18nc("@info:shell command-line option",
- "Check file timestamps")));
+ "Check file timestamps (deprecated, no longer having any effect)")));
parser.addOption(QCommandLineOption(QStringLiteral("nocheckfiles"),
i18nc("@info:shell command-line option",
- "Disable checking files (dangerous)")));
+ "Disable checking files (deprecated, no longer having any effect)")));
parser.addOption(QCommandLineOption(QStringLiteral("global"),
i18nc("@info:shell command-line option",
"Create global database")));
@@ -727,66 +680,25 @@ int main(int argc, char **argv)
}
fprintf(stderr, "%s running...\n", KBUILDSYCOCA_EXENAME);
- bool checkfiles = bGlobalDatabase || !parser.isSet(QStringLiteral("nocheckfiles"));
+ bool incremental = !bGlobalDatabase && !parser.isSet(QStringLiteral("noincremental"));
- bool incremental = !bGlobalDatabase && !parser.isSet(QStringLiteral("noincremental")) && checkfiles;
- if (incremental || !checkfiles) {
+ if (incremental) {
KSycoca::disableAutoRebuild(); // Prevent deadlock
if (!KBuildSycoca::checkGlobalHeader()) {
incremental = false;
- checkfiles = true;
KBuildSycoca::clearCaches();
}
}
- bool checkstamps = incremental && parser.isSet(QStringLiteral("checkstamps"));
- qint64 filestamp = 0;
- QStringList oldresourcedirs;
- if (checkstamps) {
- const QString path = KSycoca::absoluteFilePath(bGlobalDatabase ? KSycoca::GlobalDatabase : KSycoca::LocalDatabase) + QStringLiteral("stamp");
- const QByteArray qPath = QFile::encodeName(path);
- s_cSycocaPath = qPath.data(); // Delete timestamps on crash
- QFile ksycocastamp(path);
- if (ksycocastamp.open(QIODevice::ReadOnly)) {
- QDataStream str(&ksycocastamp);
- str.setVersion(QDataStream::Qt_5_3);
-
- if (!str.atEnd()) {
- str >> filestamp;
- }
- if (!str.atEnd()) {
- str >> oldresourcedirs;
- if (oldresourcedirs != KBuildSycoca::existingResourceDirs()) {
- checkstamps = false;
- }
- } else {
- checkstamps = false;
- }
- if (!str.atEnd()) {
- QStringList extraResourceDirs;
- str >> extraResourceDirs;
- oldresourcedirs += extraResourceDirs;
- }
- } else {
- checkstamps = false;
- }
- s_cSycocaPath = 0;
+ KBuildSycoca sycoca(bGlobalDatabase); // Build data base
+ if (parser.isSet(QStringLiteral("track"))) {
+ sycoca.setTrackId(parser.value(QStringLiteral("track")));
}
-
- QStringList changedResources;
-
- if (checkfiles && (!checkstamps || !checkTimestamps(filestamp, oldresourcedirs))) {
-
- KBuildSycoca sycoca(bGlobalDatabase); // Build data base
- if (parser.isSet(QStringLiteral("track"))) {
- sycoca.setTrackId(parser.value(QStringLiteral("track")));
- }
- sycoca.setMenuTest(bMenuTest);
- if (!sycoca.recreate(incremental)) {
- return -1;
- }
- changedResources = sycoca.changedResources();
+ sycoca.setMenuTest(bMenuTest);
+ if (!sycoca.recreate(incremental)) {
+ return -1;
}
+ const QStringList changedResources = sycoca.changedResources();
if (!parser.isSet(QStringLiteral("nosignal"))) {
// Notify ALL applications that have a ksycoca object, using a signal
More information about the kde-doc-english
mailing list