diff -Nru baloo-4.12.97/CMakeLists.txt baloo-4.13.0/CMakeLists.txt --- baloo-4.12.97/CMakeLists.txt 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/CMakeLists.txt 2014-04-09 10:33:16.000000000 +0000 @@ -1,8 +1,8 @@ project(baloo) set(BALOO_VERSION_MAJOR 4) -set(BALOO_VERSION_MINOR 12) -set(BALOO_VERSION_RELEASE 97) +set(BALOO_VERSION_MINOR 13) +set(BALOO_VERSION_RELEASE 0) set(BALOO_VERSION "${BALOO_VERSION_MAJOR}.${BALOO_VERSION_MINOR}.${BALOO_VERSION_RELEASE}") @@ -11,7 +11,7 @@ find_package(KDE4 REQUIRED) include(KDE4Defaults) -find_package(KdepimLibs 4.12.97 CONFIG) +find_package(KdepimLibs 4.13.0 CONFIG) set_package_properties(KdepimLibs PROPERTIES DESCRIPTION "The KDEPIM libraries" URL "http://www.kde.org" diff -Nru baloo-4.12.97/debian/changelog baloo-4.13.0/debian/changelog --- baloo-4.12.97/debian/changelog 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/changelog 2014-04-10 20:33:00.000000000 +0000 @@ -1,3 +1,9 @@ +baloo (4:4.13.0-0ubuntu1) trusty; urgency=medium + + * New upstream KDE Software Compilation release + + -- Jonathan Riddell Thu, 10 Apr 2014 21:32:59 +0100 + baloo (4:4.12.97-0ubuntu4) trusty; urgency=medium * Yet more upstream commit imports. Adding patches 50 to 56 in upstream_git/ diff -Nru baloo-4.12.97/debian/control baloo-4.13.0/debian/control --- baloo-4.12.97/debian/control 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/control 2014-04-10 20:33:00.000000000 +0000 @@ -4,9 +4,9 @@ Maintainer: Rohan Garg Build-Depends: debhelper (>= 9.0.0), cmake, pkg-kde-tools, - kdelibs5-dev (>= 4:4.12.97), - kdepimlibs5-dev (>= 4:4.12.97), - libkfilemetadata-dev (>= 4:4.12.97), + kdelibs5-dev (>= 4:4.13.0), + kdepimlibs5-dev (>= 4:4.13.0), + libkfilemetadata-dev (>= 4:4.13.0), libxapian-dev, libqjson-dev, libattr1-dev, diff -Nru baloo-4.12.97/debian/libbaloofiles4.symbols baloo-4.13.0/debian/libbaloofiles4.symbols --- baloo-4.12.97/debian/libbaloofiles4.symbols 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/libbaloofiles4.symbols 2014-04-10 20:33:00.000000000 +0000 @@ -14,7 +14,7 @@ _ZN5Baloo11FileMapping5fetchE12QSqlDatabase@Base 4:4.12.80 _ZN5Baloo11FileMapping5setIdEj@Base 4:4.12.80 _ZN5Baloo11FileMapping6createE12QSqlDatabase@Base 4:4.12.80 - _ZN5Baloo11FileMapping6removeE12QSqlDatabase@Base 4:4.12.97-0ubuntu2 + _ZN5Baloo11FileMapping6removeE12QSqlDatabase@Base 4:4.13.0 _ZN5Baloo11FileMapping6setUrlERK7QString@Base 4:4.12.80 _ZN5Baloo11FileMapping7fetchedEv@Base 4:4.12.80 _ZN5Baloo11FileMappingC1ERK7QString@Base 4:4.12.80 diff -Nru baloo-4.12.97/debian/libbalooxapian4.symbols baloo-4.13.0/debian/libbalooxapian4.symbols --- baloo-4.12.97/debian/libbalooxapian4.symbols 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/libbalooxapian4.symbols 2014-04-10 20:33:00.000000000 +0000 @@ -1,13 +1,13 @@ -# SymbolsHelper-Confirmed: 4:4.12.97-0ubuntu2 i386 +# SymbolsHelper-Confirmed: 4:4.13.0 i386 libbalooxapian.so.4 libbalooxapian4 #MINVER#, baloo _ZN5Baloo14XapianDatabase14deleteDocumentEj@Base 4:4.12.97 _ZN5Baloo14XapianDatabase15replaceDocumentEjRKN6Xapian8DocumentE@Base 4:4.12.97 - _ZN5Baloo14XapianDatabase15replaceDocumentEjRKNS_14XapianDocumentE@Base 4:4.12.97-0ubuntu2 - _ZN5Baloo14XapianDatabase16createWritableDbEv@Base 4:4.12.97-0ubuntu2 + _ZN5Baloo14XapianDatabase15replaceDocumentEjRKNS_14XapianDocumentE@Base 4:4.13.0 + _ZN5Baloo14XapianDatabase16createWritableDbEv@Base 4:4.13.0 _ZN5Baloo14XapianDatabase6commitEv@Base 4:4.12.97 _ZN5Baloo14XapianDatabase8documentEj@Base 4:4.12.97 - _ZN5Baloo14XapianDatabaseC1ERK7QStringb@Base 4:4.12.97-0ubuntu2 - _ZN5Baloo14XapianDatabaseC2ERK7QStringb@Base 4:4.12.97-0ubuntu2 + _ZN5Baloo14XapianDatabaseC1ERK7QStringb@Base 4:4.13.0 + _ZN5Baloo14XapianDatabaseC2ERK7QStringb@Base 4:4.13.0 _ZN5Baloo14XapianDocument11addBoolTermERK7QStringS3_@Base 4:4.12.97 _ZN5Baloo14XapianDocument11addBoolTermEiRK7QString@Base 4:4.12.97 _ZN5Baloo14XapianDocument19fetchTermStartsWithERK10QByteArray@Base 4:4.12.97 @@ -45,14 +45,14 @@ _ZN5Baloo17XapianSearchStoreD2Ev@Base 4:4.12.80 (optional=templinst)_ZN6Xapian5QueryC1IPS0_EENS0_2opET_S4_j@Base 4:4.12.80 (optional=templinst)_ZN6Xapian5QueryC2IPS0_EENS0_2opET_S4_j@Base 4:4.12.80 - _ZNK5Baloo14XapianDocument3docEv@Base 4:4.12.97-0ubuntu2 + _ZNK5Baloo14XapianDocument3docEv@Base 4:4.13.0 _ZTIN5Baloo17XapianSearchStoreE@Base 4:4.12.80 _ZTIN6Xapian12RuntimeErrorE@Base 4:4.12.80 _ZTIN6Xapian13DatabaseErrorE@Base 4:4.12.80 _ZTIN6Xapian16DocNotFoundErrorE@Base 4:4.12.80 _ZTIN6Xapian17DatabaseLockErrorE@Base 4:4.12.97 - _ZTIN6Xapian19DatabaseCreateErrorE@Base 4:4.12.97-0ubuntu2 - _ZTIN6Xapian20DatabaseCorruptErrorE@Base 4:4.12.97-0ubuntu2 + _ZTIN6Xapian19DatabaseCreateErrorE@Base 4:4.13.0 + _ZTIN6Xapian20DatabaseCorruptErrorE@Base 4:4.13.0 _ZTIN6Xapian20DatabaseOpeningErrorE@Base 4:4.12.80 _ZTIN6Xapian21DatabaseModifiedErrorE@Base 4:4.12.80 _ZTIN6Xapian5ErrorE@Base 4:4.12.80 @@ -61,8 +61,8 @@ _ZTSN6Xapian13DatabaseErrorE@Base 4:4.12.80 _ZTSN6Xapian16DocNotFoundErrorE@Base 4:4.12.80 _ZTSN6Xapian17DatabaseLockErrorE@Base 4:4.12.97 - _ZTSN6Xapian19DatabaseCreateErrorE@Base 4:4.12.97-0ubuntu2 - _ZTSN6Xapian20DatabaseCorruptErrorE@Base 4:4.12.97-0ubuntu2 + _ZTSN6Xapian19DatabaseCreateErrorE@Base 4:4.13.0 + _ZTSN6Xapian20DatabaseCorruptErrorE@Base 4:4.13.0 _ZTSN6Xapian20DatabaseOpeningErrorE@Base 4:4.12.80 _ZTSN6Xapian21DatabaseModifiedErrorE@Base 4:4.12.80 _ZTSN6Xapian5ErrorE@Base 4:4.12.80 diff -Nru baloo-4.12.97/debian/patches/series baloo-4.13.0/debian/patches/series --- baloo-4.12.97/debian/patches/series 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/series 2014-04-10 20:33:00.000000000 +0000 @@ -1,56 +0,0 @@ -upstream_git/0001-KCM-Remove-developer-mode.patch -upstream_git/0002-Extractor-Add-a-db-option-to-write-to-a-separate-db.patch -upstream_git/0003-Add-a-fileindexingjobtest.patch -upstream_git/0004-Improve-the-FileIndexingQueue-Test.patch -upstream_git/0005-Commit-Queue-Stop-both-the-timers-after-committing.patch -upstream_git/0006-BasicIndexingQueueTest-Print-io-usage-by-the-basic-i.patch -upstream_git/0007-BasicIndxingQueue-Determine-the-mimetype-without-loo.patch -upstream_git/0008-BasicIndexingTest-Improve-debug-messages-for-io-usag.patch -upstream_git/0009-Autostart-Baloo-in-GNOME-Unity-and-XFCE.patch -upstream_git/0010-sqlite-Enable-WAL-journaling-mode.patch -upstream_git/0011-FileMap-Db-Do-not-set-the-id-as-auto-increment.patch -upstream_git/0012-xattr-the-size-returned-can-be-0.patch -upstream_git/0013-Extractor-Implement-debug-mode.patch -upstream_git/0014-Use-KLocalizedString-instead-of-ki18n.patch -upstream_git/0015-Normalize-email-address-before-to-store-it-in-baloo.patch -upstream_git/0016-Catch-DatabaseError-exception-in-XapianSearchStore.patch -upstream_git/0017-KCM-Always-call-the-cleaner.patch -upstream_git/0018-KCM-Use-dbus-asyncCall-instead-of-send.patch -upstream_git/0019-IndexScheduler-Update-everything-when-the-config-cha.patch -upstream_git/0020-Cleaner-Always-remove-it-from-both-the-databases.patch -upstream_git/0021-Cleaner-Commit-the-changes-every-1000-documents.patch -upstream_git/0022-Cleaner-Do-faster-mimetype-detection.patch -upstream_git/0023-BasicIndexingJob-Do-not-add-the-type-as-file.patch -upstream_git/0024-Catch-Xapian-DatabaseException-in-EmailQuery.patch -upstream_git/0025-IndexerConfigTest-Show-both-fast-and-slow-mimetype.patch -upstream_git/0026-FileIndexingJob-Assert-instead-of-failing-gracefully.patch -upstream_git/0027-Add-autotest-for-the-file-indexing-job.patch -upstream_git/0028-FileIndexingJobTest-Test-when-multiple-files-fail-to.patch -upstream_git/0029-FileIndexingJobTest-Test-timeouts.patch -upstream_git/0030-FileIndexingJob-Improve-logic.patch -upstream_git/0031-FileIndexingJob-Remember-to-disconnect-the-process-b.patch -upstream_git/0032-FileIndexingJob-Remove-unnecessary-check.patch -upstream_git/0033-FileIndexingJob-Minimize-the-number-of-calls-to-the-.patch -upstream_git/0034-FileIndexer-Sync-the-config-file-after-initial-index.patch -upstream_git/0035-XapianDatabase-Add-missing-slots-declaration.patch -upstream_git/0036-IndexSchduler-Decrease-fileIQ-delay-when-idle.patch -upstream_git/0037-Add-a-script-to-keep-creating-and-deleting-files.patch -upstream_git/0038-Index-contactgroup-too.patch -upstream_git/0039-FileIndexerConfig-Use-a-simple-config.patch -upstream_git/0040-FileIndexingJob-Avoid-calling-KStandardDirs-findExe-.patch -upstream_git/0041-FileIndexerConfig-Remove-all-locking-code.patch -upstream_git/0042-MetaDataMover-Remove-internal-queue-and-make-it-sync.patch -upstream_git/0043-XapianDatabase-Make-the-commit-function-blocking.patch -upstream_git/0044-XapianDB-Implement-a-write-only-mode.patch -upstream_git/0045-ContactIndexer-Port-to-the-Baloo-Xapian-library.patch -upstream_git/0046-Runner-Use-the-Baloo-icon.patch -upstream_git/0047-XapianSearchStore-Catch-some-more-exceptions.patch -upstream_git/0048-SVN_SILENT-made-messages-.desktop-file.patch -upstream_git/0049-XapianDatabase-Catch-more-exceptions.patch -#upstream_git/0050-Prepare-4.13.0.patch -upstream_git/0051-SVN_SILENT-made-messages-.desktop-file.patch -upstream_git/0052-XapianDatabase-Catch-even-more-exceptions.patch -upstream_git/0053-EmailTest-Make-it-more-like-the-agent.patch -upstream_git/0054-Email-Test-Print-io-debug-information.patch -upstream_git/0055-BalooShow-Print-a-message-when-no-index-info-was-fou.patch -upstream_git/0056-baloo_file-Autostart-and-enable-drKonqi.patch diff -Nru baloo-4.12.97/debian/patches/upstream_git/0001-KCM-Remove-developer-mode.patch baloo-4.13.0/debian/patches/upstream_git/0001-KCM-Remove-developer-mode.patch --- baloo-4.12.97/debian/patches/upstream_git/0001-KCM-Remove-developer-mode.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0001-KCM-Remove-developer-mode.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -From eb0c51bff2aa4bda6c31a83f489dce9b39afddac Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Thu, 27 Mar 2014 12:59:24 +0100 -Subject: [PATCH 01/56] KCM: Remove developer mode - -This also means that source code is now always indexed. A normal user -typically won't have any source code and the developers can always -exclude that folder from the list of excluded folder. It's way way more -efficient. Mimetype filtering is expensive. - -This speeds up the first level indexing. ---- - src/file/fileexcludefilters.cpp | 3 +-- - src/file/kcm/configwidget.ui | 9 +-------- - src/file/kcm/kcm.cpp | 14 -------------- - src/file/kcm/kcm.h | 1 - - 4 files changed, 2 insertions(+), 25 deletions(-) - -diff --git a/src/file/fileexcludefilters.cpp b/src/file/fileexcludefilters.cpp -index 1888543..6f31a06 100644 ---- a/src/file/fileexcludefilters.cpp -+++ b/src/file/fileexcludefilters.cpp -@@ -166,8 +166,7 @@ QStringList Baloo::sourceCodeMimeTypes() - - QStringList Baloo::defaultExcludeMimetypes() - { -- // By default we want to index everything apart from source code -- return sourceCodeMimeTypes(); -+ return QStringList(); - } - - int Baloo::defaultExcludeMimetypesVersion() -diff --git a/src/file/kcm/configwidget.ui b/src/file/kcm/configwidget.ui -index 32b0b6b..484ec2c 100644 ---- a/src/file/kcm/configwidget.ui -+++ b/src/file/kcm/configwidget.ui -@@ -1,6 +1,6 @@ - - -- Sebastian Trueg -+ Vishesh Handa - ConfigWidget - - -@@ -55,13 +55,6 @@ - - - -- -- -- Enable Developer Mode -- -- -- -- - - - Qt::Vertical -diff --git a/src/file/kcm/kcm.cpp b/src/file/kcm/kcm.cpp -index 7e83210..354392b 100644 ---- a/src/file/kcm/kcm.cpp -+++ b/src/file/kcm/kcm.cpp -@@ -69,8 +69,6 @@ ServerConfigModule::ServerConfigModule(QWidget* parent, const QVariantList& args - - connect(m_folderSelectionWidget, SIGNAL(changed()), - this, SLOT(changed())); -- connect(m_checkboxSourceCode, SIGNAL(toggled(bool)), -- this, SLOT(changed())); - } - - -@@ -89,10 +87,6 @@ void ServerConfigModule::load() - QStringList excludeFolders = group.readPathEntry("exclude folders", QStringList()); - m_folderSelectionWidget->setFolders(includeFolders, excludeFolders); - -- // MimeTypes -- QStringList mimetypes = config.group("General").readEntry("exclude mimetypes", defaultExcludeMimetypes()); -- -- m_oldExcludeMimetypes = mimetypes; - m_oldExcludeFolders = excludeFolders; - m_oldIncludeFolders = includeFolders; - -@@ -117,12 +111,6 @@ void ServerConfigModule::save() - config.group("General").writePathEntry("folders", includeFolders); - config.group("General").writePathEntry("exclude folders", excludeFolders); - -- QStringList excludeMimetypes; -- if (m_checkboxSourceCode->isChecked()) -- excludeMimetypes = sourceCodeMimeTypes(); -- -- config.group("General").writeEntry("exclude mimetypes", excludeMimetypes); -- - // Start Baloo - if (indexingEnabled) { - const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file")); -@@ -143,8 +131,6 @@ void ServerConfigModule::save() - cleaningRequired = true; - else if (excludeFolders != m_oldExcludeFolders) - cleaningRequired = true; -- else if (excludeMimetypes != m_oldExcludeMimetypes) -- cleaningRequired = true; - - if (cleaningRequired) { - const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file_cleaner")); -diff --git a/src/file/kcm/kcm.h b/src/file/kcm/kcm.h -index 2e7a534..ae76af4 100644 ---- a/src/file/kcm/kcm.h -+++ b/src/file/kcm/kcm.h -@@ -42,7 +42,6 @@ public Q_SLOTS: - private: - QStringList m_oldIncludeFolders; - QStringList m_oldExcludeFolders; -- QStringList m_oldExcludeMimetypes; - }; - } - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0002-Extractor-Add-a-db-option-to-write-to-a-separate-db.patch baloo-4.13.0/debian/patches/upstream_git/0002-Extractor-Add-a-db-option-to-write-to-a-separate-db.patch --- baloo-4.12.97/debian/patches/upstream_git/0002-Extractor-Add-a-db-option-to-write-to-a-separate-db.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0002-Extractor-Add-a-db-option-to-write-to-a-separate-db.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -From 9a96bd2f8990bcd160c385d557473a8972578f0f Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Thu, 27 Mar 2014 13:12:27 +0100 -Subject: [PATCH 02/56] Extractor: Add a --db option to write to a separate db - -This is very useful when debugging a particular extractor and you want -to use a fresh / temporary database. ---- - src/file/extractor/app.cpp | 10 ++++++++-- - src/file/extractor/main.cpp | 2 ++ - 2 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/src/file/extractor/app.cpp b/src/file/extractor/app.cpp -index 2a2b7f7..33f6eda 100644 ---- a/src/file/extractor/app.cpp -+++ b/src/file/extractor/app.cpp -@@ -46,7 +46,14 @@ App::App(QObject* parent) - : QObject(parent) - , m_termCount(0) - { -- m_path = KGlobal::dirs()->localxdgdatadir() + "baloo/file"; -+ const KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); -+ -+ if (!args->getOption("db").isEmpty()) { -+ m_path = args->getOption("db"); -+ } -+ else { -+ m_path = KGlobal::dirs()->localxdgdatadir() + "baloo/file"; -+ } - - m_db.setPath(m_path); - if (!m_db.init()) { -@@ -57,7 +64,6 @@ App::App(QObject* parent) - connect(m_db.xapianDatabase(), SIGNAL(committed()), - this, SLOT(slotCommitted())); - -- const KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); - m_bData = args->isSet("bdata"); - - m_results.reserve(args->count()); -diff --git a/src/file/extractor/main.cpp b/src/file/extractor/main.cpp -index ec77e96..ec9dce0 100644 ---- a/src/file/extractor/main.cpp -+++ b/src/file/extractor/main.cpp -@@ -50,6 +50,8 @@ int main(int argc, char* argv[]) - options.add("+[url]", ki18n("The URL/id of the files to be indexed")); - options.add("debug", ki18n("Print the data being indexed")); - options.add("bdata", ki18n("Print the QVariantMap in Base64 encoding")); -+ // FIXME: Set a proper string after the freeze. This option is just for debugging -+ options.add("db ", ki18n("")); - - KCmdLineArgs::addCmdLineOptions(options); - const KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0003-Add-a-fileindexingjobtest.patch baloo-4.13.0/debian/patches/upstream_git/0003-Add-a-fileindexingjobtest.patch --- baloo-4.12.97/debian/patches/upstream_git/0003-Add-a-fileindexingjobtest.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0003-Add-a-fileindexingjobtest.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,189 +0,0 @@ -From de39e751d09a16a3f3ef278e2e9755f193074111 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Thu, 27 Mar 2014 13:29:12 +0100 -Subject: [PATCH 03/56] Add a fileindexingjobtest - -This runs the basiciq over all the files and then calls the file -indexing job on each file individually instead of in batches like the -file indexing queue does. ---- - src/file/fileindexingjob.cpp | 10 ++++ - src/file/fileindexingjob.h | 8 ++++ - src/file/tests/CMakeLists.txt | 25 ++++++++++ - src/file/tests/fileindexingqueuetest.cpp | 79 ++++++++++++++++++++++++++++++++ - 4 files changed, 122 insertions(+) - create mode 100644 src/file/tests/fileindexingqueuetest.cpp - -diff --git a/src/file/fileindexingjob.cpp b/src/file/fileindexingjob.cpp -index 1ed8212..d20dfe4 100644 ---- a/src/file/fileindexingjob.cpp -+++ b/src/file/fileindexingjob.cpp -@@ -78,6 +78,10 @@ void FileIndexingJob::start(const QVector& files) - QStringList args; - Q_FOREACH (const uint& file, files) - args << QString::number(file); -+ -+ if (!m_customDbPath.isEmpty()) { -+ args << "--db" << m_customDbPath; -+ } - kDebug() << args; - - connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), -@@ -142,4 +146,10 @@ void FileIndexingJob::slotProcessTimerTimeout() - slotIndexedFile(1, QProcess::CrashExit); - } - -+void FileIndexingJob::setCustomDbPath(const QString& path) -+{ -+ m_customDbPath = path; -+} -+ -+ - #include "fileindexingjob.moc" -diff --git a/src/file/fileindexingjob.h b/src/file/fileindexingjob.h -index 666667b..1c2c321 100644 ---- a/src/file/fileindexingjob.h -+++ b/src/file/fileindexingjob.h -@@ -41,6 +41,12 @@ class FileIndexingJob : public KJob - public: - FileIndexingJob(const QVector& files, QObject* parent = 0); - -+ /** -+ * Set a custom path which should be sent to the baloo_file_extractor -+ * to use for the database. This is useful when debugging. -+ */ -+ void setCustomDbPath(const QString& path); -+ - virtual void start(); - - Q_SIGNALS: -@@ -61,6 +67,8 @@ private: - - QProcess* m_process; - QTimer* m_processTimer; -+ -+ QString m_customDbPath; - }; - } - -diff --git a/src/file/tests/CMakeLists.txt b/src/file/tests/CMakeLists.txt -index 145adc2..75a7afb 100644 ---- a/src/file/tests/CMakeLists.txt -+++ b/src/file/tests/CMakeLists.txt -@@ -38,3 +38,28 @@ target_link_libraries(basicindexingqueuetest - baloocore - balooxapian - ) -+ -+kde4_add_executable(fileindexingqueuetest -+ fileindexingqueuetest.cpp -+ ../fileindexingjob.cpp -+ ../fileindexerconfig.cpp -+ ../regexpcache.cpp -+ ../fileexcludefilters.cpp -+ ../basicindexingqueue.cpp -+ ../indexingqueue.cpp -+ ../basicindexingjob.cpp -+ ../database.cpp -+ ../lib/filemapping.cpp -+ ../commitqueue.cpp -+) -+ -+target_link_libraries(fileindexingqueuetest -+ ${QT_QTCORE_LIBRARY} -+ ${QT_QTSQL_LIBRARY} -+ ${KDE4_KDECORE_LIBS} -+ ${KDE4_KIO_LIBS} -+ ${XAPIAN_LIBRARIES} -+ ${KFILEMETADATA_LIBRARY} -+ baloocore -+ balooxapian -+) -diff --git a/src/file/tests/fileindexingqueuetest.cpp b/src/file/tests/fileindexingqueuetest.cpp -new file mode 100644 -index 0000000..67ff9ab ---- /dev/null -+++ b/src/file/tests/fileindexingqueuetest.cpp -@@ -0,0 +1,79 @@ -+/* -+ * This file is part of the KDE Baloo Project -+ * Copyright (C) 2014 Vishesh Handa -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) version 3, or any -+ * later version accepted by the membership of KDE e.V. (or its -+ * successor approved by the membership of KDE e.V.), which shall -+ * act as a proxy defined in Section 6 of version 3 of the license. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library. If not, see . -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include "../basicindexingqueue.h" -+#include "../fileindexingjob.h" -+#include "../commitqueue.h" -+#include "../database.h" -+#include "../fileindexerconfig.h" -+#include "../lib/filemapping.h" -+ -+int main(int argc, char** argv) -+{ -+ KTempDir tempDir; -+ -+ Database db; -+ db.setPath(tempDir.name()); -+ db.init(); -+ -+ Baloo::FileIndexerConfig config; -+ QCoreApplication app(argc, argv); -+ -+ Baloo::BasicIndexingQueue basicIQ(&db, &config); -+ QObject::connect(&basicIQ, SIGNAL(finishedIndexing()), &app, SLOT(quit())); -+ -+ Baloo::CommitQueue commitQueue(&db); -+ QObject::connect(&basicIQ, SIGNAL(newDocument(uint,Xapian::Document)), -+ &commitQueue, SLOT(add(uint,Xapian::Document))); -+ -+ basicIQ.enqueue(Baloo::FileMapping(QDir::homePath())); -+ app.exec(); -+ -+ commitQueue.commit(); -+ -+ // Now the file indexing -+ Xapian::Database* xdb = db.xapianDatabase()->db(); -+ Xapian::Enquire enquire(*xdb); -+ enquire.set_query(Xapian::Query("Z1")); -+ -+ Xapian::MSet mset = enquire.get_mset(0, 50000); -+ Xapian::MSetIterator it = mset.begin(); -+ -+ QTime timer; -+ timer.start(); -+ for (; it != mset.end(); it++) { -+ QVector files; -+ files << *it; -+ -+ Baloo::FileIndexingJob* job = new Baloo::FileIndexingJob(files); -+ job->setCustomDbPath(db.path()); -+ job->exec(); -+ } -+ -+ qDebug() << "Elapsed:" << timer.elapsed(); -+ return 0; -+} --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0004-Improve-the-FileIndexingQueue-Test.patch baloo-4.13.0/debian/patches/upstream_git/0004-Improve-the-FileIndexingQueue-Test.patch --- baloo-4.12.97/debian/patches/upstream_git/0004-Improve-the-FileIndexingQueue-Test.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0004-Improve-the-FileIndexingQueue-Test.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,262 +0,0 @@ -From 6890a28af3eed5c2b2428d8cc0e5e960ef8ed3b8 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Thu, 27 Mar 2014 16:07:48 +0100 -Subject: [PATCH 04/56] Improve the FileIndexingQueue Test - -It now prints out information about how long each file took along with -average statistics per mimetype. ---- - src/file/tests/CMakeLists.txt | 2 +- - src/file/tests/fileindexer.cpp | 88 ++++++++++++++++++++++++++++++++ - src/file/tests/fileindexer.h | 61 ++++++++++++++++++++++ - src/file/tests/fileindexingqueuetest.cpp | 41 ++++++++++++--- - 4 files changed, 183 insertions(+), 9 deletions(-) - create mode 100644 src/file/tests/fileindexer.cpp - create mode 100644 src/file/tests/fileindexer.h - -diff --git a/src/file/tests/CMakeLists.txt b/src/file/tests/CMakeLists.txt -index 75a7afb..102c981 100644 ---- a/src/file/tests/CMakeLists.txt -+++ b/src/file/tests/CMakeLists.txt -@@ -41,7 +41,7 @@ target_link_libraries(basicindexingqueuetest - - kde4_add_executable(fileindexingqueuetest - fileindexingqueuetest.cpp -- ../fileindexingjob.cpp -+ fileindexer.cpp - ../fileindexerconfig.cpp - ../regexpcache.cpp - ../fileexcludefilters.cpp -diff --git a/src/file/tests/fileindexer.cpp b/src/file/tests/fileindexer.cpp -new file mode 100644 -index 0000000..763fa3a ---- /dev/null -+++ b/src/file/tests/fileindexer.cpp -@@ -0,0 +1,88 @@ -+/* -+ * -+ * Copyright (C) 2014 Vishesh Handa -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ * -+ */ -+ -+#include "fileindexer.h" -+ -+#include -+#include -+ -+#include -+#include -+ -+using namespace Baloo; -+ -+FileIndexer::FileIndexer(uint id, const QString& url) -+ : KJob() -+ , m_id(id) -+ , m_url(url) -+ , m_process(0) -+{ -+} -+ -+void FileIndexer::setCustomPath(const QString& path) -+{ -+ m_customPath = path; -+} -+ -+void FileIndexer::start() -+{ -+ QTimer::singleShot(0, this, SLOT(doStart())); -+} -+ -+void FileIndexer::doStart() -+{ -+ // Get the mimetype - used for stats later -+ m_mimeType = KMimeType::findByUrl(QUrl::fromLocalFile(m_url))->name(); -+ -+ // setup the external process which does the actual indexing -+ const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file_extractor")); -+ -+ QStringList args; -+ args << QString::number(m_id); -+ args << "--db" << m_customPath; -+ -+ m_process = new QProcess(this); -+ connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), -+ this, SLOT(slotIndexedFile(int,QProcess::ExitStatus))); -+ -+ m_process->setProcessChannelMode(QProcess::SeparateChannels); -+ -+ m_timer.start(); -+ m_process->start(exe, args); -+} -+ -+void FileIndexer::slotIndexedFile(int returnCode, QProcess::ExitStatus status) -+{ -+ m_elapsed = m_timer.elapsed(); -+ -+ emitResult(); -+ return; -+} -+ -+int FileIndexer::elapsed() const -+{ -+ return m_elapsed; -+} -+ -+QString FileIndexer::mimeType() const -+{ -+ return m_mimeType; -+} -+ -diff --git a/src/file/tests/fileindexer.h b/src/file/tests/fileindexer.h -new file mode 100644 -index 0000000..cafa1e5 ---- /dev/null -+++ b/src/file/tests/fileindexer.h -@@ -0,0 +1,61 @@ -+/* -+ * -+ * Copyright (C) 2014 Vishesh Handa -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ * -+ */ -+ -+#ifndef BALOO_FILEINDEXER_H -+#define BALOO_FILEINDEXER_H -+ -+#include -+#include -+ -+#include -+ -+namespace Baloo { -+ -+class FileIndexer : public KJob -+{ -+ Q_OBJECT -+public: -+ FileIndexer(uint id, const QString& url); -+ -+ virtual void start(); -+ void setCustomPath(const QString& path); -+ -+ QString mimeType() const; -+ int elapsed() const; -+ -+private Q_SLOTS: -+ void doStart(); -+ void slotIndexedFile(int returnCode, QProcess::ExitStatus status); -+ -+private: -+ int m_id; -+ QString m_url; -+ QString m_mimeType; -+ -+ QString m_customPath; -+ QProcess* m_process; -+ -+ QTime m_timer; -+ int m_elapsed; -+}; -+ -+} -+ -+#endif // BALOO_FILEINDEXER_H -diff --git a/src/file/tests/fileindexingqueuetest.cpp b/src/file/tests/fileindexingqueuetest.cpp -index 67ff9ab..3e131f3 100644 ---- a/src/file/tests/fileindexingqueuetest.cpp -+++ b/src/file/tests/fileindexingqueuetest.cpp -@@ -25,13 +25,24 @@ - #include - #include - -+#include "fileindexer.h" -+ - #include "../basicindexingqueue.h" --#include "../fileindexingjob.h" - #include "../commitqueue.h" - #include "../database.h" - #include "../fileindexerconfig.h" - #include "../lib/filemapping.h" - -+namespace { -+ QString contents(const QString& url) { -+ QFile file(url); -+ file.open(QIODevice::ReadOnly); -+ -+ QTextStream stream(&file); -+ return stream.readAll(); -+ } -+} -+ - int main(int argc, char** argv) - { - KTempDir tempDir; -@@ -63,17 +74,31 @@ int main(int argc, char** argv) - Xapian::MSet mset = enquire.get_mset(0, 50000); - Xapian::MSetIterator it = mset.begin(); - -- QTime timer; -- timer.start(); -+ QHash m_timePerType; -+ QHash m_numPerType; -+ -+ uint totalTime = 0; - for (; it != mset.end(); it++) { -- QVector files; -- files << *it; -+ Baloo::FileMapping fileMap(*it); -+ if (!fileMap.fetch(db.sqlDatabase())) -+ continue; - -- Baloo::FileIndexingJob* job = new Baloo::FileIndexingJob(files); -- job->setCustomDbPath(db.path()); -+ Baloo::FileIndexer* job = new Baloo::FileIndexer(fileMap.id(), fileMap.url()); -+ job->setCustomPath(db.path()); - job->exec(); -+ -+ qDebug() << fileMap.id() << fileMap.url() << job->mimeType() << job->elapsed(); -+ totalTime += job->elapsed(); -+ -+ m_timePerType[job->mimeType()] += job->elapsed(); -+ m_numPerType[job->mimeType()] += 1; - } - -- qDebug() << "Elapsed:" << timer.elapsed(); -+ qDebug() << "\n\n"; -+ Q_FOREACH (const QString& type, m_timePerType.uniqueKeys()) { -+ double averageTime = m_timePerType.value(type) / m_numPerType.value(type); -+ qDebug() << type << averageTime; -+ } -+ qDebug() << "Total Elapsed:" << totalTime; - return 0; - } --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0005-Commit-Queue-Stop-both-the-timers-after-committing.patch baloo-4.13.0/debian/patches/upstream_git/0005-Commit-Queue-Stop-both-the-timers-after-committing.patch --- baloo-4.12.97/debian/patches/upstream_git/0005-Commit-Queue-Stop-both-the-timers-after-committing.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0005-Commit-Queue-Stop-both-the-timers-after-committing.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -From c127b6d1f30234707ebe7e444ab2f2d91b31953c Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Thu, 27 Mar 2014 19:31:40 +0100 -Subject: [PATCH 05/56] Commit Queue: Stop both the timers after committing - ---- - src/file/commitqueue.cpp | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/file/commitqueue.cpp b/src/file/commitqueue.cpp -index fafaaa1..b59bb5d 100644 ---- a/src/file/commitqueue.cpp -+++ b/src/file/commitqueue.cpp -@@ -86,4 +86,7 @@ void Baloo::CommitQueue::commit() - kDebug() << "SQL Committed"; - - m_db->xapianDatabase()->commit(); -+ -+ m_smallTimer.stop(); -+ m_largeTimer.stop(); - } --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0006-BasicIndexingQueueTest-Print-io-usage-by-the-basic-i.patch baloo-4.13.0/debian/patches/upstream_git/0006-BasicIndexingQueueTest-Print-io-usage-by-the-basic-i.patch --- baloo-4.12.97/debian/patches/upstream_git/0006-BasicIndexingQueueTest-Print-io-usage-by-the-basic-i.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0006-BasicIndexingQueueTest-Print-io-usage-by-the-basic-i.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -From 2d4ef34670a57a5076511cf6f1bea16cff73ffad Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Thu, 27 Mar 2014 19:32:09 +0100 -Subject: [PATCH 06/56] BasicIndexingQueueTest: Print io usage by the basic - indexing - ---- - src/file/tests/basicindexingqueuetest.cpp | 22 ++++++++++++++++++++++ - 1 file changed, 22 insertions(+) - -diff --git a/src/file/tests/basicindexingqueuetest.cpp b/src/file/tests/basicindexingqueuetest.cpp -index bb28ca9..60fbc30 100644 ---- a/src/file/tests/basicindexingqueuetest.cpp -+++ b/src/file/tests/basicindexingqueuetest.cpp -@@ -55,6 +55,28 @@ int main(int argc, char** argv) - timer.start(); - int ret = app.exec(); - -+ commitQueue.commit(); - qDebug() << "Elapsed:" << timer.elapsed(); -+ -+ // Print the io usage -+ QFile file("/proc/self/io"); -+ file.open(QIODevice::ReadOnly | QIODevice::Text); -+ -+ QTextStream fs(&file); -+ QString str = fs.readAll(); -+ -+ QTextStream stream(&str); -+ while (!stream.atEnd()) { -+ QString str = stream.readLine(); -+ if (str.startsWith("rchar")) { -+ ulong amt = str.mid(QString("rchar: ").size()).toULong(); -+ qDebug() << "Read:" << amt / 1024 << "kb"; -+ } -+ if (str.startsWith("wchar")) { -+ ulong amt = str.mid(QString("wchar: ").size()).toULong(); -+ qDebug() << "Written:" << amt / 1024 << "kb"; -+ } -+ } -+ - return ret; - } --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0007-BasicIndxingQueue-Determine-the-mimetype-without-loo.patch baloo-4.13.0/debian/patches/upstream_git/0007-BasicIndxingQueue-Determine-the-mimetype-without-loo.patch --- baloo-4.12.97/debian/patches/upstream_git/0007-BasicIndxingQueue-Determine-the-mimetype-without-loo.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0007-BasicIndxingQueue-Determine-the-mimetype-without-loo.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -From 0f7d29f09e72357217ba10de8de5f67aa0b69c64 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Thu, 27 Mar 2014 19:39:45 +0100 -Subject: [PATCH 07/56] BasicIndxingQueue: Determine the mimetype without - looking into the file - -Baloo indexing happens in two phases - Phase 1 (Basic) and Phase 2 -(File). During phase 1 only the basic stat info + mimetype + xattr are -stored. During phase 2 the file's contents are indexed. - -Currently phase 1 was also looking into the contents of the file to -determine the mimetype. This was causing very high IO usage during the -inital indexing. We now determine the mimetype only using the url, and -do a proper mimetype analysis in Phase 2. - -DIGEST: Reduce io usage during initial indexing ---- - src/file/basicindexingqueue.cpp | 6 +++++- - src/file/extractor/app.cpp | 21 ++++++++------------- - 2 files changed, 13 insertions(+), 14 deletions(-) - -diff --git a/src/file/basicindexingqueue.cpp b/src/file/basicindexingqueue.cpp -index 654ad3f..f165972 100644 ---- a/src/file/basicindexingqueue.cpp -+++ b/src/file/basicindexingqueue.cpp -@@ -96,7 +96,11 @@ bool BasicIndexingQueue::process(FileMapping& file, UpdateDirFlags flags) - { - bool startedIndexing = false; - -- QString mimetype = KMimeType::findByUrl(QUrl::fromLocalFile(file.url()))->name(); -+ // This mimetype may not be completely accurate, but that's okay. This is -+ // just the initial phase of indexing. The second phase can try to find -+ // a more accurate mimetype. -+ QString mimetype = KMimeType::findByUrl(QUrl::fromLocalFile(file.url()), 0, -+ true /*is Local*/, true /*Fast*/)->name(); - - bool forced = flags & ForceUpdate; - bool recursive = flags & UpdateRecursive; -diff --git a/src/file/extractor/app.cpp b/src/file/extractor/app.cpp -index 33f6eda..37000c2 100644 ---- a/src/file/extractor/app.cpp -+++ b/src/file/extractor/app.cpp -@@ -129,19 +129,14 @@ void App::processNextUrl() - } - } - -- Xapian::Document doc; -- if (file.fetched()) { -- try { -- doc = m_db.xapianDatabase()->db()->get_document(file.id()); -- } -- catch (const Xapian::DocNotFoundError&) { -- BasicIndexingJob basicIndexer(&m_db.sqlDatabase(), file, mimetype); -- basicIndexer.index(); -- -- file.setId(basicIndexer.id()); -- doc = basicIndexer.document(); -- } -- } -+ // We always run the basic indexing again. This is mostly so that the proper -+ // mimetype is set and we get proper type information. -+ // The mimetype fetched in the BasicIQ is fast but not accurate -+ BasicIndexingJob basicIndexer(&m_db.sqlDatabase(), file, mimetype); -+ basicIndexer.index(); -+ -+ file.setId(basicIndexer.id()); -+ Xapian::Document doc = basicIndexer.document(); - - Result result(url, mimetype); - result.setId(file.id()); --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0008-BasicIndexingTest-Improve-debug-messages-for-io-usag.patch baloo-4.13.0/debian/patches/upstream_git/0008-BasicIndexingTest-Improve-debug-messages-for-io-usag.patch --- baloo-4.12.97/debian/patches/upstream_git/0008-BasicIndexingTest-Improve-debug-messages-for-io-usag.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0008-BasicIndexingTest-Improve-debug-messages-for-io-usag.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -From 1f49eeec80efcffb7f808cbd4830dab66aefc62f Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Fri, 28 Mar 2014 10:33:25 +0100 -Subject: [PATCH 08/56] BasicIndexingTest: Improve debug messages for io usage - ---- - src/file/tests/basicindexingqueuetest.cpp | 29 ++++++++++++++++++++++++----- - 1 file changed, 24 insertions(+), 5 deletions(-) - -diff --git a/src/file/tests/basicindexingqueuetest.cpp b/src/file/tests/basicindexingqueuetest.cpp -index 60fbc30..bea8bcb 100644 ---- a/src/file/tests/basicindexingqueuetest.cpp -+++ b/src/file/tests/basicindexingqueuetest.cpp -@@ -65,18 +65,37 @@ int main(int argc, char** argv) - QTextStream fs(&file); - QString str = fs.readAll(); - -+ qDebug() << "------- IO ---------"; - QTextStream stream(&str); - while (!stream.atEnd()) { - QString str = stream.readLine(); -- if (str.startsWith("rchar")) { -- ulong amt = str.mid(QString("rchar: ").size()).toULong(); -+ -+ QString rchar("rchar: "); -+ if (str.startsWith(rchar)) { -+ ulong amt = str.mid(rchar.size()).toULong(); - qDebug() << "Read:" << amt / 1024 << "kb"; - } -- if (str.startsWith("wchar")) { -- ulong amt = str.mid(QString("wchar: ").size()).toULong(); -- qDebug() << "Written:" << amt / 1024 << "kb"; -+ -+ QString wchar("wchar: "); -+ if (str.startsWith(wchar)) { -+ ulong amt = str.mid(wchar.size()).toULong(); -+ qDebug() << "Write:" << amt / 1024 << "kb"; -+ } -+ -+ QString read("read_bytes: "); -+ if (str.startsWith(read)) { -+ ulong amt = str.mid(read.size()).toULong(); -+ qDebug() << "Actual Reads:" << amt / 1024 << "kb"; -+ } -+ -+ QString write("write_bytes: "); -+ if (str.startsWith(write)) { -+ ulong amt = str.mid(write.size()).toULong(); -+ qDebug() << "Actual Writes:" << amt / 1024 << "kb"; - } - } -+ qDebug() << "\nThe actual read/writes may be 0 because of an existing" -+ << "cache and /tmp being memory mapped"; - - return ret; - } --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0009-Autostart-Baloo-in-GNOME-Unity-and-XFCE.patch baloo-4.13.0/debian/patches/upstream_git/0009-Autostart-Baloo-in-GNOME-Unity-and-XFCE.patch --- baloo-4.12.97/debian/patches/upstream_git/0009-Autostart-Baloo-in-GNOME-Unity-and-XFCE.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0009-Autostart-Baloo-in-GNOME-Unity-and-XFCE.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -From a7377e0cca4f63ca4ce56bef87ac1f82dd219970 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Fri, 28 Mar 2014 12:03:46 +0100 -Subject: [PATCH 09/56] Autostart Baloo in GNOME, Unity and XFCE - -Baloo should always be running otherwise it will not pick up file -changes, specially moves. ---- - src/file/baloo_file.desktop | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/src/file/baloo_file.desktop b/src/file/baloo_file.desktop -index 7fb8a72..c02bd58 100644 ---- a/src/file/baloo_file.desktop -+++ b/src/file/baloo_file.desktop -@@ -3,8 +3,11 @@ Type=Service - Exec=baloo_file - X-KDE-StartupNotify=false - X-KDE-autostart-condition=baloofilerc:Basic Settings:Enabled:true --OnlyShowIn=KDE; - X-KDE-autostart-phase=0 -+X-GNOME-Autostart-enabled=true -+OnlyShowIn=KDE;GNOME;Unity;XFCE -+NoDisplay=true -+ - Name=Baloo File Daemon - Name[bs]=Baloo datotečni demon - Name[ca]=Dimoni de fitxers Baloo --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0010-sqlite-Enable-WAL-journaling-mode.patch baloo-4.13.0/debian/patches/upstream_git/0010-sqlite-Enable-WAL-journaling-mode.patch --- baloo-4.12.97/debian/patches/upstream_git/0010-sqlite-Enable-WAL-journaling-mode.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0010-sqlite-Enable-WAL-journaling-mode.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -From a94b4283574bae7dee0419d9a9c3195af82b0e96 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Fri, 28 Mar 2014 12:07:01 +0100 -Subject: [PATCH 10/56] sqlite: Enable WAL journaling mode - -This decreases the number of writes we're doing by about half. With -about 11k files it goes down from 200mb to about 100mb. - -This can be checked by running the basicindexingqueue test ---- - src/file/database.cpp | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/src/file/database.cpp b/src/file/database.cpp -index 8e54f18..6612459 100644 ---- a/src/file/database.cpp -+++ b/src/file/database.cpp -@@ -85,6 +85,16 @@ bool Database::init() - return false; - } - -+ // -+ // WAL Journaling mode has much lower io writes than the traditional journal -+ // based indexing. -+ // -+ ret = query.exec("PRAGMA journal_mode = WAL"); -+ if (!ret) { -+ kDebug() << "Could not set WAL journaling mode" << query.lastError().text(); -+ return false; -+ } -+ - m_initialized = true; - return true; - } --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0011-FileMap-Db-Do-not-set-the-id-as-auto-increment.patch baloo-4.13.0/debian/patches/upstream_git/0011-FileMap-Db-Do-not-set-the-id-as-auto-increment.patch --- baloo-4.12.97/debian/patches/upstream_git/0011-FileMap-Db-Do-not-set-the-id-as-auto-increment.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0011-FileMap-Db-Do-not-set-the-id-as-auto-increment.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -From 6d5f9746494d19610c07d79e5a9a07d844667127 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Fri, 28 Mar 2014 14:30:32 +0100 -Subject: [PATCH 11/56] FileMap Db: Do not set the id as auto-increment - -When a column is set as auto-increment an additional table -sqlite_sequence is created which stores the highest rowid. From that -point a rowid < that number is not accepted. We do not care that the -rowids be always increasing. We just need them to be unique and that is -guarenteed. - -This saves us a about 16 mb when running through the -basicindexingqueuetest for 11k files. ---- - src/file/database.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/file/database.cpp b/src/file/database.cpp -index 6612459..c841b99 100644 ---- a/src/file/database.cpp -+++ b/src/file/database.cpp -@@ -72,7 +72,7 @@ bool Database::init() - - QSqlQuery query(*m_sqlDb); - bool ret = query.exec("CREATE TABLE files(" -- "id INTEGER PRIMARY KEY AUTOINCREMENT, " -+ "id INTEGER PRIMARY KEY, " - "url TEXT NOT NULL UNIQUE)"); - if (!ret) { - kDebug() << "Could not create tags table" << query.lastError().text(); --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0012-xattr-the-size-returned-can-be-0.patch baloo-4.13.0/debian/patches/upstream_git/0012-xattr-the-size-returned-can-be-0.patch --- baloo-4.12.97/debian/patches/upstream_git/0012-xattr-the-size-returned-can-be-0.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0012-xattr-the-size-returned-can-be-0.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -From 4ffff55c97f165ec098a7b4cb770bcf62c55babb Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Fri, 28 Mar 2014 16:09:17 +0100 -Subject: [PATCH 12/56] xattr: the size returned can be <= 0 - -In that case we do not want to create a QByteArray and try to fill the -byte array. ---- - src/file/lib/baloo_xattr_p.h | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/file/lib/baloo_xattr_p.h b/src/file/lib/baloo_xattr_p.h -index 1174cbc..fefc3d9 100644 ---- a/src/file/lib/baloo_xattr_p.h -+++ b/src/file/lib/baloo_xattr_p.h -@@ -53,6 +53,13 @@ inline ssize_t baloo_getxattr(const QString& path, const QString& name, QString* - const ssize_t size = extattr_get_file(encodedPath, EXTATTR_NAMESPACE_USER, attributeName, NULL, 0); - #endif - -+ if (size <= 0) { -+ if (value) { -+ value->clear(); -+ } -+ return size; -+ } -+ - QByteArray data(size, Qt::Uninitialized); - - #if defined(Q_OS_LINUX) --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0013-Extractor-Implement-debug-mode.patch baloo-4.13.0/debian/patches/upstream_git/0013-Extractor-Implement-debug-mode.patch --- baloo-4.12.97/debian/patches/upstream_git/0013-Extractor-Implement-debug-mode.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0013-Extractor-Implement-debug-mode.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -From 74143bf37c1e98df0755e891b4645a9c2dea7716 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Fri, 28 Mar 2014 19:01:44 +0100 -Subject: [PATCH 13/56] Extractor: Implement debug mode - ---- - src/file/extractor/app.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++ - src/file/extractor/app.h | 2 ++ - 2 files changed, 61 insertions(+) - -diff --git a/src/file/extractor/app.cpp b/src/file/extractor/app.cpp -index 37000c2..83ee293 100644 ---- a/src/file/extractor/app.cpp -+++ b/src/file/extractor/app.cpp -@@ -65,6 +65,7 @@ App::App(QObject* parent) - this, SLOT(slotCommitted())); - - m_bData = args->isSet("bdata"); -+ m_debugEnabled = args->isSet("debug"); - - m_results.reserve(args->count()); - for (int i=0; icount(); i++) { -@@ -224,6 +225,10 @@ void App::slotCommitted() - - QDBusConnection::sessionBus().send(message); - -+ if (m_debugEnabled) { -+ printDebug(); -+ } -+ - Q_EMIT saved(); - } - -@@ -233,3 +238,57 @@ void App::deleteDocument(unsigned docid) - m_db.xapianDatabase()->deleteDocument(docid); - } - -+void App::printDebug() -+{ -+ Q_FOREACH (const Result& res, m_results) { -+ qDebug() << res.inputUrl(); -+ QMapIterator it(res.map()); -+ while (it.hasNext()) { -+ it.next(); -+ int propNum = it.key().toInt(); -+ -+ using namespace KFileMetaData::Property; -+ Property prop = static_cast(propNum); -+ KFileMetaData::PropertyInfo pi(prop); -+ qDebug() << pi.name() << it.value(); -+ } -+ } -+ -+ // Print the io usage -+ QFile file("/proc/self/io"); -+ file.open(QIODevice::ReadOnly | QIODevice::Text); -+ -+ QTextStream fs(&file); -+ QString str = fs.readAll(); -+ -+ qDebug() << "------- IO ---------"; -+ QTextStream stream(&str); -+ while (!stream.atEnd()) { -+ QString str = stream.readLine(); -+ -+ QString rchar("rchar: "); -+ if (str.startsWith(rchar)) { -+ ulong amt = str.mid(rchar.size()).toULong(); -+ qDebug() << "Read:" << amt / 1024 << "kb"; -+ } -+ -+ QString wchar("wchar: "); -+ if (str.startsWith(wchar)) { -+ ulong amt = str.mid(wchar.size()).toULong(); -+ qDebug() << "Write:" << amt / 1024 << "kb"; -+ } -+ -+ QString read("read_bytes: "); -+ if (str.startsWith(read)) { -+ ulong amt = str.mid(read.size()).toULong(); -+ qDebug() << "Actual Reads:" << amt / 1024 << "kb"; -+ } -+ -+ QString write("write_bytes: "); -+ if (str.startsWith(write)) { -+ ulong amt = str.mid(write.size()).toULong(); -+ qDebug() << "Actual Writes:" << amt / 1024 << "kb"; -+ } -+ } -+ -+} -diff --git a/src/file/extractor/app.h b/src/file/extractor/app.h -index 5aecdbd..6f89a80 100644 ---- a/src/file/extractor/app.h -+++ b/src/file/extractor/app.h -@@ -52,10 +52,12 @@ Q_SIGNALS: - - private: - void deleteDocument(unsigned docid); -+ void printDebug(); - - QVector m_results; - QStringList m_urls; - bool m_bData; -+ bool m_debugEnabled; - - QString m_path; - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0014-Use-KLocalizedString-instead-of-ki18n.patch baloo-4.13.0/debian/patches/upstream_git/0014-Use-KLocalizedString-instead-of-ki18n.patch --- baloo-4.12.97/debian/patches/upstream_git/0014-Use-KLocalizedString-instead-of-ki18n.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0014-Use-KLocalizedString-instead-of-ki18n.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -From 29a334fe6dfb46fb36d44abd7adae06b47cba723 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Sat, 29 Mar 2014 13:02:09 +0100 -Subject: [PATCH 14/56] Use KLocalizedString instead of ki18n("") - ---- - src/file/extractor/main.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/file/extractor/main.cpp b/src/file/extractor/main.cpp -index ec9dce0..4be2c24 100644 ---- a/src/file/extractor/main.cpp -+++ b/src/file/extractor/main.cpp -@@ -51,7 +51,7 @@ int main(int argc, char* argv[]) - options.add("debug", ki18n("Print the data being indexed")); - options.add("bdata", ki18n("Print the QVariantMap in Base64 encoding")); - // FIXME: Set a proper string after the freeze. This option is just for debugging -- options.add("db ", ki18n("")); -+ options.add("db ", KLocalizedString()); - - KCmdLineArgs::addCmdLineOptions(options); - const KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0015-Normalize-email-address-before-to-store-it-in-baloo.patch baloo-4.13.0/debian/patches/upstream_git/0015-Normalize-email-address-before-to-store-it-in-baloo.patch --- baloo-4.12.97/debian/patches/upstream_git/0015-Normalize-email-address-before-to-store-it-in-baloo.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0015-Normalize-email-address-before-to-store-it-in-baloo.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -From 06c4e2305c179a2f445f45e94279c733f505d528 Mon Sep 17 00:00:00 2001 -From: Montel Laurent -Date: Sat, 29 Mar 2014 16:56:56 +0100 -Subject: [PATCH 15/56] Normalize email address before to store it in baloo - -=> better to save quote email during saving when necessary - -CCMAIL: faure@kde.org ---- - src/pim/agent/CMakeLists.txt | 1 + - src/pim/agent/autotests/CMakeLists.txt | 3 ++- - src/pim/agent/emailindexer.cpp | 18 +++++------------- - src/pim/agent/tests/CMakeLists.txt | 2 +- - src/pim/akonadiplugin/autotests/CMakeLists.txt | 1 + - 5 files changed, 10 insertions(+), 15 deletions(-) - -diff --git a/src/pim/agent/CMakeLists.txt b/src/pim/agent/CMakeLists.txt -index 03427b2..efdca9b 100644 ---- a/src/pim/agent/CMakeLists.txt -+++ b/src/pim/agent/CMakeLists.txt -@@ -27,6 +27,7 @@ target_link_libraries(akonadi_baloo_indexer - ${KDEPIMLIBS_KMIME_LIBS} - ${KDEPIMLIBS_KABC_LIBS} - ${XAPIAN_LIBRARIES} -+ ${KDEPIMLIBS_KPIMUTILS_LIBS} - ) - - install(TARGETS akonadi_baloo_indexer ${INSTALL_TARGETS_DEFAULT_ARGS}) -diff --git a/src/pim/agent/autotests/CMakeLists.txt b/src/pim/agent/autotests/CMakeLists.txt -index a706f74..5ee987a 100644 ---- a/src/pim/agent/autotests/CMakeLists.txt -+++ b/src/pim/agent/autotests/CMakeLists.txt -@@ -24,6 +24,7 @@ target_link_libraries(indexertest - ${KDEPIMLIBS_KMIME_LIBS} - ${KDEPIMLIBS_KABC_LIBS} - ${XAPIAN_LIBRARIES} -+ ${KDEPIMLIBS_KPIMUTILS_LIBS} - baloocore - balooxapian --) -\ No newline at end of file -+) -diff --git a/src/pim/agent/emailindexer.cpp b/src/pim/agent/emailindexer.cpp -index 989e4dd..0176c27 100644 ---- a/src/pim/agent/emailindexer.cpp -+++ b/src/pim/agent/emailindexer.cpp -@@ -26,6 +26,8 @@ - #include - - #include -+#include -+ - - EmailIndexer::EmailIndexer(const QString& path, const QString& contactDbPath): - AbstractIndexer(), m_doc( 0 ), m_termGen( 0 ) -@@ -115,19 +117,9 @@ namespace { - // TODO: Move this into KMime? - // TODO: If name is all upper/lower then try to captialize it? - QString prettyAddress(const KMime::Types::Mailbox& mbox) { -- QString name = mbox.name().simplified(); -- QByteArray email = mbox.address().simplified().toLower(); -- -- // Remove outer quotes recursively -- while (name.size() >= 2 && (name[0] == '\'' || name[0] == '"') && -- (name[name.size()-1] == '\'' || name[name.size()-1] == '"')) { -- name = name.mid(1, name.size()-2); -- } -- -- if (name.isEmpty()) -- return email; -- else -- return name + QLatin1String(" <") + QString::fromUtf8(email) + QLatin1Char('>'); -+ const QString name = mbox.name().simplified(); -+ const QByteArray email = mbox.address().simplified().toLower(); -+ return KPIMUtils::normalizedAddress(name, QString::fromUtf8(email)); - } - } - -diff --git a/src/pim/agent/tests/CMakeLists.txt b/src/pim/agent/tests/CMakeLists.txt -index 627623c..ca33db3 100644 ---- a/src/pim/agent/tests/CMakeLists.txt -+++ b/src/pim/agent/tests/CMakeLists.txt -@@ -12,6 +12,6 @@ target_link_libraries(emailindexer - ${KDEPIMLIBS_AKONADI_LIBS} - ${KDEPIMLIBS_AKONADI_KMIME_LIBS} - ${KDEPIMLIBS_KMIME_LIBS} -- -+ ${KDEPIMLIBS_KPIMUTILS_LIBS} - ${XAPIAN_LIBRARIES} - ) -diff --git a/src/pim/akonadiplugin/autotests/CMakeLists.txt b/src/pim/akonadiplugin/autotests/CMakeLists.txt -index c4a044f..c171204 100644 ---- a/src/pim/akonadiplugin/autotests/CMakeLists.txt -+++ b/src/pim/akonadiplugin/autotests/CMakeLists.txt -@@ -27,6 +27,7 @@ target_link_libraries(searchplugintest - ${KDEPIMLIBS_KMIME_LIBS} - ${KDEPIMLIBS_KABC_LIBS} - ${XAPIAN_LIBRARIES} -+ ${KDEPIMLIBS_KPIMUTILS_LIBS} - baloocore - balooxapian - ) --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0016-Catch-DatabaseError-exception-in-XapianSearchStore.patch baloo-4.13.0/debian/patches/upstream_git/0016-Catch-DatabaseError-exception-in-XapianSearchStore.patch --- baloo-4.12.97/debian/patches/upstream_git/0016-Catch-DatabaseError-exception-in-XapianSearchStore.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0016-Catch-DatabaseError-exception-in-XapianSearchStore.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -From 36ddb43f868a16688d72b201bd09642b0f988f80 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Dan=20Vr=C3=A1til?= -Date: Sun, 30 Mar 2014 11:50:52 +0200 -Subject: [PATCH 16/56] Catch DatabaseError exception in XapianSearchStore - ---- - src/xapian/xapiansearchstore.cpp | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/src/xapian/xapiansearchstore.cpp b/src/xapian/xapiansearchstore.cpp -index ff82a6e..59c035b 100644 ---- a/src/xapian/xapiansearchstore.cpp -+++ b/src/xapian/xapiansearchstore.cpp -@@ -199,7 +199,12 @@ int XapianSearchStore::exec(const Query& query) - return 0; - - QMutexLocker lock(&m_mutex); -- m_db->reopen(); -+ try { -+ m_db->reopen(); -+ } catch (Xapian::DatabaseError& e) { -+ kWarning() << "Failed to reopen database" << dbPath() << ":" << QString::fromStdString(e.get_msg()); -+ return 0; -+ } - - QTime queryGenerationTimer; - queryGenerationTimer.start(); --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0017-KCM-Always-call-the-cleaner.patch baloo-4.13.0/debian/patches/upstream_git/0017-KCM-Always-call-the-cleaner.patch --- baloo-4.12.97/debian/patches/upstream_git/0017-KCM-Always-call-the-cleaner.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0017-KCM-Always-call-the-cleaner.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -From 457969987a601d047ff97a9ee575be5182d7246e Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Sat, 29 Mar 2014 15:31:03 +0100 -Subject: [PATCH 17/56] KCM: Always call the cleaner - -The KCM save function will only be called if some setting has changed, -and since the folders are the only thing that could have changed, we -call the kcm. ---- - src/file/kcm/kcm.cpp | 15 ++------------- - src/file/kcm/kcm.h | 2 -- - 2 files changed, 2 insertions(+), 15 deletions(-) - -diff --git a/src/file/kcm/kcm.cpp b/src/file/kcm/kcm.cpp -index 354392b..685b6e1 100644 ---- a/src/file/kcm/kcm.cpp -+++ b/src/file/kcm/kcm.cpp -@@ -87,9 +87,6 @@ void ServerConfigModule::load() - QStringList excludeFolders = group.readPathEntry("exclude folders", QStringList()); - m_folderSelectionWidget->setFolders(includeFolders, excludeFolders); - -- m_oldExcludeFolders = excludeFolders; -- m_oldIncludeFolders = includeFolders; -- - // All values loaded -> no changes - Q_EMIT changed(false); - } -@@ -126,16 +123,8 @@ void ServerConfigModule::save() - } - - // Start cleaner -- bool cleaningRequired = false; -- if (includeFolders != m_oldIncludeFolders) -- cleaningRequired = true; -- else if (excludeFolders != m_oldExcludeFolders) -- cleaningRequired = true; -- -- if (cleaningRequired) { -- const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file_cleaner")); -- QProcess::startDetached(exe); -- } -+ const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file_cleaner")); -+ QProcess::startDetached(exe); - - // all values saved -> no changes - Q_EMIT changed(false); -diff --git a/src/file/kcm/kcm.h b/src/file/kcm/kcm.h -index ae76af4..440849d 100644 ---- a/src/file/kcm/kcm.h -+++ b/src/file/kcm/kcm.h -@@ -40,8 +40,6 @@ public Q_SLOTS: - void defaults(); - - private: -- QStringList m_oldIncludeFolders; -- QStringList m_oldExcludeFolders; - }; - } - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0018-KCM-Use-dbus-asyncCall-instead-of-send.patch baloo-4.13.0/debian/patches/upstream_git/0018-KCM-Use-dbus-asyncCall-instead-of-send.patch --- baloo-4.12.97/debian/patches/upstream_git/0018-KCM-Use-dbus-asyncCall-instead-of-send.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0018-KCM-Use-dbus-asyncCall-instead-of-send.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -From e54afe1e2d131d46a2ac6df4303aadc41507c0c2 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Sat, 29 Mar 2014 15:31:49 +0100 -Subject: [PATCH 18/56] KCM: Use dbus asyncCall instead of send - ---- - src/file/kcm/kcm.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/file/kcm/kcm.cpp b/src/file/kcm/kcm.cpp -index 685b6e1..f40d365 100644 ---- a/src/file/kcm/kcm.cpp -+++ b/src/file/kcm/kcm.cpp -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include - - K_PLUGIN_FACTORY(BalooConfigModuleFactory, registerPlugin();) - K_EXPORT_PLUGIN(BalooConfigModuleFactory("kcm_baloofile", "kcm_baloofile")) -@@ -119,7 +120,7 @@ void ServerConfigModule::save() - QLatin1String("org.kde.baloo.file"), - QLatin1String("quit")); - -- QDBusConnection::sessionBus().send(message); -+ QDBusConnection::sessionBus().asyncCall(message); - } - - // Start cleaner --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0019-IndexScheduler-Update-everything-when-the-config-cha.patch baloo-4.13.0/debian/patches/upstream_git/0019-IndexScheduler-Update-everything-when-the-config-cha.patch --- baloo-4.12.97/debian/patches/upstream_git/0019-IndexScheduler-Update-everything-when-the-config-cha.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0019-IndexScheduler-Update-everything-when-the-config-cha.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -From a200834ac5461c4f7c914c4438fcfe91c8b245ea Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Sat, 29 Mar 2014 17:17:51 +0100 -Subject: [PATCH 19/56] IndexScheduler: Update everything when the config - changes - -During the nepomuk days doing an update was very expensive and we -therefore tried to update the minimum possible. This was hard to do and -was not perfect. - -With Baloo we're fast enough to do a full scan on config changes. -Additionally the configuration does not really change very often. ---- - src/file/indexscheduler.cpp | 40 ++-------------------------------------- - src/file/indexscheduler.h | 4 +--- - 2 files changed, 3 insertions(+), 41 deletions(-) - -diff --git a/src/file/indexscheduler.cpp b/src/file/indexscheduler.cpp -index 3f9a261..ce4294f 100644 ---- a/src/file/indexscheduler.cpp -+++ b/src/file/indexscheduler.cpp -@@ -40,16 +40,7 @@ IndexScheduler::IndexScheduler(Database* db, FileIndexerConfig* config, QObject* - , m_db(db) - { - Q_ASSERT(m_config); -- connect(m_config, SIGNAL(includeFolderListChanged(QStringList,QStringList)), -- this, SLOT(slotIncludeFolderListChanged(QStringList,QStringList))); -- connect(m_config, SIGNAL(excludeFolderListChanged(QStringList,QStringList)), -- this, SLOT(slotExcludeFolderListChanged(QStringList,QStringList))); -- -- // FIXME: What if both the signals are emitted? -- connect(m_config, SIGNAL(fileExcludeFiltersChanged()), -- this, SLOT(slotConfigFiltersChanged())); -- connect(m_config, SIGNAL(mimeTypeFiltersChanged()), -- this, SLOT(slotConfigFiltersChanged())); -+ connect(m_config, SIGNAL(configChanged()), this, SLOT(slotConfigChanged())); - - // Stop indexing when a device is unmounted - // RemovableMediaCache* cache = new RemovableMediaCache(this); -@@ -201,34 +192,7 @@ void IndexScheduler::queueAllFoldersForUpdate(bool forceUpdate) - } - - --void IndexScheduler::slotIncludeFolderListChanged(const QStringList& added, const QStringList& removed) --{ -- //Index the folders added to the include list, clear the folders removed from it -- addClearFolders(added, removed); --} -- --void IndexScheduler::slotExcludeFolderListChanged(const QStringList& added, const QStringList& removed) --{ -- //Clear the folders added to the exclude list, index the folders removed from it -- addClearFolders(removed, added); --} -- --//Index the folders in add, clear the folders in clear --void IndexScheduler::addClearFolders(const QStringList& add, const QStringList& clear) --{ -- kDebug() << "To index: " << add << "To clear: " << clear; -- Q_FOREACH (const QString& path, clear) { -- m_basicIQ->clear(path); -- m_fileIQ->clear(); -- } -- -- Q_FOREACH (const QString &path, add) { -- m_basicIQ->enqueue(FileMapping(path), UpdateRecursive); -- } -- slotScheduleIndexing(); --} -- --void IndexScheduler::slotConfigFiltersChanged() -+void IndexScheduler::slotConfigChanged() - { - // We need to this - there is no way to avoid it - m_basicIQ->clear(); -diff --git a/src/file/indexscheduler.h b/src/file/indexscheduler.h -index c20d7dc..73db5e0 100644 ---- a/src/file/indexscheduler.h -+++ b/src/file/indexscheduler.h -@@ -117,9 +117,7 @@ Q_SIGNALS: - void statusStringChanged(); - private Q_SLOTS: - // Config -- void slotConfigFiltersChanged(); -- void slotIncludeFolderListChanged(const QStringList& added, const QStringList& removed); -- void slotExcludeFolderListChanged(const QStringList& added, const QStringList& removed); -+ void slotConfigChanged(); - - void slotStartedIndexing(); - void slotFinishedIndexing(); --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0020-Cleaner-Always-remove-it-from-both-the-databases.patch baloo-4.13.0/debian/patches/upstream_git/0020-Cleaner-Always-remove-it-from-both-the-databases.patch --- baloo-4.12.97/debian/patches/upstream_git/0020-Cleaner-Always-remove-it-from-both-the-databases.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0020-Cleaner-Always-remove-it-from-both-the-databases.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -From 632abbd8a255bf01e334565e18c8b5d3c6ad0ebf Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Sat, 29 Mar 2014 17:23:52 +0100 -Subject: [PATCH 20/56] Cleaner: Always remove it from both the databases - ---- - src/file/cleaner/cleaner.cpp | 22 +++++++++++++--------- - 1 file changed, 13 insertions(+), 9 deletions(-) - -diff --git a/src/file/cleaner/cleaner.cpp b/src/file/cleaner/cleaner.cpp -index 880dcf4..1cfec6f 100644 ---- a/src/file/cleaner/cleaner.cpp -+++ b/src/file/cleaner/cleaner.cpp -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - - using namespace Baloo; - -@@ -53,24 +54,27 @@ void Cleaner::start() - int id = query.value(0).toInt(); - QString url = query.value(1).toString(); - -+ bool removeIt = false; - if (!QFile::exists(url)) { -- QSqlQuery q(sqlDb); -- q.prepare("delete from files where id = ?"); -- q.addBindValue(id); -- q.exec(); -- m_commitQueue->remove(id); -- continue; -+ removeIt = true; - } - - if (!config.shouldBeIndexed(url)) { -- m_commitQueue->remove(id); -- continue; -+ removeIt = true; - } - - QString mimetype = KMimeType::findByUrl(QUrl::fromLocalFile(url))->name(); - if (!config.shouldMimeTypeBeIndexed(mimetype)) { -+ removeIt = true; -+ } -+ -+ if (removeIt) { -+ qDebug() << id << url; -+ QSqlQuery q(sqlDb); -+ q.prepare("delete from files where id = ?"); -+ q.addBindValue(id); -+ q.exec(); - m_commitQueue->remove(id); -- continue; - } - } - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0021-Cleaner-Commit-the-changes-every-1000-documents.patch baloo-4.13.0/debian/patches/upstream_git/0021-Cleaner-Commit-the-changes-every-1000-documents.patch --- baloo-4.12.97/debian/patches/upstream_git/0021-Cleaner-Commit-the-changes-every-1000-documents.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0021-Cleaner-Commit-the-changes-every-1000-documents.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -From 6493efc09e69bfd974b86937017eaa9210cf7420 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Sat, 29 Mar 2014 17:45:27 +0100 -Subject: [PATCH 21/56] Cleaner: Commit the changes every 1000 documents - ---- - src/file/cleaner/cleaner.cpp | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/file/cleaner/cleaner.cpp b/src/file/cleaner/cleaner.cpp -index 1cfec6f..d64a39d 100644 ---- a/src/file/cleaner/cleaner.cpp -+++ b/src/file/cleaner/cleaner.cpp -@@ -50,6 +50,7 @@ void Cleaner::start() - - FileIndexerConfig config; - -+ int numDocuments = 0; - while (query.next()) { - int id = query.value(0).toInt(); - QString url = query.value(1).toString(); -@@ -75,6 +76,12 @@ void Cleaner::start() - q.addBindValue(id); - q.exec(); - m_commitQueue->remove(id); -+ -+ numDocuments++; -+ } -+ -+ if (numDocuments >= 1000) { -+ m_commitQueue->commit(); - } - } - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0022-Cleaner-Do-faster-mimetype-detection.patch baloo-4.13.0/debian/patches/upstream_git/0022-Cleaner-Do-faster-mimetype-detection.patch --- baloo-4.12.97/debian/patches/upstream_git/0022-Cleaner-Do-faster-mimetype-detection.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0022-Cleaner-Do-faster-mimetype-detection.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -From 2fd777302ef070dcba04f1142ff7c494ff0b8891 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Sat, 29 Mar 2014 17:47:59 +0100 -Subject: [PATCH 22/56] Cleaner: Do faster mimetype detection - -Otherwise we consume just way too much io ---- - src/file/cleaner/cleaner.cpp | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/file/cleaner/cleaner.cpp b/src/file/cleaner/cleaner.cpp -index d64a39d..21eb1cd 100644 ---- a/src/file/cleaner/cleaner.cpp -+++ b/src/file/cleaner/cleaner.cpp -@@ -64,7 +64,9 @@ void Cleaner::start() - removeIt = true; - } - -- QString mimetype = KMimeType::findByUrl(QUrl::fromLocalFile(url))->name(); -+ // vHanda FIXME: Perhaps we want to get the proper mimetype from xapian? -+ QString mimetype = KMimeType::findByUrl(QUrl::fromLocalFile(url), 0, -+ true /*local*/, true /*fast*/)->name(); - if (!config.shouldMimeTypeBeIndexed(mimetype)) { - removeIt = true; - } --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0023-BasicIndexingJob-Do-not-add-the-type-as-file.patch baloo-4.13.0/debian/patches/upstream_git/0023-BasicIndexingJob-Do-not-add-the-type-as-file.patch --- baloo-4.12.97/debian/patches/upstream_git/0023-BasicIndexingJob-Do-not-add-the-type-as-file.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0023-BasicIndexingJob-Do-not-add-the-type-as-file.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -From a088f5cce9884294ac29f04f57e5842c5c16b28f Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Sat, 29 Mar 2014 19:06:54 +0100 -Subject: [PATCH 23/56] BasicIndexingJob: Do not add the type as 'file' - -Everything in the "file database" is a file. We're no longer in the -Nepomuk world where the same db contains all the different resources. ---- - src/file/basicindexingjob.cpp | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/src/file/basicindexingjob.cpp b/src/file/basicindexingjob.cpp -index dfd9fb4..4bbcc55 100644 ---- a/src/file/basicindexingjob.cpp -+++ b/src/file/basicindexingjob.cpp -@@ -81,7 +81,6 @@ bool BasicIndexingJob::index() - QString tstr = KFileMetaData::TypeInfo(type).name().toLower(); - doc.addBoolTerm(tstr, "T"); - } -- doc.addBoolTerm("file", "T"); - - if (fileInfo.isDir()) { - doc.addBoolTerm("folder", "T"); --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0024-Catch-Xapian-DatabaseException-in-EmailQuery.patch baloo-4.13.0/debian/patches/upstream_git/0024-Catch-Xapian-DatabaseException-in-EmailQuery.patch --- baloo-4.12.97/debian/patches/upstream_git/0024-Catch-Xapian-DatabaseException-in-EmailQuery.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0024-Catch-Xapian-DatabaseException-in-EmailQuery.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -From 4d34a8286295d1eef2be24959fc51249b4322ec1 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Dan=20Vr=C3=A1til?= -Date: Mon, 31 Mar 2014 14:17:07 +0200 -Subject: [PATCH 24/56] Catch Xapian::DatabaseException in EmailQuery - -Prevents KMail from crashing when using quick filter when Baloo databases -are missing. ---- - src/pim/lib/emailquery.cpp | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/src/pim/lib/emailquery.cpp b/src/pim/lib/emailquery.cpp -index f4710ff..2964846 100644 ---- a/src/pim/lib/emailquery.cpp -+++ b/src/pim/lib/emailquery.cpp -@@ -182,7 +182,13 @@ void EmailQuery::setRead(bool read) - ResultIterator EmailQuery::exec() - { - const QString dir = KGlobal::dirs()->localxdgdatadir() + "baloo/email/"; -- Xapian::Database db(dir.toUtf8().constData()); -+ Xapian::Database db; -+ try { -+ db = Xapian::Database(dir.toUtf8().constData()); -+ } catch (const Xapian::DatabaseError& e) { -+ kWarning() << "Failed to open Xapian database:" << QString::fromStdString(e.get_error_string()); -+ return ResultIterator(); -+ } - - QList m_queries; - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0025-IndexerConfigTest-Show-both-fast-and-slow-mimetype.patch baloo-4.13.0/debian/patches/upstream_git/0025-IndexerConfigTest-Show-both-fast-and-slow-mimetype.patch --- baloo-4.12.97/debian/patches/upstream_git/0025-IndexerConfigTest-Show-both-fast-and-slow-mimetype.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0025-IndexerConfigTest-Show-both-fast-and-slow-mimetype.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -From 9d1c2d8c8e7d195b7d0648af0ca9bf6c874780fa Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Tue, 1 Apr 2014 11:34:40 +0200 -Subject: [PATCH 25/56] IndexerConfigTest: Show both fast and slow mimetype - ---- - src/file/tests/indexerconfigtest.cpp | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/src/file/tests/indexerconfigtest.cpp b/src/file/tests/indexerconfigtest.cpp -index acf9041..5b487b8 100644 ---- a/src/file/tests/indexerconfigtest.cpp -+++ b/src/file/tests/indexerconfigtest.cpp -@@ -66,11 +66,14 @@ int main(int argc, char** argv) - bool shouldIndex = config.shouldBeIndexed(url.toLocalFile()); - - QString mimetype = KMimeType::findByUrl(url)->name(); -- bool shouldIndexMimetype = config.shouldMimeTypeBeIndexed(mimetype); -+ QString fastMimetype = KMimeType::findByUrl(url, 0, true, true)->name(); -+ -+ bool shouldIndexMimetype = config.shouldMimeTypeBeIndexed(fastMimetype); - std::cout << url.toLocalFile().toUtf8().constData() << "\n" - << "Should Index: " << std::boolalpha << shouldIndex << "\n" - << "Should Index Mimetype: " << std::boolalpha << shouldIndexMimetype << "\n" -- << "Mimetype: " << mimetype.toUtf8().constData() << std::endl; -+ << "Fast Mimetype: " << fastMimetype.toUtf8().constData() << std::endl -+ << "Slow Mimetype: " << mimetype.toUtf8().constData() << std::endl; - - return 0; //app.exec(); - } --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0026-FileIndexingJob-Assert-instead-of-failing-gracefully.patch baloo-4.13.0/debian/patches/upstream_git/0026-FileIndexingJob-Assert-instead-of-failing-gracefully.patch --- baloo-4.12.97/debian/patches/upstream_git/0026-FileIndexingJob-Assert-instead-of-failing-gracefully.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0026-FileIndexingJob-Assert-instead-of-failing-gracefully.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -From f8ce8ab4d3e763f36eb21cd63238eaafa15007ea Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Tue, 1 Apr 2014 12:36:06 +0200 -Subject: [PATCH 26/56] FileIndexingJob: Assert instead of failing gracefully - ---- - src/file/fileindexingjob.cpp | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -diff --git a/src/file/fileindexingjob.cpp b/src/file/fileindexingjob.cpp -index d20dfe4..d00b840 100644 ---- a/src/file/fileindexingjob.cpp -+++ b/src/file/fileindexingjob.cpp -@@ -49,10 +49,7 @@ FileIndexingJob::FileIndexingJob(const QVector& files, QObject* parent) - - void FileIndexingJob::start() - { -- if (m_files.isEmpty()) { -- emitResult(); -- return; -- } -+ Q_ASSERT(!m_files.isEmpty()); - - m_args = m_files; - m_files.clear(); --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0027-Add-autotest-for-the-file-indexing-job.patch baloo-4.13.0/debian/patches/upstream_git/0027-Add-autotest-for-the-file-indexing-job.patch --- baloo-4.12.97/debian/patches/upstream_git/0027-Add-autotest-for-the-file-indexing-job.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0027-Add-autotest-for-the-file-indexing-job.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,267 +0,0 @@ -From f453048fd0e830f8b94da06c1ab91805fd067499 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Tue, 1 Apr 2014 15:22:42 +0200 -Subject: [PATCH 27/56] Add autotest for the file indexing job - -We need to create a fake baloo_file_extractor process for this since -that is what the FileIndexingJob calls. ---- - src/file/autotest/CMakeLists.txt | 3 +- - src/file/autotest/fileindexingjob/CMakeLists.txt | 19 ++++++ - src/file/autotest/fileindexingjob/extractor.cpp | 75 ++++++++++++++++++++++ - .../fileindexingjob/fileindexingjobtest.cpp | 70 ++++++++++++++++++++ - .../autotest/fileindexingjob/fileindexingjobtest.h | 40 ++++++++++++ - 5 files changed, 205 insertions(+), 2 deletions(-) - create mode 100644 src/file/autotest/fileindexingjob/CMakeLists.txt - create mode 100644 src/file/autotest/fileindexingjob/extractor.cpp - create mode 100644 src/file/autotest/fileindexingjob/fileindexingjobtest.cpp - create mode 100644 src/file/autotest/fileindexingjob/fileindexingjobtest.h - -diff --git a/src/file/autotest/CMakeLists.txt b/src/file/autotest/CMakeLists.txt -index bd1f1b3..a54736e 100644 ---- a/src/file/autotest/CMakeLists.txt -+++ b/src/file/autotest/CMakeLists.txt -@@ -1,7 +1,5 @@ - project(filewatch_tests) - --set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) -- - if(CMAKE_SYSTEM_NAME MATCHES "Linux") - set(kinotifytest_SRC kinotifytest.cpp ../kinotify.cpp) - kde4_add_unit_test(kinotifytest TESTNAME nepomuk-kinotifytest NOGUI ${kinotifytest_SRC}) -@@ -95,3 +93,4 @@ target_link_libraries(basicindexingqueuetest - balooxapian - ) - -+add_subdirectory(fileindexingjob) -diff --git a/src/file/autotest/fileindexingjob/CMakeLists.txt b/src/file/autotest/fileindexingjob/CMakeLists.txt -new file mode 100644 -index 0000000..811ed30 ---- /dev/null -+++ b/src/file/autotest/fileindexingjob/CMakeLists.txt -@@ -0,0 +1,19 @@ -+add_executable(baloo_file_extractor_dummy extractor.cpp) -+set_target_properties(baloo_file_extractor_dummy -+ PROPERTIES OUTPUT_NAME baloo_file_extractor -+) -+ -+target_link_libraries(baloo_file_extractor_dummy -+ ${KDE4_KDECORE_LIBS} -+) -+ -+add_definitions("-DBALOO_TEMP_PATH=\\\"${CMAKE_CURRENT_BINARY_DIR}\\\"") -+kde4_add_unit_test(fileindexingjobtest NOGUI fileindexingjobtest.cpp -+ ../../fileindexingjob.cpp) -+ -+target_link_libraries(fileindexingjobtest -+ ${QT_QTTEST_LIBRARY} -+ ${KDE4_KDECORE_LIBS} -+ ${KFILEMETADATA_LIBRARY} -+ ${XAPIAN_LIBRARIES} -+) -diff --git a/src/file/autotest/fileindexingjob/extractor.cpp b/src/file/autotest/fileindexingjob/extractor.cpp -new file mode 100644 -index 0000000..949fc8f ---- /dev/null -+++ b/src/file/autotest/fileindexingjob/extractor.cpp -@@ -0,0 +1,75 @@ -+/* -+ * This file is part of the KDE Baloo Project -+ * Copyright (C) 2014 Vishesh Handa -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) version 3, or any -+ * later version accepted by the membership of KDE e.V. (or its -+ * successor approved by the membership of KDE e.V.), which shall -+ * act as a proxy defined in Section 6 of version 3 of the license. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library. If not, see . -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include -+#include -+ -+int main(int argc, char* argv[]) -+{ -+ KAboutData aboutData("baloo_file_extractor_dummy", 0, KLocalizedString(), -+ "0.1", KLocalizedString()); -+ -+ KCmdLineArgs::init(argc, argv, &aboutData); -+ -+ KCmdLineOptions options; -+ options.add("+[url]", KLocalizedString()); -+ -+ KCmdLineArgs::addCmdLineOptions(options); -+ const KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); -+ -+ int argCount = args->count(); -+ if (argCount == 0) { -+ QTextStream err(stderr); -+ err << "Must input url/id of the file to be indexed"; -+ -+ return 1; -+ } -+ -+ KComponentData data(aboutData, KComponentData::RegisterAsMainComponent); -+ -+ QByteArray arr = qgetenv("BALOO_EXTRACTOR_FAIL_FILE"); -+ if (arr.isEmpty()) { -+ return 0; -+ } -+ -+ QString failFile = QString::fromUtf8(arr); -+ -+ for (int i = 0; i < args->count(); i++) { -+ QString fid = args->arg(i); -+ if (fid == failFile) { -+ // kill oneself -+ raise(SIGKILL); -+ return -1; -+ } -+ } -+ -+ return 0; -+} -diff --git a/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp b/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp -new file mode 100644 -index 0000000..57482c8 ---- /dev/null -+++ b/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp -@@ -0,0 +1,70 @@ -+/* -+ * -+ * Copyright (C) 2014 Vishesh Handa -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ * -+ */ -+ -+#include "fileindexingjobtest.h" -+#include "../../fileindexingjob.h" -+ -+#include -+#include -+ -+using namespace Baloo; -+ -+void FileIndexingJobTest::init() -+{ -+ // Set the correct path -+ QByteArray path = qgetenv("PATH"); -+ path = QByteArray(BALOO_TEMP_PATH) + ":" + path; -+ -+ setenv("PATH", path.constData(), 1); -+ unsetenv("BALOO_EXTRACTOR_FAIL_FILE"); -+} -+ -+void FileIndexingJobTest::testFileFail() -+{ -+ QVector files; -+ files << 1 << 2 << 3 << 4 << 5 << 6; -+ -+ putenv("BALOO_EXTRACTOR_FAIL_FILE=5"); -+ FileIndexingJob* job = new FileIndexingJob(files); -+ -+ QSignalSpy spy(job, SIGNAL(indexingFailed(uint))); -+ QVERIFY(job->exec()); -+ -+ QCOMPARE(spy.count(), 1); -+ QCOMPARE(spy.at(0).size(), 1); -+ QCOMPARE(spy.at(0).first().toUInt(), (uint)5); -+} -+ -+void FileIndexingJobTest::testNormalExecution() -+{ -+ QVector files; -+ files << 1 << 2 << 3 << 4 << 5 << 6; -+ -+ FileIndexingJob* job = new FileIndexingJob(files); -+ -+ QSignalSpy spy1(job, SIGNAL(indexingFailed(uint))); -+ QSignalSpy spy2(job, SIGNAL(finished(KJob*))); -+ QVERIFY(job->exec()); -+ -+ QCOMPARE(spy1.count(), 0); -+ QCOMPARE(spy2.count(), 1); -+} -+ -+QTEST_MAIN(FileIndexingJobTest); -diff --git a/src/file/autotest/fileindexingjob/fileindexingjobtest.h b/src/file/autotest/fileindexingjob/fileindexingjobtest.h -new file mode 100644 -index 0000000..100d300 ---- /dev/null -+++ b/src/file/autotest/fileindexingjob/fileindexingjobtest.h -@@ -0,0 +1,40 @@ -+/* -+ * -+ * Copyright (C) 2014 Vishesh Handa -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ * -+ */ -+ -+#ifndef BALOO_FILEINDEXINGJOBTEST_H -+#define BALOO_FILEINDEXINGJOBTEST_H -+ -+#include -+ -+namespace Baloo { -+ -+class FileIndexingJobTest : public QObject -+{ -+ Q_OBJECT -+ -+private Q_SLOTS: -+ void init(); -+ -+ void testNormalExecution(); -+ void testFileFail(); -+}; -+} -+ -+#endif // BALOO_FILEINDEXINGJOBTEST_H --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0028-FileIndexingJobTest-Test-when-multiple-files-fail-to.patch baloo-4.13.0/debian/patches/upstream_git/0028-FileIndexingJobTest-Test-when-multiple-files-fail-to.patch --- baloo-4.12.97/debian/patches/upstream_git/0028-FileIndexingJobTest-Test-when-multiple-files-fail-to.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0028-FileIndexingJobTest-Test-when-multiple-files-fail-to.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -From 3ad8f77301f25be1ede51bd38116bbb417fc3568 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Tue, 1 Apr 2014 15:44:20 +0200 -Subject: [PATCH 28/56] FileIndexingJobTest: Test when multiple files fail to - index - ---- - src/file/autotest/fileindexingjob/extractor.cpp | 4 ++-- - .../fileindexingjob/fileindexingjobtest.cpp | 26 +++++++++++++++++++++- - .../autotest/fileindexingjob/fileindexingjobtest.h | 1 + - 3 files changed, 28 insertions(+), 3 deletions(-) - -diff --git a/src/file/autotest/fileindexingjob/extractor.cpp b/src/file/autotest/fileindexingjob/extractor.cpp -index 949fc8f..28a27e9 100644 ---- a/src/file/autotest/fileindexingjob/extractor.cpp -+++ b/src/file/autotest/fileindexingjob/extractor.cpp -@@ -60,11 +60,11 @@ int main(int argc, char* argv[]) - return 0; - } - -- QString failFile = QString::fromUtf8(arr); -+ QStringList failFiles = QString::fromUtf8(arr).split(",", QString::SkipEmptyParts); - - for (int i = 0; i < args->count(); i++) { - QString fid = args->arg(i); -- if (fid == failFile) { -+ if (failFiles.contains(fid)) { - // kill oneself - raise(SIGKILL); - return -1; -diff --git a/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp b/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp -index 57482c8..ecb1b42 100644 ---- a/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp -+++ b/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp -@@ -39,7 +39,9 @@ void FileIndexingJobTest::init() - void FileIndexingJobTest::testFileFail() - { - QVector files; -- files << 1 << 2 << 3 << 4 << 5 << 6; -+ for (int i = 0; i<40; i++) { -+ files << i; -+ } - - putenv("BALOO_EXTRACTOR_FAIL_FILE=5"); - FileIndexingJob* job = new FileIndexingJob(files); -@@ -52,6 +54,28 @@ void FileIndexingJobTest::testFileFail() - QCOMPARE(spy.at(0).first().toUInt(), (uint)5); - } - -+void FileIndexingJobTest::testMultiFileFail() -+{ -+ QVector files; -+ for (int i = 0; i<40; i++) { -+ files << i; -+ } -+ -+ putenv("BALOO_EXTRACTOR_FAIL_FILE=5,18,19"); -+ FileIndexingJob* job = new FileIndexingJob(files); -+ -+ QSignalSpy spy(job, SIGNAL(indexingFailed(uint))); -+ QVERIFY(job->exec()); -+ -+ QCOMPARE(spy.count(), 3); -+ QCOMPARE(spy.at(0).size(), 1); -+ QCOMPARE(spy.at(0).first().toUInt(), (uint)5); -+ QCOMPARE(spy.at(1).size(), 1); -+ QCOMPARE(spy.at(1).first().toUInt(), (uint)18); -+ QCOMPARE(spy.at(2).size(), 1); -+ QCOMPARE(spy.at(2).first().toUInt(), (uint)19); -+} -+ - void FileIndexingJobTest::testNormalExecution() - { - QVector files; -diff --git a/src/file/autotest/fileindexingjob/fileindexingjobtest.h b/src/file/autotest/fileindexingjob/fileindexingjobtest.h -index 100d300..3d84c7a 100644 ---- a/src/file/autotest/fileindexingjob/fileindexingjobtest.h -+++ b/src/file/autotest/fileindexingjob/fileindexingjobtest.h -@@ -34,6 +34,7 @@ private Q_SLOTS: - - void testNormalExecution(); - void testFileFail(); -+ void testMultiFileFail(); - }; - } - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0029-FileIndexingJobTest-Test-timeouts.patch baloo-4.13.0/debian/patches/upstream_git/0029-FileIndexingJobTest-Test-timeouts.patch --- baloo-4.12.97/debian/patches/upstream_git/0029-FileIndexingJobTest-Test-timeouts.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0029-FileIndexingJobTest-Test-timeouts.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,165 +0,0 @@ -From a6631dc63d582e9bd1c5bea9ed1779ade6f61ed9 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Tue, 1 Apr 2014 15:56:16 +0200 -Subject: [PATCH 29/56] FileIndexingJobTest: Test timeouts - -The FileIndexingJob has an internal timer to make sure the indexer never -gets stuck on any file. If so it marks that file has invalid. This test -checks for that behaviour. ---- - src/file/autotest/fileindexingjob/extractor.cpp | 14 +++++++++++--- - .../autotest/fileindexingjob/fileindexingjobtest.cpp | 20 ++++++++++++++++++++ - .../autotest/fileindexingjob/fileindexingjobtest.h | 1 + - src/file/fileindexingjob.cpp | 11 +++++++++-- - src/file/fileindexingjob.h | 10 ++++++++++ - 5 files changed, 51 insertions(+), 5 deletions(-) - -diff --git a/src/file/autotest/fileindexingjob/extractor.cpp b/src/file/autotest/fileindexingjob/extractor.cpp -index 28a27e9..a6d14d7 100644 ---- a/src/file/autotest/fileindexingjob/extractor.cpp -+++ b/src/file/autotest/fileindexingjob/extractor.cpp -@@ -31,6 +31,7 @@ - - #include - #include -+#include - - int main(int argc, char* argv[]) - { -@@ -55,12 +56,14 @@ int main(int argc, char* argv[]) - - KComponentData data(aboutData, KComponentData::RegisterAsMainComponent); - -- QByteArray arr = qgetenv("BALOO_EXTRACTOR_FAIL_FILE"); -- if (arr.isEmpty()) { -+ QByteArray failArr = qgetenv("BALOO_EXTRACTOR_FAIL_FILE"); -+ QByteArray timeoutArr = qgetenv("BALOO_EXTRACTOR_TIMEOUT_FILE"); -+ if (failArr.isEmpty() && timeoutArr.isEmpty()) { - return 0; - } - -- QStringList failFiles = QString::fromUtf8(arr).split(",", QString::SkipEmptyParts); -+ QStringList failFiles = QString::fromUtf8(failArr).split(",", QString::SkipEmptyParts); -+ QStringList timeoutFiles = QString::fromUtf8(timeoutArr).split(",", QString::SkipEmptyParts); - - for (int i = 0; i < args->count(); i++) { - QString fid = args->arg(i); -@@ -69,6 +72,11 @@ int main(int argc, char* argv[]) - raise(SIGKILL); - return -1; - } -+ -+ if (timeoutFiles.contains(fid)) { -+ // 100 msecs -+ usleep(100 * 1000); -+ } - } - - return 0; -diff --git a/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp b/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp -index ecb1b42..8a0ca84 100644 ---- a/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp -+++ b/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp -@@ -91,4 +91,24 @@ void FileIndexingJobTest::testNormalExecution() - QCOMPARE(spy2.count(), 1); - } - -+void FileIndexingJobTest::testTimeout() -+{ -+ QVector files; -+ for (int i = 0; i<40; i++) { -+ files << i; -+ } -+ -+ putenv("BALOO_EXTRACTOR_TIMEOUT_FILE=5"); -+ FileIndexingJob* job = new FileIndexingJob(files); -+ job->setTimeoutInterval(100); -+ -+ QSignalSpy spy(job, SIGNAL(indexingFailed(uint))); -+ QVERIFY(job->exec()); -+ -+ QCOMPARE(spy.count(), 1); -+ QCOMPARE(spy.at(0).size(), 1); -+ QCOMPARE(spy.at(0).first().toUInt(), (uint)5); -+} -+ -+ - QTEST_MAIN(FileIndexingJobTest); -diff --git a/src/file/autotest/fileindexingjob/fileindexingjobtest.h b/src/file/autotest/fileindexingjob/fileindexingjobtest.h -index 3d84c7a..72945fb 100644 ---- a/src/file/autotest/fileindexingjob/fileindexingjobtest.h -+++ b/src/file/autotest/fileindexingjob/fileindexingjobtest.h -@@ -35,6 +35,7 @@ private Q_SLOTS: - void testNormalExecution(); - void testFileFail(); - void testMultiFileFail(); -+ void testTimeout(); - }; - } - -diff --git a/src/file/fileindexingjob.cpp b/src/file/fileindexingjob.cpp -index d00b840..18f8121 100644 ---- a/src/file/fileindexingjob.cpp -+++ b/src/file/fileindexingjob.cpp -@@ -45,6 +45,8 @@ FileIndexingJob::FileIndexingJob(const QVector& files, QObject* parent) - m_processTimer->setSingleShot(true); - connect(m_processTimer, SIGNAL(timeout()), - this, SLOT(slotProcessTimerTimeout())); -+ -+ m_processTimeout = 5 * 60 * 1000; - } - - void FileIndexingJob::start() -@@ -87,8 +89,7 @@ void FileIndexingJob::start(const QVector& files) - m_process->setProcessChannelMode(QProcess::SeparateChannels); - m_process->start(exe, args); - -- // start the timer which will kill the process if it does not terminate after 5 minutes -- m_processTimer->start(5 * 60 * 1000); -+ m_processTimer->start(m_processTimeout); - } - - void FileIndexingJob::slotIndexedFile(int, QProcess::ExitStatus exitStatus) -@@ -148,5 +149,11 @@ void FileIndexingJob::setCustomDbPath(const QString& path) - m_customDbPath = path; - } - -+void FileIndexingJob::setTimeoutInterval(int msec) -+{ -+ m_processTimeout = msec; -+} -+ -+ - - #include "fileindexingjob.moc" -diff --git a/src/file/fileindexingjob.h b/src/file/fileindexingjob.h -index 1c2c321..d09aeb6 100644 ---- a/src/file/fileindexingjob.h -+++ b/src/file/fileindexingjob.h -@@ -47,6 +47,15 @@ public: - */ - void setCustomDbPath(const QString& path); - -+ /** -+ * Set the maximum number of msecs that each file should take in order -+ * to get indexed. If a file takes longer, then it will be marked -+ * as failing and the indexingFailed signal will be called -+ * -+ * By deafult this is 5 minutes -+ */ -+ void setTimeoutInterval(int msec); -+ - virtual void start(); - - Q_SIGNALS: -@@ -67,6 +76,7 @@ private: - - QProcess* m_process; - QTimer* m_processTimer; -+ int m_processTimeout; - - QString m_customDbPath; - }; --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0030-FileIndexingJob-Improve-logic.patch baloo-4.13.0/debian/patches/upstream_git/0030-FileIndexingJob-Improve-logic.patch --- baloo-4.12.97/debian/patches/upstream_git/0030-FileIndexingJob-Improve-logic.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0030-FileIndexingJob-Improve-logic.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -From 3f2ba1154d6f97db080ec2da272418e9fd93807a Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Tue, 1 Apr 2014 16:37:14 +0200 -Subject: [PATCH 30/56] FileIndexingJob: Improve logic - -The previous logic was slightly faulty and would not notify us on all -the files that should have failed to index. This code does, though it -still calls the extractor process many more times than is actually -necessary. ---- - src/file/fileindexingjob.cpp | 56 ++++++++++++++++++++++---------------------- - src/file/fileindexingjob.h | 3 +++ - 2 files changed, 31 insertions(+), 28 deletions(-) - -diff --git a/src/file/fileindexingjob.cpp b/src/file/fileindexingjob.cpp -index 18f8121..a6f8183 100644 ---- a/src/file/fileindexingjob.cpp -+++ b/src/file/fileindexingjob.cpp -@@ -102,40 +102,40 @@ void FileIndexingJob::slotIndexedFile(int, QProcess::ExitStatus exitStatus) - if (exitStatus == QProcess::NormalExit) { - if (m_files.isEmpty()) { - emitResult(); -- return; -- } -- } -- else { -- if (m_args.size() == 1) { -- uint doc = m_args.first(); -- kError() << "Indexer crashed while indexing" << doc; -- kError() << "Blacklisting this file"; -- Q_EMIT indexingFailed(doc); -- -- if (m_files.isEmpty()) { -- emitResult(); -- return; -- } -- } -- else { -- m_files = m_args; -+ } else { -+ m_args = m_files; -+ m_files.clear(); -+ start(m_args); - } -+ return; - } - -- // Split the number of files into half -- if (m_files.size() == 1) { -- m_args = m_files; -- m_files.clear(); -+ // Failed to index. We must figure out which was the offending file - -- start(m_args); -- } -- else { -- int mid = m_files.size()/2; -- m_args = m_files.mid(mid); -- m_files.resize(mid); -+ // Here it is! -+ if (m_args.size() == 1) { -+ uint doc = m_args.first(); -+ kError() << "Indexer crashed while indexing" << doc; -+ kError() << "Blacklisting this file"; -+ Q_EMIT indexingFailed(doc); - -- start(m_args); -+ if (m_files.isEmpty()) { -+ emitResult(); -+ } else { -+ m_args = m_files; -+ m_files.clear(); -+ start(m_args); -+ } -+ return; - } -+ -+ // We split the args into half and push the rest back into m_files -+ // to call later -+ int s = m_args.size() / 2; -+ m_files = m_args.mid(s) + m_files; -+ m_args.resize(s); -+ -+ start(m_args); - } - - void FileIndexingJob::slotProcessTimerTimeout() -diff --git a/src/file/fileindexingjob.h b/src/file/fileindexingjob.h -index d09aeb6..48e4fb2 100644 ---- a/src/file/fileindexingjob.h -+++ b/src/file/fileindexingjob.h -@@ -71,7 +71,10 @@ private Q_SLOTS: - private: - void start(const QVector& files); - -+ /// holds the files which still need to be indexed - QVector m_files; -+ -+ /// holds the files which have been sent to the process - QVector m_args; - - QProcess* m_process; --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0031-FileIndexingJob-Remember-to-disconnect-the-process-b.patch baloo-4.13.0/debian/patches/upstream_git/0031-FileIndexingJob-Remember-to-disconnect-the-process-b.patch --- baloo-4.12.97/debian/patches/upstream_git/0031-FileIndexingJob-Remember-to-disconnect-the-process-b.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0031-FileIndexingJob-Remember-to-disconnect-the-process-b.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -From f99a0a4d081f8086ab00c4fda33d116d0a0747c1 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Tue, 1 Apr 2014 16:38:37 +0200 -Subject: [PATCH 31/56] FileIndexingJob: Remember to disconnect the process - before deleting it - -Otherwise if this is called when the process is still running it results -in the slotIndexedFile function being called when the process is finally -destroyed. - -This fixes the testTimeout auto test ---- - src/file/fileindexingjob.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/file/fileindexingjob.cpp b/src/file/fileindexingjob.cpp -index a6f8183..1d5f6f7 100644 ---- a/src/file/fileindexingjob.cpp -+++ b/src/file/fileindexingjob.cpp -@@ -96,6 +96,7 @@ void FileIndexingJob::slotIndexedFile(int, QProcess::ExitStatus exitStatus) - { - // stop the timer since there is no need to kill the process anymore - m_processTimer->stop(); -+ m_process->disconnect(this); - m_process->deleteLater(); - m_process = 0; - -@@ -141,6 +142,7 @@ void FileIndexingJob::slotIndexedFile(int, QProcess::ExitStatus exitStatus) - void FileIndexingJob::slotProcessTimerTimeout() - { - // Emulate a crash so that we narrow down the file which is taking too long -+ qDebug() << "Process took too long killing"; - slotIndexedFile(1, QProcess::CrashExit); - } - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0032-FileIndexingJob-Remove-unnecessary-check.patch baloo-4.13.0/debian/patches/upstream_git/0032-FileIndexingJob-Remove-unnecessary-check.patch --- baloo-4.12.97/debian/patches/upstream_git/0032-FileIndexingJob-Remove-unnecessary-check.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0032-FileIndexingJob-Remove-unnecessary-check.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -From 995bbe7baf7306bf442adbec742bb6873b47fbdd Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Tue, 1 Apr 2014 16:42:17 +0200 -Subject: [PATCH 32/56] FileIndexingJob: Remove unnecessary check - -Replace it with an assert. It should never happen. ---- - src/file/fileindexingjob.cpp | 9 +-------- - 1 file changed, 1 insertion(+), 8 deletions(-) - -diff --git a/src/file/fileindexingjob.cpp b/src/file/fileindexingjob.cpp -index 1d5f6f7..3dde7e4 100644 ---- a/src/file/fileindexingjob.cpp -+++ b/src/file/fileindexingjob.cpp -@@ -64,14 +64,7 @@ void FileIndexingJob::start(const QVector& files) - // setup the external process which does the actual indexing - const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file_extractor")); - -- // Just in case -- if (m_process) { -- m_process->disconnect(); -- m_process->kill(); -- -- delete m_process; -- m_process = 0; -- } -+ Q_ASSERT(m_process == 0); - m_process = new QProcess(this); - - QStringList args; --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0033-FileIndexingJob-Minimize-the-number-of-calls-to-the-.patch baloo-4.13.0/debian/patches/upstream_git/0033-FileIndexingJob-Minimize-the-number-of-calls-to-the-.patch --- baloo-4.12.97/debian/patches/upstream_git/0033-FileIndexingJob-Minimize-the-number-of-calls-to-the-.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0033-FileIndexingJob-Minimize-the-number-of-calls-to-the-.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,101 +0,0 @@ -From d0c63165ffcd8be0bcb3b69f4a54cb12ce1543f2 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Tue, 1 Apr 2014 17:45:31 +0200 -Subject: [PATCH 33/56] FileIndexingJob: Minimize the number of calls to the - extractor - ---- - src/file/fileindexingjob.cpp | 19 ++++++++----------- - src/file/fileindexingjob.h | 3 ++- - 2 files changed, 10 insertions(+), 12 deletions(-) - -diff --git a/src/file/fileindexingjob.cpp b/src/file/fileindexingjob.cpp -index 3dde7e4..9ab398a 100644 ---- a/src/file/fileindexingjob.cpp -+++ b/src/file/fileindexingjob.cpp -@@ -37,9 +37,11 @@ using namespace Baloo; - - FileIndexingJob::FileIndexingJob(const QVector& files, QObject* parent) - : KJob(parent) -- , m_files(files) - , m_process(0) - { -+ Q_ASSERT(!files.isEmpty()); -+ m_files.push(files); -+ - // setup the timer used to kill the indexer process if it seems to get stuck - m_processTimer = new QTimer(this); - m_processTimer->setSingleShot(true); -@@ -51,11 +53,7 @@ FileIndexingJob::FileIndexingJob(const QVector& files, QObject* parent) - - void FileIndexingJob::start() - { -- Q_ASSERT(!m_files.isEmpty()); -- -- m_args = m_files; -- m_files.clear(); -- -+ m_args = m_files.pop(); - start(m_args); - } - -@@ -97,14 +95,14 @@ void FileIndexingJob::slotIndexedFile(int, QProcess::ExitStatus exitStatus) - if (m_files.isEmpty()) { - emitResult(); - } else { -- m_args = m_files; -- m_files.clear(); -+ m_args = m_files.pop(); - start(m_args); - } - return; - } - - // Failed to index. We must figure out which was the offending file -+ qDebug() << "Indexing failed. Trying to determine offending file"; - - // Here it is! - if (m_args.size() == 1) { -@@ -116,8 +114,7 @@ void FileIndexingJob::slotIndexedFile(int, QProcess::ExitStatus exitStatus) - if (m_files.isEmpty()) { - emitResult(); - } else { -- m_args = m_files; -- m_files.clear(); -+ m_args = m_files.pop(); - start(m_args); - } - return; -@@ -126,7 +123,7 @@ void FileIndexingJob::slotIndexedFile(int, QProcess::ExitStatus exitStatus) - // We split the args into half and push the rest back into m_files - // to call later - int s = m_args.size() / 2; -- m_files = m_args.mid(s) + m_files; -+ m_files.push(m_args.mid(s)); - m_args.resize(s); - - start(m_args); -diff --git a/src/file/fileindexingjob.h b/src/file/fileindexingjob.h -index 48e4fb2..3ad5c89 100644 ---- a/src/file/fileindexingjob.h -+++ b/src/file/fileindexingjob.h -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - - #include "filemapping.h" - -@@ -72,7 +73,7 @@ private: - void start(const QVector& files); - - /// holds the files which still need to be indexed -- QVector m_files; -+ QStack< QVector > m_files; - - /// holds the files which have been sent to the process - QVector m_args; --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0034-FileIndexer-Sync-the-config-file-after-initial-index.patch baloo-4.13.0/debian/patches/upstream_git/0034-FileIndexer-Sync-the-config-file-after-initial-index.patch --- baloo-4.12.97/debian/patches/upstream_git/0034-FileIndexer-Sync-the-config-file-after-initial-index.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0034-FileIndexer-Sync-the-config-file-after-initial-index.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -From 13ac6feef102a3c9fd1b81c34666e55aa4d05a34 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Tue, 1 Apr 2014 18:51:52 +0200 -Subject: [PATCH 34/56] FileIndexer: Sync the config file after initial - indexing - ---- - src/file/fileindexer.cpp | 7 ++++++- - src/file/fileindexer.h | 1 + - src/file/fileindexerconfig.cpp | 1 + - 3 files changed, 8 insertions(+), 1 deletion(-) - -diff --git a/src/file/fileindexer.cpp b/src/file/fileindexer.cpp -index e5f959e..7ac3f1d 100644 ---- a/src/file/fileindexer.cpp -+++ b/src/file/fileindexer.cpp -@@ -57,6 +57,8 @@ FileIndexer::FileIndexer(Database* db, FileIndexerConfig* config, QObject* paren - QDBusConnection::ExportScriptableSignals | - QDBusConnection::ExportScriptableSlots | - QDBusConnection::ExportAdaptors); -+ -+ m_initalRun = m_config->isInitialRun(); - } - - FileIndexer::~FileIndexer() -@@ -77,7 +79,10 @@ void FileIndexer::update() - - void FileIndexer::slotBasicIndexingDone() - { -- m_config->setInitialRun(false); -+ if (m_initalRun) { -+ m_config->setInitialRun(false); -+ m_initalRun = false; -+ } - } - - QString FileIndexer::statusMessage() const -diff --git a/src/file/fileindexer.h b/src/file/fileindexer.h -index f594e9a..70a228f 100644 ---- a/src/file/fileindexer.h -+++ b/src/file/fileindexer.h -@@ -97,6 +97,7 @@ private: - IndexScheduler* m_indexScheduler; - FileIndexerConfig* m_config; - bool m_startupUpdateDone; -+ bool m_initalRun; - }; - } - -diff --git a/src/file/fileindexerconfig.cpp b/src/file/fileindexerconfig.cpp -index 02ea0f0..ad4c298 100644 ---- a/src/file/fileindexerconfig.cpp -+++ b/src/file/fileindexerconfig.cpp -@@ -444,6 +444,7 @@ bool FileIndexerConfig::forceConfigUpdate() - void FileIndexerConfig::setInitialRun(bool isInitialRun) - { - m_config.group("General").writeEntry("first run", isInitialRun); -+ m_config.sync(); - } - - bool FileIndexerConfig::initialUpdateDisabled() const --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0035-XapianDatabase-Add-missing-slots-declaration.patch baloo-4.13.0/debian/patches/upstream_git/0035-XapianDatabase-Add-missing-slots-declaration.patch --- baloo-4.12.97/debian/patches/upstream_git/0035-XapianDatabase-Add-missing-slots-declaration.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0035-XapianDatabase-Add-missing-slots-declaration.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -From 562f1706f1b6b548fd7d74fec76f47012aeb4b91 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Wed, 2 Apr 2014 12:13:15 +0200 -Subject: [PATCH 35/56] XapianDatabase: Add missing slots declaration - ---- - src/xapian/xapiandatabase.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/xapian/xapiandatabase.h b/src/xapian/xapiandatabase.h -index 24d489d..d982761 100644 ---- a/src/xapian/xapiandatabase.h -+++ b/src/xapian/xapiandatabase.h -@@ -39,6 +39,7 @@ class BALOO_XAPIAN_EXPORT XapianDatabase : public QObject - public: - XapianDatabase(const QString& path); - -+public Q_SLOTS: - void replaceDocument(uint id, const Xapian::Document& doc); - void deleteDocument(uint id); - -@@ -49,6 +50,7 @@ public: - */ - void commit(); - -+public: - XapianDocument document(uint id); - - /** --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0036-IndexSchduler-Decrease-fileIQ-delay-when-idle.patch baloo-4.13.0/debian/patches/upstream_git/0036-IndexSchduler-Decrease-fileIQ-delay-when-idle.patch --- baloo-4.12.97/debian/patches/upstream_git/0036-IndexSchduler-Decrease-fileIQ-delay-when-idle.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0036-IndexSchduler-Decrease-fileIQ-delay-when-idle.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -From 3fe4d2e97aabbb878b30a1d572cebb5d65fc2848 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Wed, 2 Apr 2014 12:13:32 +0200 -Subject: [PATCH 36/56] IndexSchduler: Decrease fileIQ delay when idle - ---- - src/file/indexscheduler.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/file/indexscheduler.cpp b/src/file/indexscheduler.cpp -index ce4294f..6e2d354 100644 ---- a/src/file/indexscheduler.cpp -+++ b/src/file/indexscheduler.cpp -@@ -266,8 +266,10 @@ bool IndexScheduler::scheduleFileQueue() - return false; - case State_UserIdle: - m_fileIQ->setDelay(0); -+ return true; - case State_Normal: - m_fileIQ->setDelay(500); -+ return true; - default: - return true; - } --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0037-Add-a-script-to-keep-creating-and-deleting-files.patch baloo-4.13.0/debian/patches/upstream_git/0037-Add-a-script-to-keep-creating-and-deleting-files.patch --- baloo-4.12.97/debian/patches/upstream_git/0037-Add-a-script-to-keep-creating-and-deleting-files.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0037-Add-a-script-to-keep-creating-and-deleting-files.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -From b4f886837cf1a209f96c47903bd57873d59dfee9 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Wed, 2 Apr 2014 12:14:49 +0200 -Subject: [PATCH 37/56] Add a script to keep creating and deleting files - -This is a helper script which is useful in debugging database locks -which often occur when file indexing is routintely interrupted by the db -being locked. ---- - src/file/tests/createFile.sh | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - create mode 100755 src/file/tests/createFile.sh - -diff --git a/src/file/tests/createFile.sh b/src/file/tests/createFile.sh -new file mode 100755 -index 0000000..e9cf4ea ---- /dev/null -+++ b/src/file/tests/createFile.sh -@@ -0,0 +1,13 @@ -+#!/bin/sh -+ -+# This script is mostly used in order to make sure the baloo_file_extractor -+# process can cope with Xapian::DatabaseModified exceptions and when -+# it cannot obtain the write lock -+for i in {1..1000000} -+do -+ FILE="$HOME/_baloo_test_file$i" -+ touch $FILE -+ sleep 2 -+ rm $FILE -+ sleep 2 -+done --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0038-Index-contactgroup-too.patch baloo-4.13.0/debian/patches/upstream_git/0038-Index-contactgroup-too.patch --- baloo-4.12.97/debian/patches/upstream_git/0038-Index-contactgroup-too.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0038-Index-contactgroup-too.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,121 +0,0 @@ -From 572f20ef063c0e19cc49a932fa3ec293e736c50b Mon Sep 17 00:00:00 2001 -From: Montel Laurent -Date: Wed, 2 Apr 2014 14:06:57 +0200 -Subject: [PATCH 38/56] Index contactgroup too - ---- - src/pim/agent/contactindexer.cpp | 55 +++++++++++++++++++++++++++++++++++----- - src/pim/agent/contactindexer.h | 2 ++ - 2 files changed, 50 insertions(+), 7 deletions(-) - -diff --git a/src/pim/agent/contactindexer.cpp b/src/pim/agent/contactindexer.cpp -index a5a6865..9529676 100644 ---- a/src/pim/agent/contactindexer.cpp -+++ b/src/pim/agent/contactindexer.cpp -@@ -23,6 +23,7 @@ - #include "contactindexer.h" - - #include -+#include - #include - - ContactIndexer::ContactIndexer(const QString& path): -@@ -42,13 +43,13 @@ QStringList ContactIndexer::mimeTypes() const - return QStringList() << KABC::Addressee::mimeType(); - } - --void ContactIndexer::index(const Akonadi::Item& item) -+bool ContactIndexer::indexContact(const Akonadi::Item& item) - { - KABC::Addressee addresse; - try { - addresse = item.payload(); - } catch (const Akonadi::PayloadException&) { -- return; -+ return false; - } - - Xapian::Document doc; -@@ -67,8 +68,8 @@ void ContactIndexer::index(const Akonadi::Item& item) - name = addresse.name(); - } - -- std::string stdName = name.toStdString(); -- std::string stdNick = addresse.nickName().toStdString(); -+ const std::string stdName = name.toStdString(); -+ const std::string stdNick = addresse.nickName().toStdString(); - kDebug() << "Indexing" << name << addresse.nickName(); - - termGen.index_text(stdName); -@@ -89,12 +90,52 @@ void ContactIndexer::index(const Akonadi::Item& item) - Q_ASSERT_X(item.parentCollection().isValid(), "Baloo::ContactIndexer::index", - "Item does not have a valid parent collection"); - -- Akonadi::Entity::Id colId = item.parentCollection().id(); -- QByteArray term = 'C' + QByteArray::number(colId); -+ const Akonadi::Entity::Id colId = item.parentCollection().id(); -+ const QByteArray term = 'C' + QByteArray::number(colId); - doc.add_boolean_term(term.data()); - - m_db->replace_document(item.id(), doc); -- // TODO: Contact Groups? -+ return true; -+} -+ -+void ContactIndexer::indexContactGroup(const Akonadi::Item& item) -+{ -+ KABC::ContactGroup group; -+ try { -+ group = item.payload(); -+ } catch (const Akonadi::PayloadException&) { -+ return; -+ } -+ -+ Xapian::Document doc; -+ Xapian::TermGenerator termGen; -+ termGen.set_database(*m_db); -+ termGen.set_document(doc); -+ -+ const QString name = group.name(); -+ -+ const std::string stdName = name.toStdString(); -+ -+ termGen.index_text(stdName); -+ -+ termGen.index_text(stdName, 1, "NA"); -+ // Parent collection -+ Q_ASSERT_X(item.parentCollection().isValid(), "Baloo::ContactIndexer::index", -+ "Item does not have a valid parent collection"); -+ -+ const Akonadi::Entity::Id colId = item.parentCollection().id(); -+ const QByteArray term = 'C' + QByteArray::number(colId); -+ doc.add_boolean_term(term.data()); -+ -+ m_db->replace_document(item.id(), doc); -+} -+ -+ -+void ContactIndexer::index(const Akonadi::Item& item) -+{ -+ if (!indexContact(item)) { -+ indexContactGroup(item); -+ } - } - - void ContactIndexer::remove(const Akonadi::Item& item) -diff --git a/src/pim/agent/contactindexer.h b/src/pim/agent/contactindexer.h -index 49dfdeb..fb38ee8 100644 ---- a/src/pim/agent/contactindexer.h -+++ b/src/pim/agent/contactindexer.h -@@ -42,6 +42,8 @@ class ContactIndexer: public AbstractIndexer - void commit(); - - private: -+ bool indexContact(const Akonadi::Item &item); -+ void indexContactGroup(const Akonadi::Item &item); - Xapian::WritableDatabase* m_db; - }; - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0039-FileIndexerConfig-Use-a-simple-config.patch baloo-4.13.0/debian/patches/upstream_git/0039-FileIndexerConfig-Use-a-simple-config.patch --- baloo-4.12.97/debian/patches/upstream_git/0039-FileIndexerConfig-Use-a-simple-config.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0039-FileIndexerConfig-Use-a-simple-config.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -From 2fdf8a9ab98dbec7ed9d48e13276e09d6b3ebed2 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Wed, 2 Apr 2014 12:49:31 +0200 -Subject: [PATCH 39/56] FileIndexerConfig: Use a simple config - -We do not need anything more ---- - src/file/fileindexerconfig.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/file/fileindexerconfig.cpp b/src/file/fileindexerconfig.cpp -index ad4c298..4af8cd2 100644 ---- a/src/file/fileindexerconfig.cpp -+++ b/src/file/fileindexerconfig.cpp -@@ -53,7 +53,7 @@ using namespace Baloo; - - FileIndexerConfig::FileIndexerConfig(QObject* parent) - : QObject(parent) -- , m_config("baloofilerc") -+ , m_config("baloofilerc", KConfig::SimpleConfig) - , m_indexHidden(false) - { - KDirWatch* dirWatch = KDirWatch::self(); --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0040-FileIndexingJob-Avoid-calling-KStandardDirs-findExe-.patch baloo-4.13.0/debian/patches/upstream_git/0040-FileIndexingJob-Avoid-calling-KStandardDirs-findExe-.patch --- baloo-4.12.97/debian/patches/upstream_git/0040-FileIndexingJob-Avoid-calling-KStandardDirs-findExe-.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0040-FileIndexingJob-Avoid-calling-KStandardDirs-findExe-.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -From d5c016ea3a1730605c16eb4dc000cb0a6f0023da Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Wed, 2 Apr 2014 12:49:47 +0200 -Subject: [PATCH 40/56] FileIndexingJob: Avoid calling KStandardDirs::findExe - multiple times - ---- - src/file/fileindexingjob.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/file/fileindexingjob.cpp b/src/file/fileindexingjob.cpp -index 9ab398a..b07173f 100644 ---- a/src/file/fileindexingjob.cpp -+++ b/src/file/fileindexingjob.cpp -@@ -60,7 +60,7 @@ void FileIndexingJob::start() - void FileIndexingJob::start(const QVector& files) - { - // setup the external process which does the actual indexing -- const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file_extractor")); -+ static const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file_extractor")); - - Q_ASSERT(m_process == 0); - m_process = new QProcess(this); --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0041-FileIndexerConfig-Remove-all-locking-code.patch baloo-4.13.0/debian/patches/upstream_git/0041-FileIndexerConfig-Remove-all-locking-code.patch --- baloo-4.12.97/debian/patches/upstream_git/0041-FileIndexerConfig-Remove-all-locking-code.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0041-FileIndexerConfig-Remove-all-locking-code.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ -From c7036c46b8dffe1a8b9ce1c2eec52e40bf4b3a66 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Wed, 2 Apr 2014 12:52:35 +0200 -Subject: [PATCH 41/56] FileIndexerConfig: Remove all locking code - -We're always single threading, we no longer need all this locking. ---- - src/file/fileindexerconfig.cpp | 9 --------- - src/file/fileindexerconfig.h | 6 ------ - 2 files changed, 15 deletions(-) - -diff --git a/src/file/fileindexerconfig.cpp b/src/file/fileindexerconfig.cpp -index 4af8cd2..cc84d8b 100644 ---- a/src/file/fileindexerconfig.cpp -+++ b/src/file/fileindexerconfig.cpp -@@ -22,8 +22,6 @@ - - #include - #include --#include --#include - - #include - #include -@@ -189,13 +187,11 @@ bool FileIndexerConfig::shouldFolderBeIndexed(const QString& path) const - bool FileIndexerConfig::shouldFileBeIndexed(const QString& fileName) const - { - // check the filters -- QWriteLocker lock(&m_folderCacheMutex); - return !m_excludeFilterRegExpCache.exactMatch(fileName); - } - - bool FileIndexerConfig::shouldMimeTypeBeIndexed(const QString& mimeType) const - { -- QReadLocker lock(&m_mimetypeMutex); - return !m_excludeMimetypes.contains(mimeType); - } - -@@ -208,8 +204,6 @@ bool FileIndexerConfig::folderInFolderList(const QString& path) - - bool FileIndexerConfig::folderInFolderList(const QString& path, QString& folder) const - { -- QReadLocker lock(&m_folderCacheMutex); -- - const QString p = KUrl(path).path(KUrl::RemoveTrailingSlash); - - // we traverse the list backwards to catch all exclude folders -@@ -308,7 +302,6 @@ void FileIndexerConfig::fillExcludeFolderChanges(const FileIndexerConfig::Entry& - - bool FileIndexerConfig::buildFolderCache() - { -- QWriteLocker lock(&m_folderCacheMutex); - - // - // General folders -@@ -393,7 +386,6 @@ bool FileIndexerConfig::buildFolderCache() - - bool FileIndexerConfig::buildExcludeFilterRegExpCache() - { -- QWriteLocker lock(&m_folderCacheMutex); - QStringList newFilters = excludeFilters(); - m_excludeFilterRegExpCache.rebuildCacheFromFilterList(newFilters); - -@@ -409,7 +401,6 @@ bool FileIndexerConfig::buildExcludeFilterRegExpCache() - - bool FileIndexerConfig::buildMimeTypeCache() - { -- QWriteLocker lock(&m_mimetypeMutex); - QStringList newMimeExcludes = m_config.group("General").readPathEntry("exclude mimetypes", defaultExcludeMimetypes()); - - QSet newMimeExcludeSet = newMimeExcludes.toSet(); -diff --git a/src/file/fileindexerconfig.h b/src/file/fileindexerconfig.h -index 4fdb5db..73675be 100644 ---- a/src/file/fileindexerconfig.h -+++ b/src/file/fileindexerconfig.h -@@ -22,11 +22,8 @@ - #include - #include - #include --#include --#include - - #include --#include - - #include "regexpcache.h" - -@@ -189,9 +186,6 @@ private: - - bool m_indexHidden; - -- mutable QReadWriteLock m_folderCacheMutex; -- mutable QReadWriteLock m_mimetypeMutex; -- - static FileIndexerConfig* s_self; - - // --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0042-MetaDataMover-Remove-internal-queue-and-make-it-sync.patch baloo-4.13.0/debian/patches/upstream_git/0042-MetaDataMover-Remove-internal-queue-and-make-it-sync.patch --- baloo-4.12.97/debian/patches/upstream_git/0042-MetaDataMover-Remove-internal-queue-and-make-it-sync.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0042-MetaDataMover-Remove-internal-queue-and-make-it-sync.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,323 +0,0 @@ -From 3b5cb08a5450cc01e7700697e46262bf80847324 Mon Sep 17 00:00:00 2001 -From: Nitul Datt -Date: Wed, 2 Apr 2014 13:02:45 +0200 -Subject: [PATCH 42/56] MetaDataMover: Remove internal queue and make it sync - -The MetaDataMover is fast enough that it does not need to be -asynchronous. It's mostly just executing a single SQL query, and even in -the cases that it does block, that's okay. All other operations will -continue after that. - -Also, it was never really asynchronous it just queued the operation and -executed it later in the same thread. - -REVIEW: 116919 -BUG: 329039 ---- - src/file/CMakeLists.txt | 1 - - src/file/autotest/metadatamovertest.cpp | 4 -- - src/file/metadatamover.cpp | 75 ++++----------------------------- - src/file/metadatamover.h | 21 +-------- - src/file/updaterequest.cpp | 27 ------------ - src/file/updaterequest.h | 67 ----------------------------- - 6 files changed, 9 insertions(+), 186 deletions(-) - delete mode 100644 src/file/updaterequest.cpp - delete mode 100644 src/file/updaterequest.h - -diff --git a/src/file/CMakeLists.txt b/src/file/CMakeLists.txt -index e33c7ca..49a34dd 100644 ---- a/src/file/CMakeLists.txt -+++ b/src/file/CMakeLists.txt -@@ -6,7 +6,6 @@ add_subdirectory(search) - set(file_SRCS - # Filewatch - filewatch.cpp -- updaterequest.cpp - activefilequeue.cpp - metadatamover.cpp - database.cpp -diff --git a/src/file/autotest/metadatamovertest.cpp b/src/file/autotest/metadatamovertest.cpp -index 4a0961b..e3920c0 100644 ---- a/src/file/autotest/metadatamovertest.cpp -+++ b/src/file/autotest/metadatamovertest.cpp -@@ -72,10 +72,6 @@ void MetadataMoverTest::testRemoveFile() - QSignalSpy spy(&mover, SIGNAL(fileRemoved(int))); - mover.removeFileMetadata(url); - -- QEventLoop loop; -- connect(&mover, SIGNAL(fileRemoved(int)), &loop, SLOT(quit())); -- loop.exec(); -- - QCOMPARE(spy.size(), 1); - QCOMPARE(spy.at(0).size(), 1); - QCOMPARE(spy.at(0).first().toUInt(), fid); -diff --git a/src/file/metadatamover.cpp b/src/file/metadatamover.cpp -index 14d454a..9503b30 100644 ---- a/src/file/metadatamover.cpp -+++ b/src/file/metadatamover.cpp -@@ -34,13 +34,7 @@ using namespace Baloo; - MetadataMover::MetadataMover(Database* db, QObject* parent) - : QObject(parent) - , m_db(db) -- , m_queueMutex(QMutex::Recursive) - { -- // setup the main update queue timer -- m_queueTimer = new QTimer(this); -- connect(m_queueTimer, SIGNAL(timeout()), -- this, SLOT(slotWorkUpdateQueue()), -- Qt::DirectConnection); - } - - -@@ -55,16 +49,14 @@ void MetadataMover::moveFileMetadata(const QString& from, const QString& to) - Q_ASSERT(!from.isEmpty() && from != "/"); - Q_ASSERT(!to.isEmpty() && to != "/"); - -- QMutexLocker lock(&m_queueMutex); -+ // We do NOT get deleted messages for overwritten files! Thus, we -+ // have to remove all metadata for overwritten files first. -+ removeMetadata(to); - -- UpdateRequest req(from, to); -- if (!m_updateQueue.contains(req)) -- m_updateQueue.enqueue(req); -- -- QTimer::singleShot(0, this, SLOT(slotStartUpdateTimer())); -+ // and finally update the old statements -+ updateMetadata(from, to); - } - -- - void MetadataMover::removeFileMetadata(const QString& file) - { - Q_ASSERT(!file.isEmpty() && file != "/"); -@@ -75,55 +67,9 @@ void MetadataMover::removeFileMetadata(const QString& file) - void MetadataMover::removeFileMetadata(const QStringList& files) - { - kDebug() << files; -- QMutexLocker lock(&m_queueMutex); - - Q_FOREACH (const QString& file, files) { -- UpdateRequest req(file); -- if (!m_updateQueue.contains(req)) -- m_updateQueue.enqueue(req); -- } -- -- QTimer::singleShot(0, this, SLOT(slotStartUpdateTimer())); --} -- -- --void MetadataMover::slotWorkUpdateQueue() --{ -- // lock for initial iteration -- QMutexLocker lock(&m_queueMutex); -- -- // work the queue -- if (!m_updateQueue.isEmpty()) { -- UpdateRequest updateRequest = m_updateQueue.dequeue(); -- -- // unlock after queue utilization -- lock.unlock(); -- --// kDebug() << "========================= handling" << updateRequest.source() << updateRequest.target(); -- -- // an empty second url means deletion -- if (updateRequest.target().isEmpty()) { -- removeMetadata(updateRequest.source()); -- } else { -- const QString from = updateRequest.source(); -- const QString to = updateRequest.target(); -- -- // We do NOT get deleted messages for overwritten files! Thus, we -- // have to remove all metadata for overwritten files first. -- removeMetadata(to); -- -- // and finally update the old statements -- updateMetadata(from, to); -- } -- --// kDebug() << "========================= done with" << updateRequest.source() << updateRequest.target(); -- } else { -- //kDebug() << "All update requests handled. Stopping timer."; -- -- m_db->sqlDatabase().commit(); -- m_db->sqlDatabase().transaction(); -- -- m_queueTimer->stop(); -+ removeMetadata(file); - } - } - -@@ -210,14 +156,9 @@ void MetadataMover::updateMetadata(const QString& from, const QString& to) - if (!query.exec(queryStr)) { - kError() << "Big query failed:" << query.lastError().text(); - } --} - --// start the timer in the update thread --void MetadataMover::slotStartUpdateTimer() --{ -- if (!m_queueTimer->isActive()) { -- m_queueTimer->start(); -- } -+ m_db->sqlDatabase().commit(); -+ m_db->sqlDatabase().transaction(); - } - - #include "metadatamover.moc" -diff --git a/src/file/metadatamover.h b/src/file/metadatamover.h -index d7975ec..826f62b 100644 ---- a/src/file/metadatamover.h -+++ b/src/file/metadatamover.h -@@ -19,12 +19,8 @@ - #ifndef _METADATA_MOVER_H_ - #define _METADATA_MOVER_H_ - --#include --#include -+#include - --#include "updaterequest.h" -- --class QTimer; - class Database; - - namespace Baloo -@@ -59,14 +55,6 @@ Q_SIGNALS: - */ - void fileRemoved(int id); - --private Q_SLOTS: -- void slotWorkUpdateQueue(); -- -- /** -- * Start the update queue from the main thread. -- */ -- void slotStartUpdateTimer(); -- - private: - /** - * Remove the metadata for file \p url -@@ -80,13 +68,6 @@ private: - void updateMetadata(const QString& from, const QString& to); - - Database* m_db; -- -- // if the second url is empty, just delete the metadata -- QQueue m_updateQueue; -- -- QMutex m_queueMutex; -- -- QTimer* m_queueTimer; - }; - } - -diff --git a/src/file/updaterequest.cpp b/src/file/updaterequest.cpp -deleted file mode 100644 -index 63dd9c5..0000000 ---- a/src/file/updaterequest.cpp -+++ /dev/null -@@ -1,27 +0,0 @@ --/* -- This file is part of the Nepomuk KDE project. -- Copyright (C) 2009 Sebastian Trueg -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) version 3, or any -- later version accepted by the membership of KDE e.V. (or its -- successor approved by the membership of KDE e.V.), which shall -- act as a proxy defined in Section 6 of version 3 of the license. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this library. If not, see . --*/ -- --#include "updaterequest.h" -- --uint Baloo::qHash(const UpdateRequest& req) --{ -- return qHash(req.source()) ^ qHash(req.target()); --} -diff --git a/src/file/updaterequest.h b/src/file/updaterequest.h -deleted file mode 100644 -index 1844dff..0000000 ---- a/src/file/updaterequest.h -+++ /dev/null -@@ -1,67 +0,0 @@ --/* -- This file is part of the Nepomuk KDE project. -- Copyright (C) 2009 Sebastian Trueg -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) version 3, or any -- later version accepted by the membership of KDE e.V. (or its -- successor approved by the membership of KDE e.V.), which shall -- act as a proxy defined in Section 6 of version 3 of the license. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with this library. If not, see . --*/ -- --#ifndef _UPDATE_REQUEST_H_ --#define _UPDATE_REQUEST_H_ -- --#include --#include -- --namespace Baloo --{ --/** -- * One update request with a timestamp. -- */ --class UpdateRequest --{ --public: -- UpdateRequest(const QString& s = QString(), -- const QString& t = QString()) -- : m_source(s), -- m_target(t) { -- m_timestamp = QDateTime::currentDateTime(); -- } -- -- /// here the timestamp is ignored deliberately -- bool operator==(const UpdateRequest& other) const { -- return m_source == other.m_source && m_target == other.m_target; -- } -- -- QDateTime timestamp() const { -- return m_timestamp; -- } -- QString source() const { -- return m_source; -- } -- QString target() const { -- return m_target; -- } -- --private: -- QString m_source; -- QString m_target; -- QDateTime m_timestamp; --}; -- --uint qHash(const UpdateRequest& req); --} -- --#endif --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0043-XapianDatabase-Make-the-commit-function-blocking.patch baloo-4.13.0/debian/patches/upstream_git/0043-XapianDatabase-Make-the-commit-function-blocking.patch --- baloo-4.12.97/debian/patches/upstream_git/0043-XapianDatabase-Make-the-commit-function-blocking.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0043-XapianDatabase-Make-the-commit-function-blocking.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,385 +0,0 @@ -From d6e8b93f87932670abff3940273e442ef9846e50 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Wed, 2 Apr 2014 14:39:03 +0200 -Subject: [PATCH 43/56] XapianDatabase: Make the commit function blocking - -The commit function now keeps trying to obtain the write lock, each time -it fails it sleep for a short interval. Calling a slot at a later point -and using a timer is not always practical. - -Additionally since everyone is using the XapianDatabase class, everyone -will hold the lock for the minimum amount of time. ---- - src/file/commitqueue.cpp | 5 +- - src/file/extractor/app.cpp | 7 +-- - src/file/extractor/app.h | 1 - - src/file/lib/filemodifyjob.cpp | 11 ++-- - src/file/lib/filemodifyjob.h | 1 - - src/xapian/xapiandatabase.cpp | 121 +++++++++++++++++++++++------------------ - src/xapian/xapiandatabase.h | 20 +++---- - 7 files changed, 83 insertions(+), 83 deletions(-) - -diff --git a/src/file/commitqueue.cpp b/src/file/commitqueue.cpp -index b59bb5d..2a32982 100644 ---- a/src/file/commitqueue.cpp -+++ b/src/file/commitqueue.cpp -@@ -40,9 +40,6 @@ Baloo::CommitQueue::CommitQueue(Database* db, QObject* parent) - m_largeTimer.setSingleShot(true); - m_largeTimer.setInterval(10000); - connect(&m_largeTimer, SIGNAL(timeout()), this, SLOT(commit())); -- -- connect(m_db->xapianDatabase(), SIGNAL(committed()), -- this, SIGNAL(committed())); - } - - Baloo::CommitQueue::~CommitQueue() -@@ -89,4 +86,6 @@ void Baloo::CommitQueue::commit() - - m_smallTimer.stop(); - m_largeTimer.stop(); -+ -+ Q_EMIT committed(); - } -diff --git a/src/file/extractor/app.cpp b/src/file/extractor/app.cpp -index 83ee293..12646d6 100644 ---- a/src/file/extractor/app.cpp -+++ b/src/file/extractor/app.cpp -@@ -61,9 +61,6 @@ App::App(QObject* parent) - return; - } - -- connect(m_db.xapianDatabase(), SIGNAL(committed()), -- this, SLOT(slotCommitted())); -- - m_bData = args->isSet("bdata"); - m_debugEnabled = args->isSet("debug"); - -@@ -206,10 +203,8 @@ void App::saveChanges() - } - - m_db.xapianDatabase()->commit(); --} -+ // vHanda: Write the Sqlite db? - --void App::slotCommitted() --{ - m_results.clear(); - m_termCount = 0; - m_updatedFiles.clear(); -diff --git a/src/file/extractor/app.h b/src/file/extractor/app.h -index 6f89a80..889db1d 100644 ---- a/src/file/extractor/app.h -+++ b/src/file/extractor/app.h -@@ -45,7 +45,6 @@ public: - private Q_SLOTS: - void processNextUrl(); - void saveChanges(); -- void slotCommitted(); - - Q_SIGNALS: - void saved(); -diff --git a/src/file/lib/filemodifyjob.cpp b/src/file/lib/filemodifyjob.cpp -index 1e957e9..a5abf40 100644 ---- a/src/file/lib/filemodifyjob.cpp -+++ b/src/file/lib/filemodifyjob.cpp -@@ -53,7 +53,6 @@ public: - bool tagsSet; - - XapianDatabase* m_db; -- QStringList m_updatedFiles; - - Private() - : rating(0) -@@ -94,6 +93,8 @@ void FileModifyJob::start() - - void FileModifyJob::doStart() - { -+ QStringList updatedFiles; -+ - Q_FOREACH (const File& file, d->files) { - FileMapping fileMap(file.url()); - if (!file.id().isEmpty()) { -@@ -121,7 +122,7 @@ void FileModifyJob::doStart() - return; - } - -- d->m_updatedFiles << fileMap.url(); -+ updatedFiles << fileMap.url(); - const QString furl = fileMap.url(); - - if (d->ratingSet) { -@@ -162,13 +163,9 @@ void FileModifyJob::doStart() - } - - d->m_db->replaceDocument(fileMap.id(), doc.doc()); -- connect(d->m_db, SIGNAL(committed()), this, SLOT(slotCommitted())); - d->m_db->commit(); - } --} - --void FileModifyJob::slotCommitted() --{ - // Notify the world? - QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/files"), - QLatin1String("org.kde"), -@@ -176,7 +173,7 @@ void FileModifyJob::slotCommitted() - - QVariantList vl; - vl.reserve(1); -- vl << QVariant(d->m_updatedFiles); -+ vl << QVariant(updatedFiles); - message.setArguments(vl); - - QDBusConnection::sessionBus().send(message); -diff --git a/src/file/lib/filemodifyjob.h b/src/file/lib/filemodifyjob.h -index 38ccdea..cb3c37f 100644 ---- a/src/file/lib/filemodifyjob.h -+++ b/src/file/lib/filemodifyjob.h -@@ -49,7 +49,6 @@ public: - - private Q_SLOTS: - void doStart(); -- void slotCommitted(); - - private: - class Private; -diff --git a/src/xapian/xapiandatabase.cpp b/src/xapian/xapiandatabase.cpp -index d139ea7..5c63c47 100644 ---- a/src/xapian/xapiandatabase.cpp -+++ b/src/xapian/xapiandatabase.cpp -@@ -1,5 +1,4 @@ - /* -- * - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or -@@ -26,27 +25,32 @@ - #include - - #include -+#include - - using namespace Baloo; - --XapianDatabase::XapianDatabase(const QString& path) -- : QObject() -- , m_db(0) -+XapianDatabase::XapianDatabase(const QString& path, bool writeOnly) -+ : m_db(0) - { - QDir().mkpath(path); - m_path = path.toUtf8().constData(); - -- try { -- Xapian::WritableDatabase(m_path, Xapian::DB_CREATE_OR_OPEN); -- m_db = new Xapian::Database(m_path); -+ if (!writeOnly) { -+ try { -+ createWritableDb(); -+ m_db = new Xapian::Database(m_path); -+ } -+ catch (const Xapian::DatabaseError& err) { -+ kError() << "Serious Error: " << err.get_error_string(); -+ kError() << err.get_msg().c_str() << err.get_context().c_str() << err.get_description().c_str(); -+ } -+ -+ // Possible errors - DatabaseLock error -+ // Corrupt and InvalidID error - } -- catch (const Xapian::DatabaseError& err) { -- kError() << "Serious Error: " << err.get_error_string(); -- kError() << err.get_msg().c_str() << err.get_context().c_str() << err.get_description().c_str(); -+ else { -+ m_wDb = createWritableDb(); - } -- -- // Possible errors - DatabaseLock error -- // Corrupt and InvalidID error - } - - void XapianDatabase::replaceDocument(uint id, const Xapian::Document& doc) -@@ -62,56 +66,33 @@ void XapianDatabase::deleteDocument(uint id) - void XapianDatabase::commit() - { - if (m_docsToAdd.isEmpty() && m_docsToRemove.isEmpty()) { -- Q_EMIT committed(); - return; - } - -- try { -- Xapian::WritableDatabase wdb(m_path, Xapian::DB_CREATE_OR_OPEN); -+ Xapian::WritableDatabase wdb = createWritableDb(); - -- kDebug() << "Adding:" << m_docsToAdd.size() << "docs"; -- Q_FOREACH (const DocIdPair& doc, m_docsToAdd) { -- wdb.replace_document(doc.first, doc.second); -- } -+ kDebug() << "Adding:" << m_docsToAdd.size() << "docs"; -+ Q_FOREACH (const DocIdPair& doc, m_docsToAdd) { -+ wdb.replace_document(doc.first, doc.second); -+ } - -- kDebug() << "Removing:" << m_docsToRemove.size() << "docs"; -- Q_FOREACH (Xapian::docid id, m_docsToRemove) { -- try { -- wdb.delete_document(id); -- } -- catch (const Xapian::DocNotFoundError&) { -- } -+ kDebug() << "Removing:" << m_docsToRemove.size() << "docs"; -+ Q_FOREACH (Xapian::docid id, m_docsToRemove) { -+ try { -+ wdb.delete_document(id); - } -+ catch (const Xapian::DocNotFoundError&) { -+ } -+ } - -- wdb.commit(); -- m_db->reopen(); -- kDebug() << "Xapian Committed"; -- -- m_docsToAdd.clear(); -- m_docsToRemove.clear(); -- -- malloc_trim(0); -+ wdb.commit(); -+ m_db->reopen(); -+ kDebug() << "Xapian Committed"; - -- Q_EMIT committed(); -- } -- catch (const Xapian::DatabaseLockError& err) { -- kError() << err.get_msg().c_str(); -- retryCommit(); -- } -- catch (const Xapian::DatabaseModifiedError& err) { -- kError() << err.get_msg().c_str(); -- kError() << "Commit failed, retrying in another 200 msecs"; -- retryCommit(); -- } -- catch (const Xapian::DatabaseError& err) { -- kError() << err.get_msg().c_str(); -- retryCommit(); -- } --} -+ m_docsToAdd.clear(); -+ m_docsToRemove.clear(); - --void XapianDatabase::retryCommit() --{ -- QTimer::singleShot(200, this, SLOT(commit())); -+ malloc_trim(0); - } - - XapianDocument XapianDatabase::document(uint id) -@@ -129,5 +110,37 @@ XapianDocument XapianDatabase::document(uint id) - } - } - -+Xapian::WritableDatabase XapianDatabase::createWritableDb() -+{ -+ // We need to keep sleeping for a required amount, until we reach -+ // a threshold. That's when we decide to abort? -+ for (int i = 1; i <= 20; i++) { -+ try { -+ Xapian::WritableDatabase wdb(m_path, Xapian::DB_CREATE_OR_OPEN); -+ return wdb; -+ } -+ catch (const Xapian::DatabaseLockError&) { -+ usleep(i * 50 * 1000); -+ } -+ catch (const Xapian::DatabaseModifiedError&) { -+ usleep(i * 50 * 1000); -+ } -+ catch (const Xapian::DatabaseCreateError& err) { -+ kDebug() << err.get_error_string(); -+ return Xapian::WritableDatabase(); -+ } -+ catch (const Xapian::DatabaseCorruptError& err) { -+ kError() << "Database Corrupted - What did you do?"; -+ kError() << err.get_error_string(); -+ return Xapian::WritableDatabase(); -+ } -+ catch (...) { -+ kError() << "Bananana Error"; -+ return Xapian::WritableDatabase(); -+ } -+ } - -+ kError() << "Could not obtain lock for Xapian Database. This is bad"; -+ return Xapian::WritableDatabase(); -+} - -diff --git a/src/xapian/xapiandatabase.h b/src/xapian/xapiandatabase.h -index d982761..430bee6 100644 ---- a/src/xapian/xapiandatabase.h -+++ b/src/xapian/xapiandatabase.h -@@ -1,5 +1,4 @@ - /* -- * - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or -@@ -25,7 +24,6 @@ - #include "xapian_export.h" - - #include --#include - #include - #include - -@@ -33,13 +31,16 @@ namespace Baloo { - - class XapianDocument; - --class BALOO_XAPIAN_EXPORT XapianDatabase : public QObject -+class BALOO_XAPIAN_EXPORT XapianDatabase - { -- Q_OBJECT - public: -- XapianDatabase(const QString& path); -+ /** -+ * Create the Xapian db at path \p path. The parameter \p -+ * writeOnly locks the database as long as this object is -+ * valid -+ */ -+ XapianDatabase(const QString& path, bool writeOnly = false); - --public Q_SLOTS: - void replaceDocument(uint id, const Xapian::Document& doc); - void deleteDocument(uint id); - -@@ -50,7 +51,6 @@ public Q_SLOTS: - */ - void commit(); - --public: - XapianDocument document(uint id); - - /** -@@ -63,11 +63,9 @@ public: - return m_db; - } - --Q_SIGNALS: -- void committed(); -- - private: - Xapian::Database* m_db; -+ Xapian::WritableDatabase m_wDb; - - typedef QPair DocIdPair; - QVector m_docsToAdd; -@@ -75,7 +73,7 @@ private: - - std::string m_path; - -- void retryCommit(); -+ Xapian::WritableDatabase createWritableDb(); - }; - - } --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0044-XapianDB-Implement-a-write-only-mode.patch baloo-4.13.0/debian/patches/upstream_git/0044-XapianDB-Implement-a-write-only-mode.patch --- baloo-4.12.97/debian/patches/upstream_git/0044-XapianDB-Implement-a-write-only-mode.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0044-XapianDB-Implement-a-write-only-mode.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,307 +0,0 @@ -From 0350407984eae51e79ca9c7607970d4d92e3a9c8 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Wed, 2 Apr 2014 15:38:44 +0200 -Subject: [PATCH 44/56] XapianDB: Implement a write only mode - -In this writeonly mode, we do not keep 2 databases - one for reading and -one for writing. The disadvantage is that no one else can write as long -as the object is in use. - -This patch also modifies the baloo_file_extractor to use this write only -db as it only need to hold the lock for a very small amount of time. ---- - src/file/database.cpp | 8 +++++--- - src/file/database.h | 2 +- - src/file/extractor/app.cpp | 40 +++++++++++++++++++--------------------- - src/file/extractor/app.h | 2 +- - src/file/lib/filemapping.cpp | 28 ++++++++++++++++++++++++++++ - src/file/lib/filemapping.h | 2 ++ - src/xapian/xapiandatabase.cpp | 21 ++++++++++++++++++++- - src/xapian/xapiandatabase.h | 1 + - 8 files changed, 77 insertions(+), 27 deletions(-) - -diff --git a/src/file/database.cpp b/src/file/database.cpp -index c841b99..7afcca7 100644 ---- a/src/file/database.cpp -+++ b/src/file/database.cpp -@@ -49,13 +49,15 @@ Database::~Database() - QSqlDatabase::removeDatabase(name); - } - --bool Database::init() -+bool Database::init(bool sqlOnly) - { - if (m_initialized) - return true; - -- // Create the Xapian DB -- m_xapianDb = new Baloo::XapianDatabase(m_path); -+ if (!sqlOnly) { -+ // Create the Xapian DB -+ m_xapianDb = new Baloo::XapianDatabase(m_path); -+ } - - m_sqlDb = new QSqlDatabase(QSqlDatabase::addDatabase("QSQLITE")); - m_sqlDb->setDatabaseName(m_path + "/fileMap.sqlite3"); -diff --git a/src/file/database.h b/src/file/database.h -index 2018efc..f2a6836 100644 ---- a/src/file/database.h -+++ b/src/file/database.h -@@ -37,7 +37,7 @@ public: - QString path(); - void setPath(const QString& path); - -- bool init(); -+ bool init(bool sqlOnly = false); - bool isInitialized(); - - QSqlDatabase& sqlDatabase(); -diff --git a/src/file/extractor/app.cpp b/src/file/extractor/app.cpp -index 12646d6..9c7a70f 100644 ---- a/src/file/extractor/app.cpp -+++ b/src/file/extractor/app.cpp -@@ -23,6 +23,7 @@ - #include "app.h" - #include "../basicindexingjob.h" - #include "../database.h" -+#include "xapiandatabase.h" - - #include - #include -@@ -50,13 +51,12 @@ App::App(QObject* parent) - - if (!args->getOption("db").isEmpty()) { - m_path = args->getOption("db"); -- } -- else { -+ } else { - m_path = KGlobal::dirs()->localxdgdatadir() + "baloo/file"; - } - - m_db.setPath(m_path); -- if (!m_db.init()) { -+ if (!m_db.init(true /*sql db only*/)) { - QTimer::singleShot(0, QCoreApplication::instance(), SLOT(quit())); - return; - } -@@ -68,31 +68,30 @@ App::App(QObject* parent) - for (int i=0; icount(); i++) { - FileMapping mapping = FileMapping(args->arg(i).toUInt()); - QString url; -+ -+ // arg is an id - if (mapping.fetch(m_db.sqlDatabase())) { -- // arg is an id - url = mapping.url(); -- // If this url no longer exists, remove it from the mapping db. - if (!QFile::exists(url)) { -- QSqlQuery query(m_db.sqlDatabase()); -- query.prepare("delete from files where url = ?"); -- query.addBindValue(url); -- if (!query.exec()) { -- kError() << query.lastError().text(); -- } -+ mapping.remove(m_db.sqlDatabase()); -+ continue; - } - } else { - // arg is a url - url = args->url(i).toLocalFile(); - } -+ - if (QFile::exists(url)) { - m_urls << url; - } else { - // id or url was looked up, but file deleted - kDebug() << url << "does not exist"; -+ - // Try to delete it as an id: - // it may have been deleted from the FileMapping db as well. - // The worst that can happen is deleting nothing. -- deleteDocument(mapping.id()); -+ mapping.remove(m_db.sqlDatabase()); -+ m_docsToDelete << mapping.id(); - } - } - -@@ -194,16 +193,21 @@ void App::saveChanges() - - m_updatedFiles.clear(); - -+ XapianDatabase xapDb(m_path); - for (int i = 0; ireplaceDocument(res.id(), res.document()); -+ xapDb.replaceDocument(res.id(), res.document()); - m_updatedFiles << res.inputUrl(); - } - -- m_db.xapianDatabase()->commit(); -- // vHanda: Write the Sqlite db? -+ Q_FOREACH (int docid, m_docsToDelete) { -+ xapDb.deleteDocument(docid); -+ } -+ -+ xapDb.commit(); -+ m_db.sqlDatabase().commit(); - - m_results.clear(); - m_termCount = 0; -@@ -227,12 +231,6 @@ void App::saveChanges() - Q_EMIT saved(); - } - -- --void App::deleteDocument(unsigned docid) --{ -- m_db.xapianDatabase()->deleteDocument(docid); --} -- - void App::printDebug() - { - Q_FOREACH (const Result& res, m_results) { -diff --git a/src/file/extractor/app.h b/src/file/extractor/app.h -index 889db1d..5e1698e 100644 ---- a/src/file/extractor/app.h -+++ b/src/file/extractor/app.h -@@ -50,7 +50,6 @@ Q_SIGNALS: - void saved(); - - private: -- void deleteDocument(unsigned docid); - void printDebug(); - - QVector m_results; -@@ -66,6 +65,7 @@ private: - - int m_termCount; - QList m_updatedFiles; -+ QVector m_docsToDelete; - }; - - } -diff --git a/src/file/lib/filemapping.cpp b/src/file/lib/filemapping.cpp -index 471aec4..316cfe0 100644 ---- a/src/file/lib/filemapping.cpp -+++ b/src/file/lib/filemapping.cpp -@@ -131,6 +131,34 @@ bool FileMapping::create(QSqlDatabase db) - return true; - } - -+bool FileMapping::remove(QSqlDatabase db) -+{ -+ if (m_url.isEmpty() && m_id == 0) -+ return false; -+ -+ QSqlQuery query(db); -+ -+ if (!m_url.isEmpty()) { -+ query.prepare("delete from files where url = ?"); -+ query.addBindValue(m_url); -+ if (!query.exec()) { -+ kError() << query.lastError().text(); -+ return false; -+ } -+ } -+ else { -+ query.prepare("delete from files where id = ?"); -+ query.addBindValue(m_id); -+ if (!query.exec()) { -+ kError() << query.lastError().text(); -+ return false; -+ } -+ } -+ -+ return true; -+} -+ -+ - void FileMapping::clear() - { - m_id = 0; -diff --git a/src/file/lib/filemapping.h b/src/file/lib/filemapping.h -index 31d66b6..71dff2d 100644 ---- a/src/file/lib/filemapping.h -+++ b/src/file/lib/filemapping.h -@@ -60,6 +60,8 @@ public: - */ - bool create(QSqlDatabase db); - -+ bool remove(QSqlDatabase db); -+ - bool operator ==(const FileMapping& rhs) const; - - private: -diff --git a/src/xapian/xapiandatabase.cpp b/src/xapian/xapiandatabase.cpp -index 5c63c47..a6bbd18 100644 ---- a/src/xapian/xapiandatabase.cpp -+++ b/src/xapian/xapiandatabase.cpp -@@ -31,6 +31,7 @@ using namespace Baloo; - - XapianDatabase::XapianDatabase(const QString& path, bool writeOnly) - : m_db(0) -+ , m_writeOnly(writeOnly) - { - QDir().mkpath(path); - m_path = path.toUtf8().constData(); -@@ -55,16 +56,29 @@ XapianDatabase::XapianDatabase(const QString& path, bool writeOnly) - - void XapianDatabase::replaceDocument(uint id, const Xapian::Document& doc) - { -+ if (m_writeOnly) { -+ m_wDb.replace_document(id, doc); -+ return; -+ } - m_docsToAdd << qMakePair(id, doc); - } - - void XapianDatabase::deleteDocument(uint id) - { -+ if (m_writeOnly) { -+ m_wDb.delete_document(id); -+ return; -+ } - m_docsToRemove << id; - } - - void XapianDatabase::commit() - { -+ if (m_writeOnly) { -+ m_wDb.commit(); -+ return; -+ } -+ - if (m_docsToAdd.isEmpty() && m_docsToRemove.isEmpty()) { - return; - } -@@ -98,7 +112,12 @@ void XapianDatabase::commit() - XapianDocument XapianDatabase::document(uint id) - { - try { -- Xapian::Document xdoc = m_db->get_document(id); -+ Xapian::Document xdoc; -+ if (m_writeOnly) { -+ xdoc = m_wDb.get_document(id); -+ } else { -+ xdoc = m_db->get_document(id); -+ } - return XapianDocument(xdoc); - } - catch (const Xapian::DatabaseModifiedError&) { -diff --git a/src/xapian/xapiandatabase.h b/src/xapian/xapiandatabase.h -index 430bee6..abe7680 100644 ---- a/src/xapian/xapiandatabase.h -+++ b/src/xapian/xapiandatabase.h -@@ -72,6 +72,7 @@ private: - QVector m_docsToRemove; - - std::string m_path; -+ bool m_writeOnly; - - Xapian::WritableDatabase createWritableDb(); - }; --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0045-ContactIndexer-Port-to-the-Baloo-Xapian-library.patch baloo-4.13.0/debian/patches/upstream_git/0045-ContactIndexer-Port-to-the-Baloo-Xapian-library.patch --- baloo-4.12.97/debian/patches/upstream_git/0045-ContactIndexer-Port-to-the-Baloo-Xapian-library.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0045-ContactIndexer-Port-to-the-Baloo-Xapian-library.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,268 +0,0 @@ -From fdccf18bd1559b4dd8aae934dc8a40af255159fe Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Wed, 2 Apr 2014 16:55:07 +0200 -Subject: [PATCH 45/56] ContactIndexer: Port to the Baloo::Xapian library - -Makes the code much easier to read. Also, this way we're not converting -strings to std::string which results in us loosing anything above 127. ---- - src/pim/agent/CMakeLists.txt | 1 + - src/pim/agent/contactindexer.cpp | 60 ++++++++++++++-------------------------- - src/pim/agent/contactindexer.h | 6 ++-- - src/xapian/xapiandatabase.cpp | 11 +++++++- - src/xapian/xapiandatabase.h | 1 + - src/xapian/xapiandocument.cpp | 2 +- - src/xapian/xapiandocument.h | 4 +-- - 7 files changed, 39 insertions(+), 46 deletions(-) - -diff --git a/src/pim/agent/CMakeLists.txt b/src/pim/agent/CMakeLists.txt -index efdca9b..e917915 100644 ---- a/src/pim/agent/CMakeLists.txt -+++ b/src/pim/agent/CMakeLists.txt -@@ -28,6 +28,7 @@ target_link_libraries(akonadi_baloo_indexer - ${KDEPIMLIBS_KABC_LIBS} - ${XAPIAN_LIBRARIES} - ${KDEPIMLIBS_KPIMUTILS_LIBS} -+ balooxapian - ) - - install(TARGETS akonadi_baloo_indexer ${INSTALL_TARGETS_DEFAULT_ARGS}) -diff --git a/src/pim/agent/contactindexer.cpp b/src/pim/agent/contactindexer.cpp -index 9529676..16a3f95 100644 ---- a/src/pim/agent/contactindexer.cpp -+++ b/src/pim/agent/contactindexer.cpp -@@ -21,6 +21,7 @@ - */ - - #include "contactindexer.h" -+#include "xapiandocument.h" - - #include - #include -@@ -29,7 +30,7 @@ - ContactIndexer::ContactIndexer(const QString& path): - AbstractIndexer() - { -- m_db = new Xapian::WritableDatabase(path.toStdString(), Xapian::DB_CREATE_OR_OPEN); -+ m_db = new Baloo::XapianDatabase(path, true); - } - - ContactIndexer::~ContactIndexer() -@@ -52,10 +53,7 @@ bool ContactIndexer::indexContact(const Akonadi::Item& item) - return false; - } - -- Xapian::Document doc; -- Xapian::TermGenerator termGen; -- termGen.set_database(*m_db); -- termGen.set_document(doc); -+ Baloo::XapianDocument doc; - - QString name; - if (!addresse.formattedName().isEmpty()) { -@@ -68,22 +66,18 @@ bool ContactIndexer::indexContact(const Akonadi::Item& item) - name = addresse.name(); - } - -- const std::string stdName = name.toStdString(); -- const std::string stdNick = addresse.nickName().toStdString(); - kDebug() << "Indexing" << name << addresse.nickName(); - -- termGen.index_text(stdName); -- termGen.index_text(stdNick); -- doc.add_boolean_term(addresse.uid().toStdString()); -+ doc.indexText(name); -+ doc.indexText(addresse.nickName()); -+ doc.indexText(addresse.uid()); - -- termGen.index_text(stdName, 1, "NA"); -- termGen.index_text(stdNick, 1, "NI"); -+ doc.indexText(name, "NA"); -+ doc.indexText(addresse.nickName(), "NI"); - - Q_FOREACH (const QString& email, addresse.emails()) { -- std::string stdEmail = email.toStdString(); -- -- doc.add_term(stdEmail); -- termGen.index_text(stdEmail); -+ doc.addTerm(email); -+ doc.indexText(email); - } - - // Parent collection -@@ -91,10 +85,9 @@ bool ContactIndexer::indexContact(const Akonadi::Item& item) - "Item does not have a valid parent collection"); - - const Akonadi::Entity::Id colId = item.parentCollection().id(); -- const QByteArray term = 'C' + QByteArray::number(colId); -- doc.add_boolean_term(term.data()); -+ doc.addBoolTerm(colId, "C"); - -- m_db->replace_document(item.id(), doc); -+ m_db->replaceDocument(item.id(), doc); - return true; - } - -@@ -107,27 +100,20 @@ void ContactIndexer::indexContactGroup(const Akonadi::Item& item) - return; - } - -- Xapian::Document doc; -- Xapian::TermGenerator termGen; -- termGen.set_database(*m_db); -- termGen.set_document(doc); -+ Baloo::XapianDocument doc; - - const QString name = group.name(); -+ doc.indexText(name); -+ doc.indexText(name, "NA"); - -- const std::string stdName = name.toStdString(); -- -- termGen.index_text(stdName); -- -- termGen.index_text(stdName, 1, "NA"); - // Parent collection - Q_ASSERT_X(item.parentCollection().isValid(), "Baloo::ContactIndexer::index", - "Item does not have a valid parent collection"); - - const Akonadi::Entity::Id colId = item.parentCollection().id(); -- const QByteArray term = 'C' + QByteArray::number(colId); -- doc.add_boolean_term(term.data()); -+ doc.addBoolTerm(colId, "C"); - -- m_db->replace_document(item.id(), doc); -+ m_db->replaceDocument(item.id(), doc); - } - - -@@ -140,22 +126,18 @@ void ContactIndexer::index(const Akonadi::Item& item) - - void ContactIndexer::remove(const Akonadi::Item& item) - { -- try { -- m_db->delete_document(item.id()); -- } -- catch (const Xapian::DocNotFoundError&) { -- return; -- } -+ m_db->deleteDocument(item.id()); - } - - void ContactIndexer::remove(const Akonadi::Collection& collection) - { - try { -+ Xapian::Database* db = m_db->db(); - Xapian::Query query('C'+ QString::number(collection.id()).toStdString()); -- Xapian::Enquire enquire(*m_db); -+ Xapian::Enquire enquire(*db); - enquire.set_query(query); - -- Xapian::MSet mset = enquire.get_mset(0, m_db->get_doccount()); -+ Xapian::MSet mset = enquire.get_mset(0, db->get_doccount()); - Xapian::MSetIterator end(mset.end()); - for (Xapian::MSetIterator it = mset.begin(); it != end; ++it) { - const qint64 id = *it; -diff --git a/src/pim/agent/contactindexer.h b/src/pim/agent/contactindexer.h -index fb38ee8..cd751bd 100644 ---- a/src/pim/agent/contactindexer.h -+++ b/src/pim/agent/contactindexer.h -@@ -24,8 +24,7 @@ - #define CONTACTINDEXER_H - - #include "abstractindexer.h" -- --#include -+#include "xapiandatabase.h" - - class ContactIndexer: public AbstractIndexer - { -@@ -44,7 +43,8 @@ class ContactIndexer: public AbstractIndexer - private: - bool indexContact(const Akonadi::Item &item); - void indexContactGroup(const Akonadi::Item &item); -- Xapian::WritableDatabase* m_db; -+ -+ Baloo::XapianDatabase* m_db; - }; - - #endif // CONTACTINDEXER_H -diff --git a/src/xapian/xapiandatabase.cpp b/src/xapian/xapiandatabase.cpp -index a6bbd18..a509731 100644 ---- a/src/xapian/xapiandatabase.cpp -+++ b/src/xapian/xapiandatabase.cpp -@@ -54,6 +54,11 @@ XapianDatabase::XapianDatabase(const QString& path, bool writeOnly) - } - } - -+void XapianDatabase::replaceDocument(uint id, const XapianDocument& doc) -+{ -+ replaceDocument(id, doc.doc()); -+} -+ - void XapianDatabase::replaceDocument(uint id, const Xapian::Document& doc) - { - if (m_writeOnly) { -@@ -66,7 +71,11 @@ void XapianDatabase::replaceDocument(uint id, const Xapian::Document& doc) - void XapianDatabase::deleteDocument(uint id) - { - if (m_writeOnly) { -- m_wDb.delete_document(id); -+ try { -+ m_wDb.delete_document(id); -+ } -+ catch (const Xapian::DocNotFoundError&) { -+ } - return; - } - m_docsToRemove << id; -diff --git a/src/xapian/xapiandatabase.h b/src/xapian/xapiandatabase.h -index abe7680..8eca833 100644 ---- a/src/xapian/xapiandatabase.h -+++ b/src/xapian/xapiandatabase.h -@@ -42,6 +42,7 @@ public: - XapianDatabase(const QString& path, bool writeOnly = false); - - void replaceDocument(uint id, const Xapian::Document& doc); -+ void replaceDocument(uint id, const XapianDocument& doc); - void deleteDocument(uint id); - - /** -diff --git a/src/xapian/xapiandocument.cpp b/src/xapian/xapiandocument.cpp -index a7149e5..a2a3dff 100644 ---- a/src/xapian/xapiandocument.cpp -+++ b/src/xapian/xapiandocument.cpp -@@ -66,7 +66,7 @@ void XapianDocument::indexText(const QString& text, int wdfInc) - indexText(text, QString(), wdfInc); - } - --Xapian::Document XapianDocument::doc() -+Xapian::Document XapianDocument::doc() const - { - return m_doc; - } -diff --git a/src/xapian/xapiandocument.h b/src/xapian/xapiandocument.h -index 98bf35f..452595b 100644 ---- a/src/xapian/xapiandocument.h -+++ b/src/xapian/xapiandocument.h -@@ -38,7 +38,7 @@ public: - XapianDocument(); - XapianDocument(const Xapian::Document& doc); - -- void addTerm(const QString& term, const QString& prefix); -+ void addTerm(const QString& term, const QString& prefix = QString()); - void addBoolTerm(const QString& term, const QString& prefix = QString()); - void addBoolTerm(int term, const QString& prefix); - -@@ -47,7 +47,7 @@ public: - - void addValue(int pos, const QString& value); - -- Xapian::Document doc(); -+ Xapian::Document doc() const; - - QString fetchTermStartsWith(const QByteArray& term); - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0046-Runner-Use-the-Baloo-icon.patch baloo-4.13.0/debian/patches/upstream_git/0046-Runner-Use-the-Baloo-icon.patch --- baloo-4.12.97/debian/patches/upstream_git/0046-Runner-Use-the-Baloo-icon.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0046-Runner-Use-the-Baloo-icon.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -From 6f85025610f48076ac3b11613934cf33b6f67cd2 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Thu, 3 Apr 2014 11:01:07 +0200 -Subject: [PATCH 46/56] Runner: Use the Baloo icon - ---- - src/runner/plasma-runner-baloosearch.desktop | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/runner/plasma-runner-baloosearch.desktop b/src/runner/plasma-runner-baloosearch.desktop -index c4c5fee..044fbfc 100644 ---- a/src/runner/plasma-runner-baloosearch.desktop -+++ b/src/runner/plasma-runner-baloosearch.desktop -@@ -67,7 +67,7 @@ Comment[zh_CN]=在文件、电子邮件和联系人中进行搜索的 Runner - Comment[zh_TW]=搜尋檔案、電子郵件與聯絡人的執行器 - X-KDE-ServiceTypes=Plasma/Runner - Type=Service --Icon=edit-find -+Icon=baloo - X-KDE-Library=krunner_baloosearchrunner - X-KDE-PluginInfo-Author=Vishesh Handa - X-KDE-PluginInfo-Email=me@vhanda.in --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0047-XapianSearchStore-Catch-some-more-exceptions.patch baloo-4.13.0/debian/patches/upstream_git/0047-XapianSearchStore-Catch-some-more-exceptions.patch --- baloo-4.12.97/debian/patches/upstream_git/0047-XapianSearchStore-Catch-some-more-exceptions.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0047-XapianSearchStore-Catch-some-more-exceptions.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -From ca31cdaf61fd6865091aacb4e9768d5650360d46 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Thu, 3 Apr 2014 15:10:57 +0200 -Subject: [PATCH 47/56] XapianSearchStore: Catch some more exceptions - ---- - src/xapian/xapiansearchstore.cpp | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/src/xapian/xapiansearchstore.cpp b/src/xapian/xapiansearchstore.cpp -index 59c035b..0edf99a 100644 ---- a/src/xapian/xapiansearchstore.cpp -+++ b/src/xapian/xapiansearchstore.cpp -@@ -46,12 +46,19 @@ void XapianSearchStore::setDbPath(const QString& path) - m_dbPath = path; - - delete m_db; -+ m_db = 0; -+ - try { - m_db = new Xapian::Database(m_dbPath.toUtf8().constData()); - } - catch (const Xapian::DatabaseOpeningError&) { - kError() << "Xapian Database does not exist at " << m_dbPath; -- m_db = 0; -+ } -+ catch (const Xapian::DatabaseCorruptError&) { -+ kError() << "Xapian Database corrupted at " << m_dbPath; -+ } -+ catch (...) { -+ kError() << "Random exception, but we do not want to crash"; - } - } - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0048-SVN_SILENT-made-messages-.desktop-file.patch baloo-4.13.0/debian/patches/upstream_git/0048-SVN_SILENT-made-messages-.desktop-file.patch --- baloo-4.12.97/debian/patches/upstream_git/0048-SVN_SILENT-made-messages-.desktop-file.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0048-SVN_SILENT-made-messages-.desktop-file.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -From f09fb69b3d314dbf9258b689886acd69a6d819fc Mon Sep 17 00:00:00 2001 -From: l10n daemon script -Date: Fri, 4 Apr 2014 08:35:55 +0000 -Subject: [PATCH 48/56] SVN_SILENT made messages (.desktop file) - ---- - src/file/inotify/org.kde.baloo.filewatch.actions | 1 + - src/file/kcm/kcm_baloofile.desktop | 1 + - src/runner/plasma-runner-baloosearch.desktop | 1 + - 3 files changed, 3 insertions(+) - -diff --git a/src/file/inotify/org.kde.baloo.filewatch.actions b/src/file/inotify/org.kde.baloo.filewatch.actions -index 769ea92..cf72a98 100644 ---- a/src/file/inotify/org.kde.baloo.filewatch.actions -+++ b/src/file/inotify/org.kde.baloo.filewatch.actions -@@ -11,6 +11,7 @@ Name[es]=Límite de vigilancia de carpetas - Name[fi]=Kansioiden valvontaraja - Name[fr]=Limite de surveillance des dossiers - Name[hu]=Mappafigyelési korlát -+Name[ia]=Limite de guardia de dossier - Name[it]=Limite di osservazione delle cartelle - Name[ko]=폴더 감시 제한 - Name[lt]=Aplankų stebėjimo riba -diff --git a/src/file/kcm/kcm_baloofile.desktop b/src/file/kcm/kcm_baloofile.desktop -index 8add6de..25be4ae 100644 ---- a/src/file/kcm/kcm_baloofile.desktop -+++ b/src/file/kcm/kcm_baloofile.desktop -@@ -21,6 +21,7 @@ Name[es]=Búsqueda de escritorio - Name[fi]=Työpöytähaku - Name[fr]=Recherche sur le bureau - Name[hu]=Asztali keresés -+Name[ia]=Cerca de Scriptorio - Name[it]=Ricerca dal desktop - Name[ko]=데스크톱 검색 - Name[lt]=Darbastalio paieška -diff --git a/src/runner/plasma-runner-baloosearch.desktop b/src/runner/plasma-runner-baloosearch.desktop -index 044fbfc..42863bb 100644 ---- a/src/runner/plasma-runner-baloosearch.desktop -+++ b/src/runner/plasma-runner-baloosearch.desktop -@@ -11,6 +11,7 @@ Name[es]=Búsqueda de escritorio - Name[fi]=Työpöytähaku - Name[fr]=Recherche sur le bureau - Name[hu]=Asztali keresés -+Name[ia]=Cerca de Scriptorio - Name[it]=Ricerca dal desktop - Name[ko]=데스크톱 검색 - Name[lt]=Darbastalio paieška --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0049-XapianDatabase-Catch-more-exceptions.patch baloo-4.13.0/debian/patches/upstream_git/0049-XapianDatabase-Catch-more-exceptions.patch --- baloo-4.12.97/debian/patches/upstream_git/0049-XapianDatabase-Catch-more-exceptions.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0049-XapianDatabase-Catch-more-exceptions.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -From 707f61f3c4134b64bdd923cf4dc5199219b79c01 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Mon, 7 Apr 2014 18:20:21 +0200 -Subject: [PATCH 49/56] XapianDatabase: Catch more exceptions - -BUG: 332403 ---- - src/xapian/xapiandatabase.cpp | 16 ++++++++++++---- - 1 file changed, 12 insertions(+), 4 deletions(-) - -diff --git a/src/xapian/xapiandatabase.cpp b/src/xapian/xapiandatabase.cpp -index a509731..2fda1de 100644 ---- a/src/xapian/xapiandatabase.cpp -+++ b/src/xapian/xapiandatabase.cpp -@@ -62,7 +62,11 @@ void XapianDatabase::replaceDocument(uint id, const XapianDocument& doc) - void XapianDatabase::replaceDocument(uint id, const Xapian::Document& doc) - { - if (m_writeOnly) { -- m_wDb.replace_document(id, doc); -+ try { -+ m_wDb.replace_document(id, doc); -+ } -+ catch (const Xapian::Error&) { -+ } - return; - } - m_docsToAdd << qMakePair(id, doc); -@@ -74,7 +78,7 @@ void XapianDatabase::deleteDocument(uint id) - try { - m_wDb.delete_document(id); - } -- catch (const Xapian::DocNotFoundError&) { -+ catch (const Xapian::Error&) { - } - return; - } -@@ -96,7 +100,11 @@ void XapianDatabase::commit() - - kDebug() << "Adding:" << m_docsToAdd.size() << "docs"; - Q_FOREACH (const DocIdPair& doc, m_docsToAdd) { -- wdb.replace_document(doc.first, doc.second); -+ try { -+ wdb.replace_document(doc.first, doc.second); -+ } -+ catch (const Xapian::Error&) { -+ } - } - - kDebug() << "Removing:" << m_docsToRemove.size() << "docs"; -@@ -104,7 +112,7 @@ void XapianDatabase::commit() - try { - wdb.delete_document(id); - } -- catch (const Xapian::DocNotFoundError&) { -+ catch (const Xapian::Error&) { - } - } - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0050-Prepare-4.13.0.patch baloo-4.13.0/debian/patches/upstream_git/0050-Prepare-4.13.0.patch --- baloo-4.12.97/debian/patches/upstream_git/0050-Prepare-4.13.0.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0050-Prepare-4.13.0.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -From 76bc0308863ac5cdbc82ec7758e90fbbc014a810 Mon Sep 17 00:00:00 2001 -From: Montel Laurent -Date: Tue, 8 Apr 2014 07:25:04 +0200 -Subject: [PATCH 50/56] Prepare 4.13.0 - ---- - CMakeLists.txt | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 11f863e..1e5b278 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,8 +1,8 @@ - project(baloo) - - set(BALOO_VERSION_MAJOR 4) --set(BALOO_VERSION_MINOR 12) --set(BALOO_VERSION_RELEASE 97) -+set(BALOO_VERSION_MINOR 13) -+set(BALOO_VERSION_RELEASE 0) - set(BALOO_VERSION "${BALOO_VERSION_MAJOR}.${BALOO_VERSION_MINOR}.${BALOO_VERSION_RELEASE}") - - -@@ -11,7 +11,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH}) - find_package(KDE4 REQUIRED) - include(KDE4Defaults) - --find_package(KdepimLibs 4.12.97 CONFIG) -+find_package(KdepimLibs 4.13.0 CONFIG) - set_package_properties(KdepimLibs PROPERTIES - DESCRIPTION "The KDEPIM libraries" - URL "http://www.kde.org" --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0051-SVN_SILENT-made-messages-.desktop-file.patch baloo-4.13.0/debian/patches/upstream_git/0051-SVN_SILENT-made-messages-.desktop-file.patch --- baloo-4.12.97/debian/patches/upstream_git/0051-SVN_SILENT-made-messages-.desktop-file.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0051-SVN_SILENT-made-messages-.desktop-file.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,177 +0,0 @@ -From 2e74b27fc004638ea4aad6db0b99f0c0f4900d2c Mon Sep 17 00:00:00 2001 -From: l10n daemon script -Date: Tue, 8 Apr 2014 10:36:16 +0000 -Subject: [PATCH 51/56] SVN_SILENT made messages (.desktop file) - ---- - src/file/baloo_file.desktop | 2 ++ - src/file/inotify/org.kde.baloo.filewatch.actions | 3 +++ - src/file/kcm/kcm_baloofile.desktop | 5 +++++ - src/pim/agent/akonadibalooindexingagent.desktop | 2 ++ - src/pim/akonadiplugin/akonadibaloosearchplugin.desktop | 2 ++ - src/runner/plasma-runner-baloosearch.desktop | 3 +++ - 6 files changed, 17 insertions(+) - -diff --git a/src/file/baloo_file.desktop b/src/file/baloo_file.desktop -index c02bd58..5458c57 100644 ---- a/src/file/baloo_file.desktop -+++ b/src/file/baloo_file.desktop -@@ -19,6 +19,7 @@ Name[es]=Demonio del archivo Baloo - Name[fi]=Baloo-tiedostopalvelu - Name[fr]=Démon de fichier Baloo - Name[hu]=Baloo fájl démon -+Name[ia]=Baloo File Daemon (Demon de file de Baloo) - Name[it]=Demone dei file Baloo - Name[ko]=Baloo 파일 데몬 - Name[lt]=Baloo failų tarnyba -@@ -29,6 +30,7 @@ Name[pa]=ਬਾਲੂ ਫਾਇਲ ਡੈਮਨ - Name[pl]=Usługa plików Baloo - Name[pt]=Serviço de Ficheiros do Baloo - Name[pt_BR]=Serviço de arquivos do Baloo -+Name[ru]=Служба мониторинга файлов для Baloo - Name[sk]=Súborový démon Baloo - Name[sl]=Ozadnji program za datoteke Baloo - Name[sr]=Демон Балуа -diff --git a/src/file/inotify/org.kde.baloo.filewatch.actions b/src/file/inotify/org.kde.baloo.filewatch.actions -index cf72a98..0b8e216 100644 ---- a/src/file/inotify/org.kde.baloo.filewatch.actions -+++ b/src/file/inotify/org.kde.baloo.filewatch.actions -@@ -21,6 +21,7 @@ Name[nl]=Limiet op bewaakte mappen - Name[pl]=Ograniczenie obserwowania katalogu - Name[pt]=Limite de Monitorização de Pastas - Name[pt_BR]=Limite de monitoramento de pastas -+Name[ru]=Ограничение на число наблюдаемых папок - Name[sk]=Limit sledovania priečinka - Name[sl]=Omejitev opazovanih map - Name[sr]=Ограничење надгледања фасцикли -@@ -45,6 +46,7 @@ Description[es]=Para evitar pérdidas en cambios de archivos, eleve el límite d - Description[fi]=Nosta inotifyn kansioiden valvontarajaa välttääksesi sitä, että joitain tiedostomuutoksia ei huomata - Description[fr]=Pour éviter des changements de fichiers manquant, augmentez la limite de surveillance des dossiers - Description[hu]=A fájlváltoztatások hiányzásának elkerülése érdekében növelje a értesítő mappafigyelési korlátot -+Description[ia]=Pro evitar perder modificationes de file, altia le limite de guardia de dossier inotify - Description[it]=Per non perdere le modifiche ai file, alza il limite di osservazione delle cartelle di inotify - Description[ko]=파일 변경 사항을 놓치지 않으려면 inotify 폴더 감시 제한을 높이십시오 - Description[nb]=Øk grensen for mappeovervåker for å unngå å gå glipp av filendringer -@@ -53,6 +55,7 @@ Description[nl]=Om wijzigingen in bestanden niet te missen vergroot u de limiet - Description[pl]=Aby uniknąć zmiany brakujących plików, podwyższ ograniczenie obserwacji katalogu inotify - Description[pt]=Para evitar as alterações de ficheiros perdidas, aumente o limite de monitorização de pastas do 'inotify' - Description[pt_BR]=Para evitar a perda de alterações dos arquivos, aumente o limite de monitoramento das pastas do inotify -+Description[ru]=Чтобы изменения файлов не оставались незамеченными, увеличьте ограничение на число наблюдаемых с помощью inotify папок - Description[sk]=Na zabránenie chýbajúcich zmien v súboroch, zvýšte obmedzenie sledovania priečinka inotify - Description[sl]=Da se izognete spregledu sprememb datotek, povečajte omejitev opazovanih map inotify - Description[sr]=Веће ограничење надгледања фасцикли (inotify) избегава пропуштене измене фајлова -diff --git a/src/file/kcm/kcm_baloofile.desktop b/src/file/kcm/kcm_baloofile.desktop -index 25be4ae..2a05f8d 100644 ---- a/src/file/kcm/kcm_baloofile.desktop -+++ b/src/file/kcm/kcm_baloofile.desktop -@@ -32,6 +32,7 @@ Name[pa]=ਡੈਸਕਟਾਪ ਖੋਜ - Name[pl]=Wyszukiwanie na pulpicie - Name[pt]=Pesquisa no Ambiente de Trabalho - Name[pt_BR]=Pesquisa no desktop -+Name[ru]=Поиск по меткам и содержимому - Name[sk]=Hľadanie na ploche - Name[sl]=Namizno iskanje - Name[sr]=Претрага површи -@@ -55,6 +56,7 @@ Comment[es]=Configurar la búsqueda de escritorio - Comment[fi]=Työpöytähaun asetukset - Comment[fr]=Configurer la recherche sur le bureau - Comment[hu]=Asztali keresés beállítása -+Comment[ia]=Configura cerca de scriptorio - Comment[it]=Configura ricerca dal desktop - Comment[ko]=데스크톱 검색 설정 - Comment[lt]=Konfigūruoti darbastalio paiešką -@@ -64,6 +66,7 @@ Comment[nl]=Bureaubladzoeken instellen...  - Comment[pl]=Konfiguruj znajdywanie na pulpicie - Comment[pt]=Configurar a Pesquisa no Ambiente de Trabalho - Comment[pt_BR]=Configurar a pesquisa no desktop -+Comment[ru]=Настройка службы поиска - Comment[sk]=Nastaviť hľadanie na ploche - Comment[sl]=Nastavi Namizno iskanje - Comment[sr]=Подешавање претраге површи -@@ -87,6 +90,7 @@ X-KDE-Keywords[es]=Buscar, archivo, Baloo - X-KDE-Keywords[fi]=Search, File, haku, tiedosto, Baloo - X-KDE-Keywords[fr]=Recherche, fichier, Baloo - X-KDE-Keywords[hu]=Keresés, Fájl, Baloo -+X-KDE-Keywords[ia]=Cerca, File, Baloo - X-KDE-Keywords[it]=Ricerca, File, Baloo - X-KDE-Keywords[ko]=Search, File, Baloo,검색,파일 - X-KDE-Keywords[lt]=Paieška, Failas, Baloo -@@ -97,6 +101,7 @@ X-KDE-Keywords[pa]=ਖੋਜ, ਫਾਇਲ, ਬਾਲੂ - X-KDE-Keywords[pl]=Znajdź, Plik, Baloo - X-KDE-Keywords[pt]=Procurar, Ficheiro, Baloo - X-KDE-Keywords[pt_BR]=Pesquisar, Procurar, Arquivo, Baloo -+X-KDE-Keywords[ru]=Search, File, Baloo, поиск, файл, Балу - X-KDE-Keywords[sk]=Hľadať, súbor, Baloo - X-KDE-Keywords[sl]=Iskanje, datoteka, Baloo - X-KDE-Keywords[sr]=search;file;baloo;претрага;фајл;Балу -diff --git a/src/pim/agent/akonadibalooindexingagent.desktop b/src/pim/agent/akonadibalooindexingagent.desktop -index a0286ed..4a7371a 100644 ---- a/src/pim/agent/akonadibalooindexingagent.desktop -+++ b/src/pim/agent/akonadibalooindexingagent.desktop -@@ -10,6 +10,7 @@ Name[es]=Agente de indexación Baloo de Akonadi - Name[fi]=Akonadin Baloo-indeksointiagentti - Name[fr]=Agent d'indexation Baloo de Akonadi - Name[hu]=Akonadi Baloo indexelő ügynök -+Name[ia]=Agente de indicisation de Baloo de Akonadi - Name[it]=Agente di indicizzazione Baloo di Akonadi - Name[ko]=Akonadi Baloo 검색 에이전트 - Name[lt]=Akonadi Baloo indeksavimas agentas -@@ -19,6 +20,7 @@ Name[nl]=Akonadi-agent voor Baloo indexering - Name[pl]=Agent indeksowania Baloo dla Akonadi - Name[pt]=Agente de Indexação do Baloo no Akonadi - Name[pt_BR]=Agente de Indexação do Baloo no Akonadi -+Name[ru]=Агент индексирования данных Akonadi в Baloo - Name[sk]=Agent indexovania Akonadi Baloo - Name[sl]=Akonadijev posrednik za izgrajevanje kazal, Baloo - Name[sr]=Балуов агент индексирања над Аконадијем -diff --git a/src/pim/akonadiplugin/akonadibaloosearchplugin.desktop b/src/pim/akonadiplugin/akonadibaloosearchplugin.desktop -index 8de6231..9820196 100644 ---- a/src/pim/akonadiplugin/akonadibaloosearchplugin.desktop -+++ b/src/pim/akonadiplugin/akonadibaloosearchplugin.desktop -@@ -10,6 +10,7 @@ Name[es]=Agente de búsqueda Baloo de Akonadi - Name[fi]=Akonadin Baloo-hakuliitännäinen - Name[fr]=Module de recherche Baloo pour Akonadi - Name[hu]=Akonadi Baloo keresés bővítmény -+Name[ia]=Plugin de cerca de Baloo de Akonadi - Name[it]=Estensione di ricerca Baloo di Akonadi - Name[ko]=Akonadi Baloo 검색 플러그인 - Name[lt]=Akonadi Baloo paieškos priedas -@@ -19,6 +20,7 @@ Name[nl]=Akonadi-plug-in voor Baloo zoeken - Name[pl]=Wtyczka znajdywania Baloo dla Akonadi - Name[pt]=Agente de Pesquisa do Baloo no Akonadi - Name[pt_BR]=Plugin de pesquisa do Baloo no Akonadi -+Name[ru]=Модуль Baloo для поиска по базе данных Akonadi - Name[sk]=Plugin hľadania Akonadi Baloo - Name[sl]=Akonadijev vstavek za iskanje, Baloo - Name[sr]=Балуов прикључак претраге над Аконадијем -diff --git a/src/runner/plasma-runner-baloosearch.desktop b/src/runner/plasma-runner-baloosearch.desktop -index 42863bb..7d6a3f1 100644 ---- a/src/runner/plasma-runner-baloosearch.desktop -+++ b/src/runner/plasma-runner-baloosearch.desktop -@@ -22,6 +22,7 @@ Name[pa]=ਡੈਸਕਟਾਪ ਖੋਜ - Name[pl]=Wyszukiwanie na pulpicie - Name[pt]=Pesquisa no Ambiente de Trabalho - Name[pt_BR]=Pesquisa no desktop -+Name[ru]=Поиск по меткам и содержимому - Name[sk]=Hľadanie na ploche - Name[sl]=Namizno iskanje - Name[sr]=Претрага површи -@@ -45,6 +46,7 @@ Comment[es]=Lanzador con búsquedas en archivos, correo electrónico y contactos - Comment[fi]=Suoritusohjelma, joka etsii tiedostoista, sähköposteista ja yhteystiedoista - Comment[fr]=Lanceur de recherche dans les fichiers, courriels et contacts - Comment[hu]=Futtató, amely fájlokban, e-mailekben és névjegyekben keres -+Comment[ia]=Cursor de qual cercas a transverso de files, messages de e-posta e contactos - Comment[it]=Esecutore che cerca nei file, nei messaggi di posta e nei contatti - Comment[ko]=파일, 이메일, 연락처를 검색하는 실행기 - Comment[lt]=Paleidiklis, kuris Ieško failuose, el. laiškuose ir kontaktuose -@@ -54,6 +56,7 @@ Comment[nl]=Programma dat bestanden, e-mailberichten en contactpersonen doorzoek - Comment[pl]=Program, który przeszukuje pliki, pocztę i kontakty - Comment[pt]=Um módulo de execução que pesquisa nos ficheiros, e-mails e contactos - Comment[pt_BR]=Execução que pesquisa nos arquivos, e-mails e contatos -+Comment[ru]=Поиск по содержимому файлов, писем и по адресной книге - Comment[sk]=Bežec, ktorý prehľadáva vaše súbory, e-maily a kontakty - Comment[sl]=Zaganjalnik, ki preišče datoteke, e-pošto in stike - Comment[sr]=Извођач који тражи кроз фајлове, е‑пошту и контакте --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0052-XapianDatabase-Catch-even-more-exceptions.patch baloo-4.13.0/debian/patches/upstream_git/0052-XapianDatabase-Catch-even-more-exceptions.patch --- baloo-4.12.97/debian/patches/upstream_git/0052-XapianDatabase-Catch-even-more-exceptions.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0052-XapianDatabase-Catch-even-more-exceptions.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -From 97714643471f721b00350681482a04957831204f Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Tue, 8 Apr 2014 13:35:50 +0200 -Subject: [PATCH 52/56] XapianDatabase: Catch even more exceptions - ---- - src/xapian/xapiandatabase.cpp | 16 +++++++++++++--- - 1 file changed, 13 insertions(+), 3 deletions(-) - -diff --git a/src/xapian/xapiandatabase.cpp b/src/xapian/xapiandatabase.cpp -index 2fda1de..0478139 100644 ---- a/src/xapian/xapiandatabase.cpp -+++ b/src/xapian/xapiandatabase.cpp -@@ -88,7 +88,12 @@ void XapianDatabase::deleteDocument(uint id) - void XapianDatabase::commit() - { - if (m_writeOnly) { -- m_wDb.commit(); -+ try { -+ m_wDb.commit(); -+ } -+ catch (const Xapian::Error& err) { -+ kError() << err.get_error_string(); -+ } - return; - } - -@@ -116,8 +121,13 @@ void XapianDatabase::commit() - } - } - -- wdb.commit(); -- m_db->reopen(); -+ try { -+ wdb.commit(); -+ m_db->reopen(); -+ } -+ catch (const Xapian::Error& err) { -+ kError() << err.get_error_string(); -+ } - kDebug() << "Xapian Committed"; - - m_docsToAdd.clear(); --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0053-EmailTest-Make-it-more-like-the-agent.patch baloo-4.13.0/debian/patches/upstream_git/0053-EmailTest-Make-it-more-like-the-agent.patch --- baloo-4.12.97/debian/patches/upstream_git/0053-EmailTest-Make-it-more-like-the-agent.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0053-EmailTest-Make-it-more-like-the-agent.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -From 222ef3c534fc18f33c5fbf57c336392090273b1e Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Tue, 8 Apr 2014 15:22:13 +0200 -Subject: [PATCH 53/56] EmailTest: Make it more like the agent - -The agent commits the changes every 1 second, the test now does the same -thing. Previously it would test after each item, which was not very -practical and was useless for testing. ---- - src/pim/agent/tests/emailtest.cpp | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/src/pim/agent/tests/emailtest.cpp b/src/pim/agent/tests/emailtest.cpp -index 25103ab..5746975 100644 ---- a/src/pim/agent/tests/emailtest.cpp -+++ b/src/pim/agent/tests/emailtest.cpp -@@ -44,6 +44,7 @@ private Q_SLOTS: - void indexNextCollection(); - void itemReceived(const Akonadi::Item::List& item); - void slotIndexed(); -+ void slotCommitTimerElapsed(); - - private: - Akonadi::Collection::List m_collections; -@@ -52,6 +53,8 @@ private: - QTime m_totalTime; - int m_indexTime; - int m_numEmails; -+ -+ QTimer m_commitTimer; - }; - - int main(int argc, char** argv) -@@ -69,6 +72,10 @@ App::App(int& argc, char** argv, int flags) - - void App::main() - { -+ m_commitTimer.setInterval(1000); -+ connect(&m_commitTimer, SIGNAL(timeout()), this, SLOT(slotCommitTimerElapsed())); -+ m_commitTimer.start(); -+ - Akonadi::CollectionFetchJob* job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(), - Akonadi::CollectionFetchJob::Recursive); - connect(job, SIGNAL(finished(KJob*)), this, SLOT(slotRootCollectionsFetched(KJob*))); -@@ -124,8 +131,13 @@ void App::itemReceived(const Akonadi::Item::List& itemList) - - m_indexTime += timer.elapsed(); - m_numEmails += itemList.size(); -+} -+ -+void App::slotCommitTimerElapsed() -+{ -+ QTime timer; -+ timer.start(); - -- timer.restart(); - m_indexer.commit(); - m_indexTime += timer.elapsed(); - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0054-Email-Test-Print-io-debug-information.patch baloo-4.13.0/debian/patches/upstream_git/0054-Email-Test-Print-io-debug-information.patch --- baloo-4.12.97/debian/patches/upstream_git/0054-Email-Test-Print-io-debug-information.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0054-Email-Test-Print-io-debug-information.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -From 798fbc52bbc5f5b8d1635eac90340e6f3aa6c374 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Tue, 8 Apr 2014 15:23:14 +0200 -Subject: [PATCH 54/56] Email Test: Print io debug information - ---- - src/pim/agent/tests/emailtest.cpp | 40 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 40 insertions(+) - -diff --git a/src/pim/agent/tests/emailtest.cpp b/src/pim/agent/tests/emailtest.cpp -index 5746975..9166268 100644 ---- a/src/pim/agent/tests/emailtest.cpp -+++ b/src/pim/agent/tests/emailtest.cpp -@@ -24,6 +24,7 @@ - - #include - #include -+#include - #include - - #include -@@ -158,6 +159,45 @@ void App::slotIndexed() - kDebug() << "Emails:" << m_numEmails; - kDebug() << "Total Time:" << m_totalTime.elapsed()/1000.0 << " seconds"; - kDebug() << "Index Time:" << m_indexTime/1000.0 << " seconds"; -+ -+ // Print the io usage -+ QFile file("/proc/self/io"); -+ file.open(QIODevice::ReadOnly | QIODevice::Text); -+ -+ QTextStream fs(&file); -+ QString str = fs.readAll(); -+ -+ qDebug() << "------- IO ---------"; -+ QTextStream stream(&str); -+ while (!stream.atEnd()) { -+ QString str = stream.readLine(); -+ -+ QString rchar("rchar: "); -+ if (str.startsWith(rchar)) { -+ ulong amt = str.mid(rchar.size()).toULong(); -+ qDebug() << "Read:" << amt / 1024 << "kb"; -+ } -+ -+ QString wchar("wchar: "); -+ if (str.startsWith(wchar)) { -+ ulong amt = str.mid(wchar.size()).toULong(); -+ qDebug() << "Write:" << amt / 1024 << "kb"; -+ } -+ -+ QString read("read_bytes: "); -+ if (str.startsWith(read)) { -+ ulong amt = str.mid(read.size()).toULong(); -+ qDebug() << "Actual Reads:" << amt / 1024 << "kb"; -+ } -+ -+ QString write("write_bytes: "); -+ if (str.startsWith(write)) { -+ ulong amt = str.mid(write.size()).toULong(); -+ qDebug() << "Actual Writes:" << amt / 1024 << "kb"; -+ } -+ } -+ qDebug() << "\nThe actual read/writes may be 0 because of an existing" -+ << "cache and /tmp being memory mapped"; - quit(); - } - --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0055-BalooShow-Print-a-message-when-no-index-info-was-fou.patch baloo-4.13.0/debian/patches/upstream_git/0055-BalooShow-Print-a-message-when-no-index-info-was-fou.patch --- baloo-4.12.97/debian/patches/upstream_git/0055-BalooShow-Print-a-message-when-no-index-info-was-fou.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0055-BalooShow-Print-a-message-when-no-index-info-was-fou.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -From 655576d99746e21471140235aa98b23120e4defc Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Wed, 9 Apr 2014 11:43:38 +0200 -Subject: [PATCH 55/56] BalooShow: Print a message when no index info was found - ---- - src/tools/balooshow/main.cpp | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) - -diff --git a/src/tools/balooshow/main.cpp b/src/tools/balooshow/main.cpp -index e91120b..0a519fa 100644 ---- a/src/tools/balooshow/main.cpp -+++ b/src/tools/balooshow/main.cpp -@@ -104,10 +104,16 @@ int main(int argc, char* argv[]) - - Baloo::File file = job->file(); - int fid = Baloo::deserialize("file", file.id()); -- text = colorString(QString::number(fid), 31); -- text += " "; -- text += colorString(file.url(), 32); -- stream << text << endl; -+ -+ if (fid && !file.url().isEmpty()) { -+ text = colorString(QString::number(fid), 31); -+ text += " "; -+ text += colorString(file.url(), 32); -+ stream << text << endl; -+ } -+ else { -+ stream << "No index information found" << endl; -+ } - - KFileMetaData::PropertyMap propMap = file.properties(); - KFileMetaData::PropertyMap::const_iterator it = propMap.constBegin(); --- -1.9.1 - diff -Nru baloo-4.12.97/debian/patches/upstream_git/0056-baloo_file-Autostart-and-enable-drKonqi.patch baloo-4.13.0/debian/patches/upstream_git/0056-baloo_file-Autostart-and-enable-drKonqi.patch --- baloo-4.12.97/debian/patches/upstream_git/0056-baloo_file-Autostart-and-enable-drKonqi.patch 2014-04-09 14:51:42.000000000 +0000 +++ baloo-4.13.0/debian/patches/upstream_git/0056-baloo_file-Autostart-and-enable-drKonqi.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -From 832e867f55dfe1de7163270b0e563f7aca120dc1 Mon Sep 17 00:00:00 2001 -From: Vishesh Handa -Date: Wed, 9 Apr 2014 12:25:11 +0200 -Subject: [PATCH 56/56] baloo_file: Autostart and enable drKonqi - -We always want baloo_file to be running, even if it crashes (which it -should not). Also, we want the crash reports. - -This patch makes baloo_file a KUniqueApplication instead of it being -just a QApplication + manual catalog loading. The KUniqueApplication is -required for auto-restarting on crash. ---- - src/file/main.cpp | 15 ++++++++++----- - 1 file changed, 10 insertions(+), 5 deletions(-) - -diff --git a/src/file/main.cpp b/src/file/main.cpp -index 59402bf..cd35713 100644 ---- a/src/file/main.cpp -+++ b/src/file/main.cpp -@@ -20,11 +20,12 @@ - * - */ - --#include -- - #include - #include - #include -+#include -+#include -+#include - - #include - #include -@@ -45,13 +46,14 @@ int main(int argc, char** argv) - lowerSchedulingPriority(); - lowerPriority(); - -- QApplication app(argc, argv); -- - KAboutData aboutData("baloo_file", "baloo_file", ki18n("Baloo File"), "0.1", - ki18n("An application to handle file metadata"), - KAboutData::License_GPL_V2); - -- KComponentData data(aboutData, KComponentData::RegisterAsMainComponent); -+ KCmdLineArgs::init(argc, argv, &aboutData); -+ -+ KUniqueApplication app(true); -+ app.disableSessionManagement(); - - KConfig config("baloofilerc"); - KConfigGroup group = config.group("Basic Settings"); -@@ -68,6 +70,9 @@ int main(int argc, char** argv) - return 1; - } - -+ // Crash Handling -+ KCrash::setFlags(KCrash::AutoRestart); -+ - const QString path = KGlobal::dirs()->localxdgdatadir() + "baloo/file/"; - - Database db; --- -1.9.1 - diff -Nru baloo-4.12.97/src/file/autotest/CMakeLists.txt baloo-4.13.0/src/file/autotest/CMakeLists.txt --- baloo-4.12.97/src/file/autotest/CMakeLists.txt 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/autotest/CMakeLists.txt 2014-04-09 10:33:16.000000000 +0000 @@ -1,7 +1,5 @@ project(filewatch_tests) -set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) - if(CMAKE_SYSTEM_NAME MATCHES "Linux") set(kinotifytest_SRC kinotifytest.cpp ../kinotify.cpp) kde4_add_unit_test(kinotifytest TESTNAME nepomuk-kinotifytest NOGUI ${kinotifytest_SRC}) @@ -95,3 +93,4 @@ balooxapian ) +add_subdirectory(fileindexingjob) diff -Nru baloo-4.12.97/src/file/autotest/fileindexingjob/CMakeLists.txt baloo-4.13.0/src/file/autotest/fileindexingjob/CMakeLists.txt --- baloo-4.12.97/src/file/autotest/fileindexingjob/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.13.0/src/file/autotest/fileindexingjob/CMakeLists.txt 2014-04-09 10:33:16.000000000 +0000 @@ -0,0 +1,19 @@ +add_executable(baloo_file_extractor_dummy extractor.cpp) +set_target_properties(baloo_file_extractor_dummy + PROPERTIES OUTPUT_NAME baloo_file_extractor +) + +target_link_libraries(baloo_file_extractor_dummy + ${KDE4_KDECORE_LIBS} +) + +add_definitions("-DBALOO_TEMP_PATH=\\\"${CMAKE_CURRENT_BINARY_DIR}\\\"") +kde4_add_unit_test(fileindexingjobtest NOGUI fileindexingjobtest.cpp + ../../fileindexingjob.cpp) + +target_link_libraries(fileindexingjobtest + ${QT_QTTEST_LIBRARY} + ${KDE4_KDECORE_LIBS} + ${KFILEMETADATA_LIBRARY} + ${XAPIAN_LIBRARIES} +) diff -Nru baloo-4.12.97/src/file/autotest/fileindexingjob/extractor.cpp baloo-4.13.0/src/file/autotest/fileindexingjob/extractor.cpp --- baloo-4.12.97/src/file/autotest/fileindexingjob/extractor.cpp 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.13.0/src/file/autotest/fileindexingjob/extractor.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -0,0 +1,83 @@ +/* + * This file is part of the KDE Baloo Project + * Copyright (C) 2014 Vishesh Handa + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +int main(int argc, char* argv[]) +{ + KAboutData aboutData("baloo_file_extractor_dummy", 0, KLocalizedString(), + "0.1", KLocalizedString()); + + KCmdLineArgs::init(argc, argv, &aboutData); + + KCmdLineOptions options; + options.add("+[url]", KLocalizedString()); + + KCmdLineArgs::addCmdLineOptions(options); + const KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); + + int argCount = args->count(); + if (argCount == 0) { + QTextStream err(stderr); + err << "Must input url/id of the file to be indexed"; + + return 1; + } + + KComponentData data(aboutData, KComponentData::RegisterAsMainComponent); + + QByteArray failArr = qgetenv("BALOO_EXTRACTOR_FAIL_FILE"); + QByteArray timeoutArr = qgetenv("BALOO_EXTRACTOR_TIMEOUT_FILE"); + if (failArr.isEmpty() && timeoutArr.isEmpty()) { + return 0; + } + + QStringList failFiles = QString::fromUtf8(failArr).split(",", QString::SkipEmptyParts); + QStringList timeoutFiles = QString::fromUtf8(timeoutArr).split(",", QString::SkipEmptyParts); + + for (int i = 0; i < args->count(); i++) { + QString fid = args->arg(i); + if (failFiles.contains(fid)) { + // kill oneself + raise(SIGKILL); + return -1; + } + + if (timeoutFiles.contains(fid)) { + // 100 msecs + usleep(100 * 1000); + } + } + + return 0; +} diff -Nru baloo-4.12.97/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp baloo-4.13.0/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp --- baloo-4.12.97/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.13.0/src/file/autotest/fileindexingjob/fileindexingjobtest.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -0,0 +1,114 @@ +/* + * + * Copyright (C) 2014 Vishesh Handa + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "fileindexingjobtest.h" +#include "../../fileindexingjob.h" + +#include +#include + +using namespace Baloo; + +void FileIndexingJobTest::init() +{ + // Set the correct path + QByteArray path = qgetenv("PATH"); + path = QByteArray(BALOO_TEMP_PATH) + ":" + path; + + setenv("PATH", path.constData(), 1); + unsetenv("BALOO_EXTRACTOR_FAIL_FILE"); +} + +void FileIndexingJobTest::testFileFail() +{ + QVector files; + for (int i = 0; i<40; i++) { + files << i; + } + + putenv("BALOO_EXTRACTOR_FAIL_FILE=5"); + FileIndexingJob* job = new FileIndexingJob(files); + + QSignalSpy spy(job, SIGNAL(indexingFailed(uint))); + QVERIFY(job->exec()); + + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).size(), 1); + QCOMPARE(spy.at(0).first().toUInt(), (uint)5); +} + +void FileIndexingJobTest::testMultiFileFail() +{ + QVector files; + for (int i = 0; i<40; i++) { + files << i; + } + + putenv("BALOO_EXTRACTOR_FAIL_FILE=5,18,19"); + FileIndexingJob* job = new FileIndexingJob(files); + + QSignalSpy spy(job, SIGNAL(indexingFailed(uint))); + QVERIFY(job->exec()); + + QCOMPARE(spy.count(), 3); + QCOMPARE(spy.at(0).size(), 1); + QCOMPARE(spy.at(0).first().toUInt(), (uint)5); + QCOMPARE(spy.at(1).size(), 1); + QCOMPARE(spy.at(1).first().toUInt(), (uint)18); + QCOMPARE(spy.at(2).size(), 1); + QCOMPARE(spy.at(2).first().toUInt(), (uint)19); +} + +void FileIndexingJobTest::testNormalExecution() +{ + QVector files; + files << 1 << 2 << 3 << 4 << 5 << 6; + + FileIndexingJob* job = new FileIndexingJob(files); + + QSignalSpy spy1(job, SIGNAL(indexingFailed(uint))); + QSignalSpy spy2(job, SIGNAL(finished(KJob*))); + QVERIFY(job->exec()); + + QCOMPARE(spy1.count(), 0); + QCOMPARE(spy2.count(), 1); +} + +void FileIndexingJobTest::testTimeout() +{ + QVector files; + for (int i = 0; i<40; i++) { + files << i; + } + + putenv("BALOO_EXTRACTOR_TIMEOUT_FILE=5"); + FileIndexingJob* job = new FileIndexingJob(files); + job->setTimeoutInterval(100); + + QSignalSpy spy(job, SIGNAL(indexingFailed(uint))); + QVERIFY(job->exec()); + + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).size(), 1); + QCOMPARE(spy.at(0).first().toUInt(), (uint)5); +} + + +QTEST_MAIN(FileIndexingJobTest); diff -Nru baloo-4.12.97/src/file/autotest/fileindexingjob/fileindexingjobtest.h baloo-4.13.0/src/file/autotest/fileindexingjob/fileindexingjobtest.h --- baloo-4.12.97/src/file/autotest/fileindexingjob/fileindexingjobtest.h 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.13.0/src/file/autotest/fileindexingjob/fileindexingjobtest.h 2014-04-09 10:33:16.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * + * Copyright (C) 2014 Vishesh Handa + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef BALOO_FILEINDEXINGJOBTEST_H +#define BALOO_FILEINDEXINGJOBTEST_H + +#include + +namespace Baloo { + +class FileIndexingJobTest : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void init(); + + void testNormalExecution(); + void testFileFail(); + void testMultiFileFail(); + void testTimeout(); +}; +} + +#endif // BALOO_FILEINDEXINGJOBTEST_H diff -Nru baloo-4.12.97/src/file/autotest/metadatamovertest.cpp baloo-4.13.0/src/file/autotest/metadatamovertest.cpp --- baloo-4.12.97/src/file/autotest/metadatamovertest.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/autotest/metadatamovertest.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -72,10 +72,6 @@ QSignalSpy spy(&mover, SIGNAL(fileRemoved(int))); mover.removeFileMetadata(url); - QEventLoop loop; - connect(&mover, SIGNAL(fileRemoved(int)), &loop, SLOT(quit())); - loop.exec(); - QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).size(), 1); QCOMPARE(spy.at(0).first().toUInt(), fid); diff -Nru baloo-4.12.97/src/file/baloo_file.desktop baloo-4.13.0/src/file/baloo_file.desktop --- baloo-4.12.97/src/file/baloo_file.desktop 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/baloo_file.desktop 2014-04-09 10:33:16.000000000 +0000 @@ -3,8 +3,11 @@ Exec=baloo_file X-KDE-StartupNotify=false X-KDE-autostart-condition=baloofilerc:Basic Settings:Enabled:true -OnlyShowIn=KDE; X-KDE-autostart-phase=0 +X-GNOME-Autostart-enabled=true +OnlyShowIn=KDE;GNOME;Unity;XFCE +NoDisplay=true + Name=Baloo File Daemon Name[bs]=Baloo datotečni demon Name[ca]=Dimoni de fitxers Baloo @@ -16,6 +19,7 @@ Name[fi]=Baloo-tiedostopalvelu Name[fr]=Démon de fichier Baloo Name[hu]=Baloo fájl démon +Name[ia]=Baloo File Daemon (Demon de file de Baloo) Name[it]=Demone dei file Baloo Name[ko]=Baloo 파일 데몬 Name[lt]=Baloo failų tarnyba @@ -26,6 +30,7 @@ Name[pl]=Usługa plików Baloo Name[pt]=Serviço de Ficheiros do Baloo Name[pt_BR]=Serviço de arquivos do Baloo +Name[ru]=Служба мониторинга файлов для Baloo Name[sk]=Súborový démon Baloo Name[sl]=Ozadnji program za datoteke Baloo Name[sr]=Демон Балуа diff -Nru baloo-4.12.97/src/file/basicindexingjob.cpp baloo-4.13.0/src/file/basicindexingjob.cpp --- baloo-4.12.97/src/file/basicindexingjob.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/basicindexingjob.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -81,7 +81,6 @@ QString tstr = KFileMetaData::TypeInfo(type).name().toLower(); doc.addBoolTerm(tstr, "T"); } - doc.addBoolTerm("file", "T"); if (fileInfo.isDir()) { doc.addBoolTerm("folder", "T"); diff -Nru baloo-4.12.97/src/file/basicindexingqueue.cpp baloo-4.13.0/src/file/basicindexingqueue.cpp --- baloo-4.12.97/src/file/basicindexingqueue.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/basicindexingqueue.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -96,7 +96,11 @@ { bool startedIndexing = false; - QString mimetype = KMimeType::findByUrl(QUrl::fromLocalFile(file.url()))->name(); + // This mimetype may not be completely accurate, but that's okay. This is + // just the initial phase of indexing. The second phase can try to find + // a more accurate mimetype. + QString mimetype = KMimeType::findByUrl(QUrl::fromLocalFile(file.url()), 0, + true /*is Local*/, true /*Fast*/)->name(); bool forced = flags & ForceUpdate; bool recursive = flags & UpdateRecursive; diff -Nru baloo-4.12.97/src/file/cleaner/cleaner.cpp baloo-4.13.0/src/file/cleaner/cleaner.cpp --- baloo-4.12.97/src/file/cleaner/cleaner.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/cleaner/cleaner.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -29,6 +29,7 @@ #include #include #include +#include using namespace Baloo; @@ -49,28 +50,40 @@ FileIndexerConfig config; + int numDocuments = 0; while (query.next()) { int id = query.value(0).toInt(); QString url = query.value(1).toString(); + bool removeIt = false; if (!QFile::exists(url)) { + removeIt = true; + } + + if (!config.shouldBeIndexed(url)) { + removeIt = true; + } + + // vHanda FIXME: Perhaps we want to get the proper mimetype from xapian? + QString mimetype = KMimeType::findByUrl(QUrl::fromLocalFile(url), 0, + true /*local*/, true /*fast*/)->name(); + if (!config.shouldMimeTypeBeIndexed(mimetype)) { + removeIt = true; + } + + if (removeIt) { + qDebug() << id << url; QSqlQuery q(sqlDb); q.prepare("delete from files where id = ?"); q.addBindValue(id); q.exec(); m_commitQueue->remove(id); - continue; - } - if (!config.shouldBeIndexed(url)) { - m_commitQueue->remove(id); - continue; + numDocuments++; } - QString mimetype = KMimeType::findByUrl(QUrl::fromLocalFile(url))->name(); - if (!config.shouldMimeTypeBeIndexed(mimetype)) { - m_commitQueue->remove(id); - continue; + if (numDocuments >= 1000) { + m_commitQueue->commit(); } } diff -Nru baloo-4.12.97/src/file/CMakeLists.txt baloo-4.13.0/src/file/CMakeLists.txt --- baloo-4.12.97/src/file/CMakeLists.txt 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/CMakeLists.txt 2014-04-09 10:33:16.000000000 +0000 @@ -6,7 +6,6 @@ set(file_SRCS # Filewatch filewatch.cpp - updaterequest.cpp activefilequeue.cpp metadatamover.cpp database.cpp diff -Nru baloo-4.12.97/src/file/commitqueue.cpp baloo-4.13.0/src/file/commitqueue.cpp --- baloo-4.12.97/src/file/commitqueue.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/commitqueue.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -40,9 +40,6 @@ m_largeTimer.setSingleShot(true); m_largeTimer.setInterval(10000); connect(&m_largeTimer, SIGNAL(timeout()), this, SLOT(commit())); - - connect(m_db->xapianDatabase(), SIGNAL(committed()), - this, SIGNAL(committed())); } Baloo::CommitQueue::~CommitQueue() @@ -86,4 +83,9 @@ kDebug() << "SQL Committed"; m_db->xapianDatabase()->commit(); + + m_smallTimer.stop(); + m_largeTimer.stop(); + + Q_EMIT committed(); } diff -Nru baloo-4.12.97/src/file/database.cpp baloo-4.13.0/src/file/database.cpp --- baloo-4.12.97/src/file/database.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/database.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -49,13 +49,15 @@ QSqlDatabase::removeDatabase(name); } -bool Database::init() +bool Database::init(bool sqlOnly) { if (m_initialized) return true; - // Create the Xapian DB - m_xapianDb = new Baloo::XapianDatabase(m_path); + if (!sqlOnly) { + // Create the Xapian DB + m_xapianDb = new Baloo::XapianDatabase(m_path); + } m_sqlDb = new QSqlDatabase(QSqlDatabase::addDatabase("QSQLITE")); m_sqlDb->setDatabaseName(m_path + "/fileMap.sqlite3"); @@ -72,7 +74,7 @@ QSqlQuery query(*m_sqlDb); bool ret = query.exec("CREATE TABLE files(" - "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "id INTEGER PRIMARY KEY, " "url TEXT NOT NULL UNIQUE)"); if (!ret) { kDebug() << "Could not create tags table" << query.lastError().text(); @@ -85,6 +87,16 @@ return false; } + // + // WAL Journaling mode has much lower io writes than the traditional journal + // based indexing. + // + ret = query.exec("PRAGMA journal_mode = WAL"); + if (!ret) { + kDebug() << "Could not set WAL journaling mode" << query.lastError().text(); + return false; + } + m_initialized = true; return true; } diff -Nru baloo-4.12.97/src/file/database.h baloo-4.13.0/src/file/database.h --- baloo-4.12.97/src/file/database.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/database.h 2014-04-09 10:33:16.000000000 +0000 @@ -37,7 +37,7 @@ QString path(); void setPath(const QString& path); - bool init(); + bool init(bool sqlOnly = false); bool isInitialized(); QSqlDatabase& sqlDatabase(); diff -Nru baloo-4.12.97/src/file/extractor/app.cpp baloo-4.13.0/src/file/extractor/app.cpp --- baloo-4.12.97/src/file/extractor/app.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/extractor/app.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -23,6 +23,7 @@ #include "app.h" #include "../basicindexingjob.h" #include "../database.h" +#include "xapiandatabase.h" #include #include @@ -46,49 +47,51 @@ : QObject(parent) , m_termCount(0) { - m_path = KGlobal::dirs()->localxdgdatadir() + "baloo/file"; + const KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); + + if (!args->getOption("db").isEmpty()) { + m_path = args->getOption("db"); + } else { + m_path = KGlobal::dirs()->localxdgdatadir() + "baloo/file"; + } m_db.setPath(m_path); - if (!m_db.init()) { + if (!m_db.init(true /*sql db only*/)) { QTimer::singleShot(0, QCoreApplication::instance(), SLOT(quit())); return; } - connect(m_db.xapianDatabase(), SIGNAL(committed()), - this, SLOT(slotCommitted())); - - const KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); m_bData = args->isSet("bdata"); + m_debugEnabled = args->isSet("debug"); m_results.reserve(args->count()); for (int i=0; icount(); i++) { FileMapping mapping = FileMapping(args->arg(i).toUInt()); QString url; + + // arg is an id if (mapping.fetch(m_db.sqlDatabase())) { - // arg is an id url = mapping.url(); - // If this url no longer exists, remove it from the mapping db. if (!QFile::exists(url)) { - QSqlQuery query(m_db.sqlDatabase()); - query.prepare("delete from files where url = ?"); - query.addBindValue(url); - if (!query.exec()) { - kError() << query.lastError().text(); - } + mapping.remove(m_db.sqlDatabase()); + continue; } } else { // arg is a url url = args->url(i).toLocalFile(); } + if (QFile::exists(url)) { m_urls << url; } else { // id or url was looked up, but file deleted kDebug() << url << "does not exist"; + // Try to delete it as an id: // it may have been deleted from the FileMapping db as well. // The worst that can happen is deleting nothing. - deleteDocument(mapping.id()); + mapping.remove(m_db.sqlDatabase()); + m_docsToDelete << mapping.id(); } } @@ -123,19 +126,14 @@ } } - Xapian::Document doc; - if (file.fetched()) { - try { - doc = m_db.xapianDatabase()->db()->get_document(file.id()); - } - catch (const Xapian::DocNotFoundError&) { - BasicIndexingJob basicIndexer(&m_db.sqlDatabase(), file, mimetype); - basicIndexer.index(); + // We always run the basic indexing again. This is mostly so that the proper + // mimetype is set and we get proper type information. + // The mimetype fetched in the BasicIQ is fast but not accurate + BasicIndexingJob basicIndexer(&m_db.sqlDatabase(), file, mimetype); + basicIndexer.index(); - file.setId(basicIndexer.id()); - doc = basicIndexer.document(); - } - } + file.setId(basicIndexer.id()); + Xapian::Document doc = basicIndexer.document(); Result result(url, mimetype); result.setId(file.id()); @@ -195,19 +193,22 @@ m_updatedFiles.clear(); + XapianDatabase xapDb(m_path); for (int i = 0; ireplaceDocument(res.id(), res.document()); + xapDb.replaceDocument(res.id(), res.document()); m_updatedFiles << res.inputUrl(); } - m_db.xapianDatabase()->commit(); -} + Q_FOREACH (int docid, m_docsToDelete) { + xapDb.deleteDocument(docid); + } + + xapDb.commit(); + m_db.sqlDatabase().commit(); -void App::slotCommitted() -{ m_results.clear(); m_termCount = 0; m_updatedFiles.clear(); @@ -223,12 +224,64 @@ QDBusConnection::sessionBus().send(message); + if (m_debugEnabled) { + printDebug(); + } + Q_EMIT saved(); } - -void App::deleteDocument(unsigned docid) +void App::printDebug() { - m_db.xapianDatabase()->deleteDocument(docid); -} + Q_FOREACH (const Result& res, m_results) { + qDebug() << res.inputUrl(); + QMapIterator it(res.map()); + while (it.hasNext()) { + it.next(); + int propNum = it.key().toInt(); + + using namespace KFileMetaData::Property; + Property prop = static_cast(propNum); + KFileMetaData::PropertyInfo pi(prop); + qDebug() << pi.name() << it.value(); + } + } + + // Print the io usage + QFile file("/proc/self/io"); + file.open(QIODevice::ReadOnly | QIODevice::Text); + + QTextStream fs(&file); + QString str = fs.readAll(); + + qDebug() << "------- IO ---------"; + QTextStream stream(&str); + while (!stream.atEnd()) { + QString str = stream.readLine(); + + QString rchar("rchar: "); + if (str.startsWith(rchar)) { + ulong amt = str.mid(rchar.size()).toULong(); + qDebug() << "Read:" << amt / 1024 << "kb"; + } + QString wchar("wchar: "); + if (str.startsWith(wchar)) { + ulong amt = str.mid(wchar.size()).toULong(); + qDebug() << "Write:" << amt / 1024 << "kb"; + } + + QString read("read_bytes: "); + if (str.startsWith(read)) { + ulong amt = str.mid(read.size()).toULong(); + qDebug() << "Actual Reads:" << amt / 1024 << "kb"; + } + + QString write("write_bytes: "); + if (str.startsWith(write)) { + ulong amt = str.mid(write.size()).toULong(); + qDebug() << "Actual Writes:" << amt / 1024 << "kb"; + } + } + +} diff -Nru baloo-4.12.97/src/file/extractor/app.h baloo-4.13.0/src/file/extractor/app.h --- baloo-4.12.97/src/file/extractor/app.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/extractor/app.h 2014-04-09 10:33:16.000000000 +0000 @@ -45,17 +45,17 @@ private Q_SLOTS: void processNextUrl(); void saveChanges(); - void slotCommitted(); Q_SIGNALS: void saved(); private: - void deleteDocument(unsigned docid); + void printDebug(); QVector m_results; QStringList m_urls; bool m_bData; + bool m_debugEnabled; QString m_path; @@ -65,6 +65,7 @@ int m_termCount; QList m_updatedFiles; + QVector m_docsToDelete; }; } diff -Nru baloo-4.12.97/src/file/extractor/main.cpp baloo-4.13.0/src/file/extractor/main.cpp --- baloo-4.12.97/src/file/extractor/main.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/extractor/main.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -50,6 +50,8 @@ options.add("+[url]", ki18n("The URL/id of the files to be indexed")); options.add("debug", ki18n("Print the data being indexed")); options.add("bdata", ki18n("Print the QVariantMap in Base64 encoding")); + // FIXME: Set a proper string after the freeze. This option is just for debugging + options.add("db ", KLocalizedString()); KCmdLineArgs::addCmdLineOptions(options); const KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); diff -Nru baloo-4.12.97/src/file/fileexcludefilters.cpp baloo-4.13.0/src/file/fileexcludefilters.cpp --- baloo-4.12.97/src/file/fileexcludefilters.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/fileexcludefilters.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -166,8 +166,7 @@ QStringList Baloo::defaultExcludeMimetypes() { - // By default we want to index everything apart from source code - return sourceCodeMimeTypes(); + return QStringList(); } int Baloo::defaultExcludeMimetypesVersion() diff -Nru baloo-4.12.97/src/file/fileindexerconfig.cpp baloo-4.13.0/src/file/fileindexerconfig.cpp --- baloo-4.12.97/src/file/fileindexerconfig.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/fileindexerconfig.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -22,8 +22,6 @@ #include #include -#include -#include #include #include @@ -53,7 +51,7 @@ FileIndexerConfig::FileIndexerConfig(QObject* parent) : QObject(parent) - , m_config("baloofilerc") + , m_config("baloofilerc", KConfig::SimpleConfig) , m_indexHidden(false) { KDirWatch* dirWatch = KDirWatch::self(); @@ -189,13 +187,11 @@ bool FileIndexerConfig::shouldFileBeIndexed(const QString& fileName) const { // check the filters - QWriteLocker lock(&m_folderCacheMutex); return !m_excludeFilterRegExpCache.exactMatch(fileName); } bool FileIndexerConfig::shouldMimeTypeBeIndexed(const QString& mimeType) const { - QReadLocker lock(&m_mimetypeMutex); return !m_excludeMimetypes.contains(mimeType); } @@ -208,8 +204,6 @@ bool FileIndexerConfig::folderInFolderList(const QString& path, QString& folder) const { - QReadLocker lock(&m_folderCacheMutex); - const QString p = KUrl(path).path(KUrl::RemoveTrailingSlash); // we traverse the list backwards to catch all exclude folders @@ -308,7 +302,6 @@ bool FileIndexerConfig::buildFolderCache() { - QWriteLocker lock(&m_folderCacheMutex); // // General folders @@ -393,7 +386,6 @@ bool FileIndexerConfig::buildExcludeFilterRegExpCache() { - QWriteLocker lock(&m_folderCacheMutex); QStringList newFilters = excludeFilters(); m_excludeFilterRegExpCache.rebuildCacheFromFilterList(newFilters); @@ -409,7 +401,6 @@ bool FileIndexerConfig::buildMimeTypeCache() { - QWriteLocker lock(&m_mimetypeMutex); QStringList newMimeExcludes = m_config.group("General").readPathEntry("exclude mimetypes", defaultExcludeMimetypes()); QSet newMimeExcludeSet = newMimeExcludes.toSet(); @@ -444,6 +435,7 @@ void FileIndexerConfig::setInitialRun(bool isInitialRun) { m_config.group("General").writeEntry("first run", isInitialRun); + m_config.sync(); } bool FileIndexerConfig::initialUpdateDisabled() const diff -Nru baloo-4.12.97/src/file/fileindexerconfig.h baloo-4.13.0/src/file/fileindexerconfig.h --- baloo-4.12.97/src/file/fileindexerconfig.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/fileindexerconfig.h 2014-04-09 10:33:16.000000000 +0000 @@ -22,11 +22,8 @@ #include #include #include -#include -#include #include -#include #include "regexpcache.h" @@ -189,9 +186,6 @@ bool m_indexHidden; - mutable QReadWriteLock m_folderCacheMutex; - mutable QReadWriteLock m_mimetypeMutex; - static FileIndexerConfig* s_self; // diff -Nru baloo-4.12.97/src/file/fileindexer.cpp baloo-4.13.0/src/file/fileindexer.cpp --- baloo-4.12.97/src/file/fileindexer.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/fileindexer.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -57,6 +57,8 @@ QDBusConnection::ExportScriptableSignals | QDBusConnection::ExportScriptableSlots | QDBusConnection::ExportAdaptors); + + m_initalRun = m_config->isInitialRun(); } FileIndexer::~FileIndexer() @@ -77,7 +79,10 @@ void FileIndexer::slotBasicIndexingDone() { - m_config->setInitialRun(false); + if (m_initalRun) { + m_config->setInitialRun(false); + m_initalRun = false; + } } QString FileIndexer::statusMessage() const diff -Nru baloo-4.12.97/src/file/fileindexer.h baloo-4.13.0/src/file/fileindexer.h --- baloo-4.12.97/src/file/fileindexer.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/fileindexer.h 2014-04-09 10:33:16.000000000 +0000 @@ -97,6 +97,7 @@ IndexScheduler* m_indexScheduler; FileIndexerConfig* m_config; bool m_startupUpdateDone; + bool m_initalRun; }; } diff -Nru baloo-4.12.97/src/file/fileindexingjob.cpp baloo-4.13.0/src/file/fileindexingjob.cpp --- baloo-4.12.97/src/file/fileindexingjob.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/fileindexingjob.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -37,47 +37,41 @@ FileIndexingJob::FileIndexingJob(const QVector& files, QObject* parent) : KJob(parent) - , m_files(files) , m_process(0) { + Q_ASSERT(!files.isEmpty()); + m_files.push(files); + // setup the timer used to kill the indexer process if it seems to get stuck m_processTimer = new QTimer(this); m_processTimer->setSingleShot(true); connect(m_processTimer, SIGNAL(timeout()), this, SLOT(slotProcessTimerTimeout())); + + m_processTimeout = 5 * 60 * 1000; } void FileIndexingJob::start() { - if (m_files.isEmpty()) { - emitResult(); - return; - } - - m_args = m_files; - m_files.clear(); - + m_args = m_files.pop(); start(m_args); } void FileIndexingJob::start(const QVector& files) { // setup the external process which does the actual indexing - const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file_extractor")); + static const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file_extractor")); - // Just in case - if (m_process) { - m_process->disconnect(); - m_process->kill(); - - delete m_process; - m_process = 0; - } + Q_ASSERT(m_process == 0); m_process = new QProcess(this); QStringList args; Q_FOREACH (const uint& file, files) args << QString::number(file); + + if (!m_customDbPath.isEmpty()) { + args << "--db" << m_customDbPath; + } kDebug() << args; connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), @@ -86,60 +80,72 @@ m_process->setProcessChannelMode(QProcess::SeparateChannels); m_process->start(exe, args); - // start the timer which will kill the process if it does not terminate after 5 minutes - m_processTimer->start(5 * 60 * 1000); + m_processTimer->start(m_processTimeout); } void FileIndexingJob::slotIndexedFile(int, QProcess::ExitStatus exitStatus) { // stop the timer since there is no need to kill the process anymore m_processTimer->stop(); + m_process->disconnect(this); m_process->deleteLater(); m_process = 0; if (exitStatus == QProcess::NormalExit) { if (m_files.isEmpty()) { emitResult(); - return; - } - } - else { - if (m_args.size() == 1) { - uint doc = m_args.first(); - kError() << "Indexer crashed while indexing" << doc; - kError() << "Blacklisting this file"; - Q_EMIT indexingFailed(doc); - - if (m_files.isEmpty()) { - emitResult(); - return; - } - } - else { - m_files = m_args; + } else { + m_args = m_files.pop(); + start(m_args); } + return; } - // Split the number of files into half - if (m_files.size() == 1) { - m_args = m_files; - m_files.clear(); + // Failed to index. We must figure out which was the offending file + qDebug() << "Indexing failed. Trying to determine offending file"; - start(m_args); - } - else { - int mid = m_files.size()/2; - m_args = m_files.mid(mid); - m_files.resize(mid); + // Here it is! + if (m_args.size() == 1) { + uint doc = m_args.first(); + kError() << "Indexer crashed while indexing" << doc; + kError() << "Blacklisting this file"; + Q_EMIT indexingFailed(doc); - start(m_args); + if (m_files.isEmpty()) { + emitResult(); + } else { + m_args = m_files.pop(); + start(m_args); + } + return; } + + // We split the args into half and push the rest back into m_files + // to call later + int s = m_args.size() / 2; + m_files.push(m_args.mid(s)); + m_args.resize(s); + + start(m_args); } void FileIndexingJob::slotProcessTimerTimeout() { // Emulate a crash so that we narrow down the file which is taking too long + qDebug() << "Process took too long killing"; slotIndexedFile(1, QProcess::CrashExit); } +void FileIndexingJob::setCustomDbPath(const QString& path) +{ + m_customDbPath = path; +} + +void FileIndexingJob::setTimeoutInterval(int msec) +{ + m_processTimeout = msec; +} + + + #include "fileindexingjob.moc" diff -Nru baloo-4.12.97/src/file/fileindexingjob.h baloo-4.13.0/src/file/fileindexingjob.h --- baloo-4.12.97/src/file/fileindexingjob.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/fileindexingjob.h 2014-04-09 10:33:16.000000000 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include #include "filemapping.h" @@ -41,6 +42,21 @@ public: FileIndexingJob(const QVector& files, QObject* parent = 0); + /** + * Set a custom path which should be sent to the baloo_file_extractor + * to use for the database. This is useful when debugging. + */ + void setCustomDbPath(const QString& path); + + /** + * Set the maximum number of msecs that each file should take in order + * to get indexed. If a file takes longer, then it will be marked + * as failing and the indexingFailed signal will be called + * + * By deafult this is 5 minutes + */ + void setTimeoutInterval(int msec); + virtual void start(); Q_SIGNALS: @@ -56,11 +72,17 @@ private: void start(const QVector& files); - QVector m_files; + /// holds the files which still need to be indexed + QStack< QVector > m_files; + + /// holds the files which have been sent to the process QVector m_args; QProcess* m_process; QTimer* m_processTimer; + int m_processTimeout; + + QString m_customDbPath; }; } diff -Nru baloo-4.12.97/src/file/indexscheduler.cpp baloo-4.13.0/src/file/indexscheduler.cpp --- baloo-4.12.97/src/file/indexscheduler.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/indexscheduler.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -40,16 +40,7 @@ , m_db(db) { Q_ASSERT(m_config); - connect(m_config, SIGNAL(includeFolderListChanged(QStringList,QStringList)), - this, SLOT(slotIncludeFolderListChanged(QStringList,QStringList))); - connect(m_config, SIGNAL(excludeFolderListChanged(QStringList,QStringList)), - this, SLOT(slotExcludeFolderListChanged(QStringList,QStringList))); - - // FIXME: What if both the signals are emitted? - connect(m_config, SIGNAL(fileExcludeFiltersChanged()), - this, SLOT(slotConfigFiltersChanged())); - connect(m_config, SIGNAL(mimeTypeFiltersChanged()), - this, SLOT(slotConfigFiltersChanged())); + connect(m_config, SIGNAL(configChanged()), this, SLOT(slotConfigChanged())); // Stop indexing when a device is unmounted // RemovableMediaCache* cache = new RemovableMediaCache(this); @@ -201,34 +192,7 @@ } -void IndexScheduler::slotIncludeFolderListChanged(const QStringList& added, const QStringList& removed) -{ - //Index the folders added to the include list, clear the folders removed from it - addClearFolders(added, removed); -} - -void IndexScheduler::slotExcludeFolderListChanged(const QStringList& added, const QStringList& removed) -{ - //Clear the folders added to the exclude list, index the folders removed from it - addClearFolders(removed, added); -} - -//Index the folders in add, clear the folders in clear -void IndexScheduler::addClearFolders(const QStringList& add, const QStringList& clear) -{ - kDebug() << "To index: " << add << "To clear: " << clear; - Q_FOREACH (const QString& path, clear) { - m_basicIQ->clear(path); - m_fileIQ->clear(); - } - - Q_FOREACH (const QString &path, add) { - m_basicIQ->enqueue(FileMapping(path), UpdateRecursive); - } - slotScheduleIndexing(); -} - -void IndexScheduler::slotConfigFiltersChanged() +void IndexScheduler::slotConfigChanged() { // We need to this - there is no way to avoid it m_basicIQ->clear(); @@ -302,8 +266,10 @@ return false; case State_UserIdle: m_fileIQ->setDelay(0); + return true; case State_Normal: m_fileIQ->setDelay(500); + return true; default: return true; } diff -Nru baloo-4.12.97/src/file/indexscheduler.h baloo-4.13.0/src/file/indexscheduler.h --- baloo-4.12.97/src/file/indexscheduler.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/indexscheduler.h 2014-04-09 10:33:16.000000000 +0000 @@ -117,9 +117,7 @@ void statusStringChanged(); private Q_SLOTS: // Config - void slotConfigFiltersChanged(); - void slotIncludeFolderListChanged(const QStringList& added, const QStringList& removed); - void slotExcludeFolderListChanged(const QStringList& added, const QStringList& removed); + void slotConfigChanged(); void slotStartedIndexing(); void slotFinishedIndexing(); diff -Nru baloo-4.12.97/src/file/inotify/org.kde.baloo.filewatch.actions baloo-4.13.0/src/file/inotify/org.kde.baloo.filewatch.actions --- baloo-4.12.97/src/file/inotify/org.kde.baloo.filewatch.actions 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/inotify/org.kde.baloo.filewatch.actions 2014-04-09 10:33:16.000000000 +0000 @@ -11,6 +11,7 @@ Name[fi]=Kansioiden valvontaraja Name[fr]=Limite de surveillance des dossiers Name[hu]=Mappafigyelési korlát +Name[ia]=Limite de guardia de dossier Name[it]=Limite di osservazione delle cartelle Name[ko]=폴더 감시 제한 Name[lt]=Aplankų stebėjimo riba @@ -20,6 +21,7 @@ Name[pl]=Ograniczenie obserwowania katalogu Name[pt]=Limite de Monitorização de Pastas Name[pt_BR]=Limite de monitoramento de pastas +Name[ru]=Ограничение на число наблюдаемых папок Name[sk]=Limit sledovania priečinka Name[sl]=Omejitev opazovanih map Name[sr]=Ограничење надгледања фасцикли @@ -44,6 +46,7 @@ Description[fi]=Nosta inotifyn kansioiden valvontarajaa välttääksesi sitä, että joitain tiedostomuutoksia ei huomata Description[fr]=Pour éviter des changements de fichiers manquant, augmentez la limite de surveillance des dossiers Description[hu]=A fájlváltoztatások hiányzásának elkerülése érdekében növelje a értesítő mappafigyelési korlátot +Description[ia]=Pro evitar perder modificationes de file, altia le limite de guardia de dossier inotify Description[it]=Per non perdere le modifiche ai file, alza il limite di osservazione delle cartelle di inotify Description[ko]=파일 변경 사항을 놓치지 않으려면 inotify 폴더 감시 제한을 높이십시오 Description[nb]=Øk grensen for mappeovervåker for å unngå å gå glipp av filendringer @@ -52,6 +55,7 @@ Description[pl]=Aby uniknąć zmiany brakujących plików, podwyższ ograniczenie obserwacji katalogu inotify Description[pt]=Para evitar as alterações de ficheiros perdidas, aumente o limite de monitorização de pastas do 'inotify' Description[pt_BR]=Para evitar a perda de alterações dos arquivos, aumente o limite de monitoramento das pastas do inotify +Description[ru]=Чтобы изменения файлов не оставались незамеченными, увеличьте ограничение на число наблюдаемых с помощью inotify папок Description[sk]=Na zabránenie chýbajúcich zmien v súboroch, zvýšte obmedzenie sledovania priečinka inotify Description[sl]=Da se izognete spregledu sprememb datotek, povečajte omejitev opazovanih map inotify Description[sr]=Веће ограничење надгледања фасцикли (inotify) избегава пропуштене измене фајлова diff -Nru baloo-4.12.97/src/file/kcm/configwidget.ui baloo-4.13.0/src/file/kcm/configwidget.ui --- baloo-4.12.97/src/file/kcm/configwidget.ui 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/kcm/configwidget.ui 2014-04-09 10:33:16.000000000 +0000 @@ -1,6 +1,6 @@ - Sebastian Trueg + Vishesh Handa ConfigWidget @@ -55,13 +55,6 @@ - - - Enable Developer Mode - - - - Qt::Vertical diff -Nru baloo-4.12.97/src/file/kcm/kcm_baloofile.desktop baloo-4.13.0/src/file/kcm/kcm_baloofile.desktop --- baloo-4.12.97/src/file/kcm/kcm_baloofile.desktop 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/kcm/kcm_baloofile.desktop 2014-04-09 10:33:16.000000000 +0000 @@ -21,6 +21,7 @@ Name[fi]=Työpöytähaku Name[fr]=Recherche sur le bureau Name[hu]=Asztali keresés +Name[ia]=Cerca de Scriptorio Name[it]=Ricerca dal desktop Name[ko]=데스크톱 검색 Name[lt]=Darbastalio paieška @@ -31,6 +32,7 @@ Name[pl]=Wyszukiwanie na pulpicie Name[pt]=Pesquisa no Ambiente de Trabalho Name[pt_BR]=Pesquisa no desktop +Name[ru]=Поиск по меткам и содержимому Name[sk]=Hľadanie na ploche Name[sl]=Namizno iskanje Name[sr]=Претрага површи @@ -54,6 +56,7 @@ Comment[fi]=Työpöytähaun asetukset Comment[fr]=Configurer la recherche sur le bureau Comment[hu]=Asztali keresés beállítása +Comment[ia]=Configura cerca de scriptorio Comment[it]=Configura ricerca dal desktop Comment[ko]=데스크톱 검색 설정 Comment[lt]=Konfigūruoti darbastalio paiešką @@ -63,6 +66,7 @@ Comment[pl]=Konfiguruj znajdywanie na pulpicie Comment[pt]=Configurar a Pesquisa no Ambiente de Trabalho Comment[pt_BR]=Configurar a pesquisa no desktop +Comment[ru]=Настройка службы поиска Comment[sk]=Nastaviť hľadanie na ploche Comment[sl]=Nastavi Namizno iskanje Comment[sr]=Подешавање претраге површи @@ -86,6 +90,7 @@ X-KDE-Keywords[fi]=Search, File, haku, tiedosto, Baloo X-KDE-Keywords[fr]=Recherche, fichier, Baloo X-KDE-Keywords[hu]=Keresés, Fájl, Baloo +X-KDE-Keywords[ia]=Cerca, File, Baloo X-KDE-Keywords[it]=Ricerca, File, Baloo X-KDE-Keywords[ko]=Search, File, Baloo,검색,파일 X-KDE-Keywords[lt]=Paieška, Failas, Baloo @@ -96,6 +101,7 @@ X-KDE-Keywords[pl]=Znajdź, Plik, Baloo X-KDE-Keywords[pt]=Procurar, Ficheiro, Baloo X-KDE-Keywords[pt_BR]=Pesquisar, Procurar, Arquivo, Baloo +X-KDE-Keywords[ru]=Search, File, Baloo, поиск, файл, Балу X-KDE-Keywords[sk]=Hľadať, súbor, Baloo X-KDE-Keywords[sl]=Iskanje, datoteka, Baloo X-KDE-Keywords[sr]=search;file;baloo;претрага;фајл;Балу diff -Nru baloo-4.12.97/src/file/kcm/kcm.cpp baloo-4.13.0/src/file/kcm/kcm.cpp --- baloo-4.12.97/src/file/kcm/kcm.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/kcm/kcm.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -34,6 +34,7 @@ #include #include #include +#include K_PLUGIN_FACTORY(BalooConfigModuleFactory, registerPlugin();) K_EXPORT_PLUGIN(BalooConfigModuleFactory("kcm_baloofile", "kcm_baloofile")) @@ -69,8 +70,6 @@ connect(m_folderSelectionWidget, SIGNAL(changed()), this, SLOT(changed())); - connect(m_checkboxSourceCode, SIGNAL(toggled(bool)), - this, SLOT(changed())); } @@ -89,13 +88,6 @@ QStringList excludeFolders = group.readPathEntry("exclude folders", QStringList()); m_folderSelectionWidget->setFolders(includeFolders, excludeFolders); - // MimeTypes - QStringList mimetypes = config.group("General").readEntry("exclude mimetypes", defaultExcludeMimetypes()); - - m_oldExcludeMimetypes = mimetypes; - m_oldExcludeFolders = excludeFolders; - m_oldIncludeFolders = includeFolders; - // All values loaded -> no changes Q_EMIT changed(false); } @@ -117,12 +109,6 @@ config.group("General").writePathEntry("folders", includeFolders); config.group("General").writePathEntry("exclude folders", excludeFolders); - QStringList excludeMimetypes; - if (m_checkboxSourceCode->isChecked()) - excludeMimetypes = sourceCodeMimeTypes(); - - config.group("General").writeEntry("exclude mimetypes", excludeMimetypes); - // Start Baloo if (indexingEnabled) { const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file")); @@ -134,22 +120,12 @@ QLatin1String("org.kde.baloo.file"), QLatin1String("quit")); - QDBusConnection::sessionBus().send(message); + QDBusConnection::sessionBus().asyncCall(message); } // Start cleaner - bool cleaningRequired = false; - if (includeFolders != m_oldIncludeFolders) - cleaningRequired = true; - else if (excludeFolders != m_oldExcludeFolders) - cleaningRequired = true; - else if (excludeMimetypes != m_oldExcludeMimetypes) - cleaningRequired = true; - - if (cleaningRequired) { - const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file_cleaner")); - QProcess::startDetached(exe); - } + const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file_cleaner")); + QProcess::startDetached(exe); // all values saved -> no changes Q_EMIT changed(false); diff -Nru baloo-4.12.97/src/file/kcm/kcm.h baloo-4.13.0/src/file/kcm/kcm.h --- baloo-4.12.97/src/file/kcm/kcm.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/kcm/kcm.h 2014-04-09 10:33:16.000000000 +0000 @@ -40,9 +40,6 @@ void defaults(); private: - QStringList m_oldIncludeFolders; - QStringList m_oldExcludeFolders; - QStringList m_oldExcludeMimetypes; }; } diff -Nru baloo-4.12.97/src/file/lib/baloo_xattr_p.h baloo-4.13.0/src/file/lib/baloo_xattr_p.h --- baloo-4.12.97/src/file/lib/baloo_xattr_p.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/lib/baloo_xattr_p.h 2014-04-09 10:33:16.000000000 +0000 @@ -53,6 +53,13 @@ const ssize_t size = extattr_get_file(encodedPath, EXTATTR_NAMESPACE_USER, attributeName, NULL, 0); #endif + if (size <= 0) { + if (value) { + value->clear(); + } + return size; + } + QByteArray data(size, Qt::Uninitialized); #if defined(Q_OS_LINUX) diff -Nru baloo-4.12.97/src/file/lib/filemapping.cpp baloo-4.13.0/src/file/lib/filemapping.cpp --- baloo-4.12.97/src/file/lib/filemapping.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/lib/filemapping.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -131,6 +131,34 @@ return true; } +bool FileMapping::remove(QSqlDatabase db) +{ + if (m_url.isEmpty() && m_id == 0) + return false; + + QSqlQuery query(db); + + if (!m_url.isEmpty()) { + query.prepare("delete from files where url = ?"); + query.addBindValue(m_url); + if (!query.exec()) { + kError() << query.lastError().text(); + return false; + } + } + else { + query.prepare("delete from files where id = ?"); + query.addBindValue(m_id); + if (!query.exec()) { + kError() << query.lastError().text(); + return false; + } + } + + return true; +} + + void FileMapping::clear() { m_id = 0; diff -Nru baloo-4.12.97/src/file/lib/filemapping.h baloo-4.13.0/src/file/lib/filemapping.h --- baloo-4.12.97/src/file/lib/filemapping.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/lib/filemapping.h 2014-04-09 10:33:16.000000000 +0000 @@ -60,6 +60,8 @@ */ bool create(QSqlDatabase db); + bool remove(QSqlDatabase db); + bool operator ==(const FileMapping& rhs) const; private: diff -Nru baloo-4.12.97/src/file/lib/filemodifyjob.cpp baloo-4.13.0/src/file/lib/filemodifyjob.cpp --- baloo-4.12.97/src/file/lib/filemodifyjob.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/lib/filemodifyjob.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -53,7 +53,6 @@ bool tagsSet; XapianDatabase* m_db; - QStringList m_updatedFiles; Private() : rating(0) @@ -94,6 +93,8 @@ void FileModifyJob::doStart() { + QStringList updatedFiles; + Q_FOREACH (const File& file, d->files) { FileMapping fileMap(file.url()); if (!file.id().isEmpty()) { @@ -121,7 +122,7 @@ return; } - d->m_updatedFiles << fileMap.url(); + updatedFiles << fileMap.url(); const QString furl = fileMap.url(); if (d->ratingSet) { @@ -162,13 +163,9 @@ } d->m_db->replaceDocument(fileMap.id(), doc.doc()); - connect(d->m_db, SIGNAL(committed()), this, SLOT(slotCommitted())); d->m_db->commit(); } -} -void FileModifyJob::slotCommitted() -{ // Notify the world? QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/files"), QLatin1String("org.kde"), @@ -176,7 +173,7 @@ QVariantList vl; vl.reserve(1); - vl << QVariant(d->m_updatedFiles); + vl << QVariant(updatedFiles); message.setArguments(vl); QDBusConnection::sessionBus().send(message); diff -Nru baloo-4.12.97/src/file/lib/filemodifyjob.h baloo-4.13.0/src/file/lib/filemodifyjob.h --- baloo-4.12.97/src/file/lib/filemodifyjob.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/lib/filemodifyjob.h 2014-04-09 10:33:16.000000000 +0000 @@ -49,7 +49,6 @@ private Q_SLOTS: void doStart(); - void slotCommitted(); private: class Private; diff -Nru baloo-4.12.97/src/file/main.cpp baloo-4.13.0/src/file/main.cpp --- baloo-4.12.97/src/file/main.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/main.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -20,11 +20,12 @@ * */ -#include - #include #include #include +#include +#include +#include #include #include @@ -45,13 +46,14 @@ lowerSchedulingPriority(); lowerPriority(); - QApplication app(argc, argv); - KAboutData aboutData("baloo_file", "baloo_file", ki18n("Baloo File"), "0.1", ki18n("An application to handle file metadata"), KAboutData::License_GPL_V2); - KComponentData data(aboutData, KComponentData::RegisterAsMainComponent); + KCmdLineArgs::init(argc, argv, &aboutData); + + KUniqueApplication app(true); + app.disableSessionManagement(); KConfig config("baloofilerc"); KConfigGroup group = config.group("Basic Settings"); @@ -68,6 +70,9 @@ return 1; } + // Crash Handling + KCrash::setFlags(KCrash::AutoRestart); + const QString path = KGlobal::dirs()->localxdgdatadir() + "baloo/file/"; Database db; diff -Nru baloo-4.12.97/src/file/metadatamover.cpp baloo-4.13.0/src/file/metadatamover.cpp --- baloo-4.12.97/src/file/metadatamover.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/metadatamover.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -34,13 +34,7 @@ MetadataMover::MetadataMover(Database* db, QObject* parent) : QObject(parent) , m_db(db) - , m_queueMutex(QMutex::Recursive) { - // setup the main update queue timer - m_queueTimer = new QTimer(this); - connect(m_queueTimer, SIGNAL(timeout()), - this, SLOT(slotWorkUpdateQueue()), - Qt::DirectConnection); } @@ -55,16 +49,14 @@ Q_ASSERT(!from.isEmpty() && from != "/"); Q_ASSERT(!to.isEmpty() && to != "/"); - QMutexLocker lock(&m_queueMutex); + // We do NOT get deleted messages for overwritten files! Thus, we + // have to remove all metadata for overwritten files first. + removeMetadata(to); - UpdateRequest req(from, to); - if (!m_updateQueue.contains(req)) - m_updateQueue.enqueue(req); - - QTimer::singleShot(0, this, SLOT(slotStartUpdateTimer())); + // and finally update the old statements + updateMetadata(from, to); } - void MetadataMover::removeFileMetadata(const QString& file) { Q_ASSERT(!file.isEmpty() && file != "/"); @@ -75,55 +67,9 @@ void MetadataMover::removeFileMetadata(const QStringList& files) { kDebug() << files; - QMutexLocker lock(&m_queueMutex); Q_FOREACH (const QString& file, files) { - UpdateRequest req(file); - if (!m_updateQueue.contains(req)) - m_updateQueue.enqueue(req); - } - - QTimer::singleShot(0, this, SLOT(slotStartUpdateTimer())); -} - - -void MetadataMover::slotWorkUpdateQueue() -{ - // lock for initial iteration - QMutexLocker lock(&m_queueMutex); - - // work the queue - if (!m_updateQueue.isEmpty()) { - UpdateRequest updateRequest = m_updateQueue.dequeue(); - - // unlock after queue utilization - lock.unlock(); - -// kDebug() << "========================= handling" << updateRequest.source() << updateRequest.target(); - - // an empty second url means deletion - if (updateRequest.target().isEmpty()) { - removeMetadata(updateRequest.source()); - } else { - const QString from = updateRequest.source(); - const QString to = updateRequest.target(); - - // We do NOT get deleted messages for overwritten files! Thus, we - // have to remove all metadata for overwritten files first. - removeMetadata(to); - - // and finally update the old statements - updateMetadata(from, to); - } - -// kDebug() << "========================= done with" << updateRequest.source() << updateRequest.target(); - } else { - //kDebug() << "All update requests handled. Stopping timer."; - - m_db->sqlDatabase().commit(); - m_db->sqlDatabase().transaction(); - - m_queueTimer->stop(); + removeMetadata(file); } } @@ -210,14 +156,9 @@ if (!query.exec(queryStr)) { kError() << "Big query failed:" << query.lastError().text(); } -} -// start the timer in the update thread -void MetadataMover::slotStartUpdateTimer() -{ - if (!m_queueTimer->isActive()) { - m_queueTimer->start(); - } + m_db->sqlDatabase().commit(); + m_db->sqlDatabase().transaction(); } #include "metadatamover.moc" diff -Nru baloo-4.12.97/src/file/metadatamover.h baloo-4.13.0/src/file/metadatamover.h --- baloo-4.12.97/src/file/metadatamover.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/metadatamover.h 2014-04-09 10:33:16.000000000 +0000 @@ -19,12 +19,8 @@ #ifndef _METADATA_MOVER_H_ #define _METADATA_MOVER_H_ -#include -#include +#include -#include "updaterequest.h" - -class QTimer; class Database; namespace Baloo @@ -59,14 +55,6 @@ */ void fileRemoved(int id); -private Q_SLOTS: - void slotWorkUpdateQueue(); - - /** - * Start the update queue from the main thread. - */ - void slotStartUpdateTimer(); - private: /** * Remove the metadata for file \p url @@ -80,13 +68,6 @@ void updateMetadata(const QString& from, const QString& to); Database* m_db; - - // if the second url is empty, just delete the metadata - QQueue m_updateQueue; - - QMutex m_queueMutex; - - QTimer* m_queueTimer; }; } diff -Nru baloo-4.12.97/src/file/tests/basicindexingqueuetest.cpp baloo-4.13.0/src/file/tests/basicindexingqueuetest.cpp --- baloo-4.12.97/src/file/tests/basicindexingqueuetest.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/tests/basicindexingqueuetest.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -55,6 +55,47 @@ timer.start(); int ret = app.exec(); + commitQueue.commit(); qDebug() << "Elapsed:" << timer.elapsed(); + + // Print the io usage + QFile file("/proc/self/io"); + file.open(QIODevice::ReadOnly | QIODevice::Text); + + QTextStream fs(&file); + QString str = fs.readAll(); + + qDebug() << "------- IO ---------"; + QTextStream stream(&str); + while (!stream.atEnd()) { + QString str = stream.readLine(); + + QString rchar("rchar: "); + if (str.startsWith(rchar)) { + ulong amt = str.mid(rchar.size()).toULong(); + qDebug() << "Read:" << amt / 1024 << "kb"; + } + + QString wchar("wchar: "); + if (str.startsWith(wchar)) { + ulong amt = str.mid(wchar.size()).toULong(); + qDebug() << "Write:" << amt / 1024 << "kb"; + } + + QString read("read_bytes: "); + if (str.startsWith(read)) { + ulong amt = str.mid(read.size()).toULong(); + qDebug() << "Actual Reads:" << amt / 1024 << "kb"; + } + + QString write("write_bytes: "); + if (str.startsWith(write)) { + ulong amt = str.mid(write.size()).toULong(); + qDebug() << "Actual Writes:" << amt / 1024 << "kb"; + } + } + qDebug() << "\nThe actual read/writes may be 0 because of an existing" + << "cache and /tmp being memory mapped"; + return ret; } diff -Nru baloo-4.12.97/src/file/tests/CMakeLists.txt baloo-4.13.0/src/file/tests/CMakeLists.txt --- baloo-4.12.97/src/file/tests/CMakeLists.txt 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/tests/CMakeLists.txt 2014-04-09 10:33:16.000000000 +0000 @@ -38,3 +38,28 @@ baloocore balooxapian ) + +kde4_add_executable(fileindexingqueuetest + fileindexingqueuetest.cpp + fileindexer.cpp + ../fileindexerconfig.cpp + ../regexpcache.cpp + ../fileexcludefilters.cpp + ../basicindexingqueue.cpp + ../indexingqueue.cpp + ../basicindexingjob.cpp + ../database.cpp + ../lib/filemapping.cpp + ../commitqueue.cpp +) + +target_link_libraries(fileindexingqueuetest + ${QT_QTCORE_LIBRARY} + ${QT_QTSQL_LIBRARY} + ${KDE4_KDECORE_LIBS} + ${KDE4_KIO_LIBS} + ${XAPIAN_LIBRARIES} + ${KFILEMETADATA_LIBRARY} + baloocore + balooxapian +) diff -Nru baloo-4.12.97/src/file/tests/createFile.sh baloo-4.13.0/src/file/tests/createFile.sh --- baloo-4.12.97/src/file/tests/createFile.sh 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.13.0/src/file/tests/createFile.sh 2014-04-09 10:33:16.000000000 +0000 @@ -0,0 +1,13 @@ +#!/bin/sh + +# This script is mostly used in order to make sure the baloo_file_extractor +# process can cope with Xapian::DatabaseModified exceptions and when +# it cannot obtain the write lock +for i in {1..1000000} +do + FILE="$HOME/_baloo_test_file$i" + touch $FILE + sleep 2 + rm $FILE + sleep 2 +done diff -Nru baloo-4.12.97/src/file/tests/fileindexer.cpp baloo-4.13.0/src/file/tests/fileindexer.cpp --- baloo-4.12.97/src/file/tests/fileindexer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.13.0/src/file/tests/fileindexer.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -0,0 +1,88 @@ +/* + * + * Copyright (C) 2014 Vishesh Handa + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "fileindexer.h" + +#include +#include + +#include +#include + +using namespace Baloo; + +FileIndexer::FileIndexer(uint id, const QString& url) + : KJob() + , m_id(id) + , m_url(url) + , m_process(0) +{ +} + +void FileIndexer::setCustomPath(const QString& path) +{ + m_customPath = path; +} + +void FileIndexer::start() +{ + QTimer::singleShot(0, this, SLOT(doStart())); +} + +void FileIndexer::doStart() +{ + // Get the mimetype - used for stats later + m_mimeType = KMimeType::findByUrl(QUrl::fromLocalFile(m_url))->name(); + + // setup the external process which does the actual indexing + const QString exe = KStandardDirs::findExe(QLatin1String("baloo_file_extractor")); + + QStringList args; + args << QString::number(m_id); + args << "--db" << m_customPath; + + m_process = new QProcess(this); + connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), + this, SLOT(slotIndexedFile(int,QProcess::ExitStatus))); + + m_process->setProcessChannelMode(QProcess::SeparateChannels); + + m_timer.start(); + m_process->start(exe, args); +} + +void FileIndexer::slotIndexedFile(int returnCode, QProcess::ExitStatus status) +{ + m_elapsed = m_timer.elapsed(); + + emitResult(); + return; +} + +int FileIndexer::elapsed() const +{ + return m_elapsed; +} + +QString FileIndexer::mimeType() const +{ + return m_mimeType; +} + diff -Nru baloo-4.12.97/src/file/tests/fileindexer.h baloo-4.13.0/src/file/tests/fileindexer.h --- baloo-4.12.97/src/file/tests/fileindexer.h 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.13.0/src/file/tests/fileindexer.h 2014-04-09 10:33:16.000000000 +0000 @@ -0,0 +1,61 @@ +/* + * + * Copyright (C) 2014 Vishesh Handa + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef BALOO_FILEINDEXER_H +#define BALOO_FILEINDEXER_H + +#include +#include + +#include + +namespace Baloo { + +class FileIndexer : public KJob +{ + Q_OBJECT +public: + FileIndexer(uint id, const QString& url); + + virtual void start(); + void setCustomPath(const QString& path); + + QString mimeType() const; + int elapsed() const; + +private Q_SLOTS: + void doStart(); + void slotIndexedFile(int returnCode, QProcess::ExitStatus status); + +private: + int m_id; + QString m_url; + QString m_mimeType; + + QString m_customPath; + QProcess* m_process; + + QTime m_timer; + int m_elapsed; +}; + +} + +#endif // BALOO_FILEINDEXER_H diff -Nru baloo-4.12.97/src/file/tests/fileindexingqueuetest.cpp baloo-4.13.0/src/file/tests/fileindexingqueuetest.cpp --- baloo-4.12.97/src/file/tests/fileindexingqueuetest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.13.0/src/file/tests/fileindexingqueuetest.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -0,0 +1,104 @@ +/* + * This file is part of the KDE Baloo Project + * Copyright (C) 2014 Vishesh Handa + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + */ + +#include +#include +#include +#include + +#include "fileindexer.h" + +#include "../basicindexingqueue.h" +#include "../commitqueue.h" +#include "../database.h" +#include "../fileindexerconfig.h" +#include "../lib/filemapping.h" + +namespace { + QString contents(const QString& url) { + QFile file(url); + file.open(QIODevice::ReadOnly); + + QTextStream stream(&file); + return stream.readAll(); + } +} + +int main(int argc, char** argv) +{ + KTempDir tempDir; + + Database db; + db.setPath(tempDir.name()); + db.init(); + + Baloo::FileIndexerConfig config; + QCoreApplication app(argc, argv); + + Baloo::BasicIndexingQueue basicIQ(&db, &config); + QObject::connect(&basicIQ, SIGNAL(finishedIndexing()), &app, SLOT(quit())); + + Baloo::CommitQueue commitQueue(&db); + QObject::connect(&basicIQ, SIGNAL(newDocument(uint,Xapian::Document)), + &commitQueue, SLOT(add(uint,Xapian::Document))); + + basicIQ.enqueue(Baloo::FileMapping(QDir::homePath())); + app.exec(); + + commitQueue.commit(); + + // Now the file indexing + Xapian::Database* xdb = db.xapianDatabase()->db(); + Xapian::Enquire enquire(*xdb); + enquire.set_query(Xapian::Query("Z1")); + + Xapian::MSet mset = enquire.get_mset(0, 50000); + Xapian::MSetIterator it = mset.begin(); + + QHash m_timePerType; + QHash m_numPerType; + + uint totalTime = 0; + for (; it != mset.end(); it++) { + Baloo::FileMapping fileMap(*it); + if (!fileMap.fetch(db.sqlDatabase())) + continue; + + Baloo::FileIndexer* job = new Baloo::FileIndexer(fileMap.id(), fileMap.url()); + job->setCustomPath(db.path()); + job->exec(); + + qDebug() << fileMap.id() << fileMap.url() << job->mimeType() << job->elapsed(); + totalTime += job->elapsed(); + + m_timePerType[job->mimeType()] += job->elapsed(); + m_numPerType[job->mimeType()] += 1; + } + + qDebug() << "\n\n"; + Q_FOREACH (const QString& type, m_timePerType.uniqueKeys()) { + double averageTime = m_timePerType.value(type) / m_numPerType.value(type); + qDebug() << type << averageTime; + } + qDebug() << "Total Elapsed:" << totalTime; + return 0; +} diff -Nru baloo-4.12.97/src/file/tests/indexerconfigtest.cpp baloo-4.13.0/src/file/tests/indexerconfigtest.cpp --- baloo-4.12.97/src/file/tests/indexerconfigtest.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/tests/indexerconfigtest.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -66,11 +66,14 @@ bool shouldIndex = config.shouldBeIndexed(url.toLocalFile()); QString mimetype = KMimeType::findByUrl(url)->name(); - bool shouldIndexMimetype = config.shouldMimeTypeBeIndexed(mimetype); + QString fastMimetype = KMimeType::findByUrl(url, 0, true, true)->name(); + + bool shouldIndexMimetype = config.shouldMimeTypeBeIndexed(fastMimetype); std::cout << url.toLocalFile().toUtf8().constData() << "\n" << "Should Index: " << std::boolalpha << shouldIndex << "\n" << "Should Index Mimetype: " << std::boolalpha << shouldIndexMimetype << "\n" - << "Mimetype: " << mimetype.toUtf8().constData() << std::endl; + << "Fast Mimetype: " << fastMimetype.toUtf8().constData() << std::endl + << "Slow Mimetype: " << mimetype.toUtf8().constData() << std::endl; return 0; //app.exec(); } diff -Nru baloo-4.12.97/src/file/updaterequest.cpp baloo-4.13.0/src/file/updaterequest.cpp --- baloo-4.12.97/src/file/updaterequest.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/updaterequest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -/* - This file is part of the Nepomuk KDE project. - Copyright (C) 2009 Sebastian Trueg - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) version 3, or any - later version accepted by the membership of KDE e.V. (or its - successor approved by the membership of KDE e.V.), which shall - act as a proxy defined in Section 6 of version 3 of the license. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library. If not, see . -*/ - -#include "updaterequest.h" - -uint Baloo::qHash(const UpdateRequest& req) -{ - return qHash(req.source()) ^ qHash(req.target()); -} diff -Nru baloo-4.12.97/src/file/updaterequest.h baloo-4.13.0/src/file/updaterequest.h --- baloo-4.12.97/src/file/updaterequest.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/file/updaterequest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -/* - This file is part of the Nepomuk KDE project. - Copyright (C) 2009 Sebastian Trueg - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) version 3, or any - later version accepted by the membership of KDE e.V. (or its - successor approved by the membership of KDE e.V.), which shall - act as a proxy defined in Section 6 of version 3 of the license. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library. If not, see . -*/ - -#ifndef _UPDATE_REQUEST_H_ -#define _UPDATE_REQUEST_H_ - -#include -#include - -namespace Baloo -{ -/** - * One update request with a timestamp. - */ -class UpdateRequest -{ -public: - UpdateRequest(const QString& s = QString(), - const QString& t = QString()) - : m_source(s), - m_target(t) { - m_timestamp = QDateTime::currentDateTime(); - } - - /// here the timestamp is ignored deliberately - bool operator==(const UpdateRequest& other) const { - return m_source == other.m_source && m_target == other.m_target; - } - - QDateTime timestamp() const { - return m_timestamp; - } - QString source() const { - return m_source; - } - QString target() const { - return m_target; - } - -private: - QString m_source; - QString m_target; - QDateTime m_timestamp; -}; - -uint qHash(const UpdateRequest& req); -} - -#endif diff -Nru baloo-4.12.97/src/pim/agent/akonadibalooindexingagent.desktop baloo-4.13.0/src/pim/agent/akonadibalooindexingagent.desktop --- baloo-4.12.97/src/pim/agent/akonadibalooindexingagent.desktop 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/pim/agent/akonadibalooindexingagent.desktop 2014-04-09 10:33:16.000000000 +0000 @@ -10,6 +10,7 @@ Name[fi]=Akonadin Baloo-indeksointiagentti Name[fr]=Agent d'indexation Baloo de Akonadi Name[hu]=Akonadi Baloo indexelő ügynök +Name[ia]=Agente de indicisation de Baloo de Akonadi Name[it]=Agente di indicizzazione Baloo di Akonadi Name[ko]=Akonadi Baloo 검색 에이전트 Name[lt]=Akonadi Baloo indeksavimas agentas @@ -19,6 +20,7 @@ Name[pl]=Agent indeksowania Baloo dla Akonadi Name[pt]=Agente de Indexação do Baloo no Akonadi Name[pt_BR]=Agente de Indexação do Baloo no Akonadi +Name[ru]=Агент индексирования данных Akonadi в Baloo Name[sk]=Agent indexovania Akonadi Baloo Name[sl]=Akonadijev posrednik za izgrajevanje kazal, Baloo Name[sr]=Балуов агент индексирања над Аконадијем diff -Nru baloo-4.12.97/src/pim/agent/autotests/CMakeLists.txt baloo-4.13.0/src/pim/agent/autotests/CMakeLists.txt --- baloo-4.12.97/src/pim/agent/autotests/CMakeLists.txt 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/pim/agent/autotests/CMakeLists.txt 2014-04-09 10:33:16.000000000 +0000 @@ -24,6 +24,7 @@ ${KDEPIMLIBS_KMIME_LIBS} ${KDEPIMLIBS_KABC_LIBS} ${XAPIAN_LIBRARIES} + ${KDEPIMLIBS_KPIMUTILS_LIBS} baloocore balooxapian -) \ No newline at end of file +) diff -Nru baloo-4.12.97/src/pim/agent/CMakeLists.txt baloo-4.13.0/src/pim/agent/CMakeLists.txt --- baloo-4.12.97/src/pim/agent/CMakeLists.txt 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/pim/agent/CMakeLists.txt 2014-04-09 10:33:16.000000000 +0000 @@ -27,6 +27,8 @@ ${KDEPIMLIBS_KMIME_LIBS} ${KDEPIMLIBS_KABC_LIBS} ${XAPIAN_LIBRARIES} + ${KDEPIMLIBS_KPIMUTILS_LIBS} + balooxapian ) install(TARGETS akonadi_baloo_indexer ${INSTALL_TARGETS_DEFAULT_ARGS}) diff -Nru baloo-4.12.97/src/pim/agent/contactindexer.cpp baloo-4.13.0/src/pim/agent/contactindexer.cpp --- baloo-4.12.97/src/pim/agent/contactindexer.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/pim/agent/contactindexer.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -21,14 +21,16 @@ */ #include "contactindexer.h" +#include "xapiandocument.h" #include +#include #include ContactIndexer::ContactIndexer(const QString& path): AbstractIndexer() { - m_db = new Xapian::WritableDatabase(path.toStdString(), Xapian::DB_CREATE_OR_OPEN); + m_db = new Baloo::XapianDatabase(path, true); } ContactIndexer::~ContactIndexer() @@ -42,19 +44,16 @@ return QStringList() << KABC::Addressee::mimeType(); } -void ContactIndexer::index(const Akonadi::Item& item) +bool ContactIndexer::indexContact(const Akonadi::Item& item) { KABC::Addressee addresse; try { addresse = item.payload(); } catch (const Akonadi::PayloadException&) { - return; + return false; } - Xapian::Document doc; - Xapian::TermGenerator termGen; - termGen.set_database(*m_db); - termGen.set_document(doc); + Baloo::XapianDocument doc; QString name; if (!addresse.formattedName().isEmpty()) { @@ -67,54 +66,78 @@ name = addresse.name(); } - std::string stdName = name.toStdString(); - std::string stdNick = addresse.nickName().toStdString(); kDebug() << "Indexing" << name << addresse.nickName(); - termGen.index_text(stdName); - termGen.index_text(stdNick); - doc.add_boolean_term(addresse.uid().toStdString()); + doc.indexText(name); + doc.indexText(addresse.nickName()); + doc.indexText(addresse.uid()); - termGen.index_text(stdName, 1, "NA"); - termGen.index_text(stdNick, 1, "NI"); + doc.indexText(name, "NA"); + doc.indexText(addresse.nickName(), "NI"); Q_FOREACH (const QString& email, addresse.emails()) { - std::string stdEmail = email.toStdString(); - - doc.add_term(stdEmail); - termGen.index_text(stdEmail); + doc.addTerm(email); + doc.indexText(email); } // Parent collection Q_ASSERT_X(item.parentCollection().isValid(), "Baloo::ContactIndexer::index", "Item does not have a valid parent collection"); - Akonadi::Entity::Id colId = item.parentCollection().id(); - QByteArray term = 'C' + QByteArray::number(colId); - doc.add_boolean_term(term.data()); + const Akonadi::Entity::Id colId = item.parentCollection().id(); + doc.addBoolTerm(colId, "C"); - m_db->replace_document(item.id(), doc); - // TODO: Contact Groups? + m_db->replaceDocument(item.id(), doc); + return true; } -void ContactIndexer::remove(const Akonadi::Item& item) +void ContactIndexer::indexContactGroup(const Akonadi::Item& item) { + KABC::ContactGroup group; try { - m_db->delete_document(item.id()); - } - catch (const Xapian::DocNotFoundError&) { + group = item.payload(); + } catch (const Akonadi::PayloadException&) { return; } + + Baloo::XapianDocument doc; + + const QString name = group.name(); + doc.indexText(name); + doc.indexText(name, "NA"); + + // Parent collection + Q_ASSERT_X(item.parentCollection().isValid(), "Baloo::ContactIndexer::index", + "Item does not have a valid parent collection"); + + const Akonadi::Entity::Id colId = item.parentCollection().id(); + doc.addBoolTerm(colId, "C"); + + m_db->replaceDocument(item.id(), doc); +} + + +void ContactIndexer::index(const Akonadi::Item& item) +{ + if (!indexContact(item)) { + indexContactGroup(item); + } +} + +void ContactIndexer::remove(const Akonadi::Item& item) +{ + m_db->deleteDocument(item.id()); } void ContactIndexer::remove(const Akonadi::Collection& collection) { try { + Xapian::Database* db = m_db->db(); Xapian::Query query('C'+ QString::number(collection.id()).toStdString()); - Xapian::Enquire enquire(*m_db); + Xapian::Enquire enquire(*db); enquire.set_query(query); - Xapian::MSet mset = enquire.get_mset(0, m_db->get_doccount()); + Xapian::MSet mset = enquire.get_mset(0, db->get_doccount()); Xapian::MSetIterator end(mset.end()); for (Xapian::MSetIterator it = mset.begin(); it != end; ++it) { const qint64 id = *it; diff -Nru baloo-4.12.97/src/pim/agent/contactindexer.h baloo-4.13.0/src/pim/agent/contactindexer.h --- baloo-4.12.97/src/pim/agent/contactindexer.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/pim/agent/contactindexer.h 2014-04-09 10:33:16.000000000 +0000 @@ -24,8 +24,7 @@ #define CONTACTINDEXER_H #include "abstractindexer.h" - -#include +#include "xapiandatabase.h" class ContactIndexer: public AbstractIndexer { @@ -42,7 +41,10 @@ void commit(); private: - Xapian::WritableDatabase* m_db; + bool indexContact(const Akonadi::Item &item); + void indexContactGroup(const Akonadi::Item &item); + + Baloo::XapianDatabase* m_db; }; #endif // CONTACTINDEXER_H diff -Nru baloo-4.12.97/src/pim/agent/emailindexer.cpp baloo-4.13.0/src/pim/agent/emailindexer.cpp --- baloo-4.12.97/src/pim/agent/emailindexer.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/pim/agent/emailindexer.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -26,6 +26,8 @@ #include #include +#include + EmailIndexer::EmailIndexer(const QString& path, const QString& contactDbPath): AbstractIndexer(), m_doc( 0 ), m_termGen( 0 ) @@ -115,19 +117,9 @@ // TODO: Move this into KMime? // TODO: If name is all upper/lower then try to captialize it? QString prettyAddress(const KMime::Types::Mailbox& mbox) { - QString name = mbox.name().simplified(); - QByteArray email = mbox.address().simplified().toLower(); - - // Remove outer quotes recursively - while (name.size() >= 2 && (name[0] == '\'' || name[0] == '"') && - (name[name.size()-1] == '\'' || name[name.size()-1] == '"')) { - name = name.mid(1, name.size()-2); - } - - if (name.isEmpty()) - return email; - else - return name + QLatin1String(" <") + QString::fromUtf8(email) + QLatin1Char('>'); + const QString name = mbox.name().simplified(); + const QByteArray email = mbox.address().simplified().toLower(); + return KPIMUtils::normalizedAddress(name, QString::fromUtf8(email)); } } diff -Nru baloo-4.12.97/src/pim/agent/tests/CMakeLists.txt baloo-4.13.0/src/pim/agent/tests/CMakeLists.txt --- baloo-4.12.97/src/pim/agent/tests/CMakeLists.txt 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/pim/agent/tests/CMakeLists.txt 2014-04-09 10:33:16.000000000 +0000 @@ -12,6 +12,6 @@ ${KDEPIMLIBS_AKONADI_LIBS} ${KDEPIMLIBS_AKONADI_KMIME_LIBS} ${KDEPIMLIBS_KMIME_LIBS} - + ${KDEPIMLIBS_KPIMUTILS_LIBS} ${XAPIAN_LIBRARIES} ) diff -Nru baloo-4.12.97/src/pim/agent/tests/emailtest.cpp baloo-4.13.0/src/pim/agent/tests/emailtest.cpp --- baloo-4.12.97/src/pim/agent/tests/emailtest.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/pim/agent/tests/emailtest.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -44,6 +45,7 @@ void indexNextCollection(); void itemReceived(const Akonadi::Item::List& item); void slotIndexed(); + void slotCommitTimerElapsed(); private: Akonadi::Collection::List m_collections; @@ -52,6 +54,8 @@ QTime m_totalTime; int m_indexTime; int m_numEmails; + + QTimer m_commitTimer; }; int main(int argc, char** argv) @@ -69,6 +73,10 @@ void App::main() { + m_commitTimer.setInterval(1000); + connect(&m_commitTimer, SIGNAL(timeout()), this, SLOT(slotCommitTimerElapsed())); + m_commitTimer.start(); + Akonadi::CollectionFetchJob* job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(), Akonadi::CollectionFetchJob::Recursive); connect(job, SIGNAL(finished(KJob*)), this, SLOT(slotRootCollectionsFetched(KJob*))); @@ -124,8 +132,13 @@ m_indexTime += timer.elapsed(); m_numEmails += itemList.size(); +} + +void App::slotCommitTimerElapsed() +{ + QTime timer; + timer.start(); - timer.restart(); m_indexer.commit(); m_indexTime += timer.elapsed(); @@ -146,6 +159,45 @@ kDebug() << "Emails:" << m_numEmails; kDebug() << "Total Time:" << m_totalTime.elapsed()/1000.0 << " seconds"; kDebug() << "Index Time:" << m_indexTime/1000.0 << " seconds"; + + // Print the io usage + QFile file("/proc/self/io"); + file.open(QIODevice::ReadOnly | QIODevice::Text); + + QTextStream fs(&file); + QString str = fs.readAll(); + + qDebug() << "------- IO ---------"; + QTextStream stream(&str); + while (!stream.atEnd()) { + QString str = stream.readLine(); + + QString rchar("rchar: "); + if (str.startsWith(rchar)) { + ulong amt = str.mid(rchar.size()).toULong(); + qDebug() << "Read:" << amt / 1024 << "kb"; + } + + QString wchar("wchar: "); + if (str.startsWith(wchar)) { + ulong amt = str.mid(wchar.size()).toULong(); + qDebug() << "Write:" << amt / 1024 << "kb"; + } + + QString read("read_bytes: "); + if (str.startsWith(read)) { + ulong amt = str.mid(read.size()).toULong(); + qDebug() << "Actual Reads:" << amt / 1024 << "kb"; + } + + QString write("write_bytes: "); + if (str.startsWith(write)) { + ulong amt = str.mid(write.size()).toULong(); + qDebug() << "Actual Writes:" << amt / 1024 << "kb"; + } + } + qDebug() << "\nThe actual read/writes may be 0 because of an existing" + << "cache and /tmp being memory mapped"; quit(); } diff -Nru baloo-4.12.97/src/pim/akonadiplugin/akonadibaloosearchplugin.desktop baloo-4.13.0/src/pim/akonadiplugin/akonadibaloosearchplugin.desktop --- baloo-4.12.97/src/pim/akonadiplugin/akonadibaloosearchplugin.desktop 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/pim/akonadiplugin/akonadibaloosearchplugin.desktop 2014-04-09 10:33:16.000000000 +0000 @@ -10,6 +10,7 @@ Name[fi]=Akonadin Baloo-hakuliitännäinen Name[fr]=Module de recherche Baloo pour Akonadi Name[hu]=Akonadi Baloo keresés bővítmény +Name[ia]=Plugin de cerca de Baloo de Akonadi Name[it]=Estensione di ricerca Baloo di Akonadi Name[ko]=Akonadi Baloo 검색 플러그인 Name[lt]=Akonadi Baloo paieškos priedas @@ -19,6 +20,7 @@ Name[pl]=Wtyczka znajdywania Baloo dla Akonadi Name[pt]=Agente de Pesquisa do Baloo no Akonadi Name[pt_BR]=Plugin de pesquisa do Baloo no Akonadi +Name[ru]=Модуль Baloo для поиска по базе данных Akonadi Name[sk]=Plugin hľadania Akonadi Baloo Name[sl]=Akonadijev vstavek za iskanje, Baloo Name[sr]=Балуов прикључак претраге над Аконадијем diff -Nru baloo-4.12.97/src/pim/akonadiplugin/autotests/CMakeLists.txt baloo-4.13.0/src/pim/akonadiplugin/autotests/CMakeLists.txt --- baloo-4.12.97/src/pim/akonadiplugin/autotests/CMakeLists.txt 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/pim/akonadiplugin/autotests/CMakeLists.txt 2014-04-09 10:33:16.000000000 +0000 @@ -27,6 +27,7 @@ ${KDEPIMLIBS_KMIME_LIBS} ${KDEPIMLIBS_KABC_LIBS} ${XAPIAN_LIBRARIES} + ${KDEPIMLIBS_KPIMUTILS_LIBS} baloocore balooxapian ) diff -Nru baloo-4.12.97/src/pim/lib/emailquery.cpp baloo-4.13.0/src/pim/lib/emailquery.cpp --- baloo-4.12.97/src/pim/lib/emailquery.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/pim/lib/emailquery.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -182,7 +182,13 @@ ResultIterator EmailQuery::exec() { const QString dir = KGlobal::dirs()->localxdgdatadir() + "baloo/email/"; - Xapian::Database db(dir.toUtf8().constData()); + Xapian::Database db; + try { + db = Xapian::Database(dir.toUtf8().constData()); + } catch (const Xapian::DatabaseError& e) { + kWarning() << "Failed to open Xapian database:" << QString::fromStdString(e.get_error_string()); + return ResultIterator(); + } QList m_queries; diff -Nru baloo-4.12.97/src/runner/plasma-runner-baloosearch.desktop baloo-4.13.0/src/runner/plasma-runner-baloosearch.desktop --- baloo-4.12.97/src/runner/plasma-runner-baloosearch.desktop 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/runner/plasma-runner-baloosearch.desktop 2014-04-09 10:33:16.000000000 +0000 @@ -11,6 +11,7 @@ Name[fi]=Työpöytähaku Name[fr]=Recherche sur le bureau Name[hu]=Asztali keresés +Name[ia]=Cerca de Scriptorio Name[it]=Ricerca dal desktop Name[ko]=데스크톱 검색 Name[lt]=Darbastalio paieška @@ -21,6 +22,7 @@ Name[pl]=Wyszukiwanie na pulpicie Name[pt]=Pesquisa no Ambiente de Trabalho Name[pt_BR]=Pesquisa no desktop +Name[ru]=Поиск по меткам и содержимому Name[sk]=Hľadanie na ploche Name[sl]=Namizno iskanje Name[sr]=Претрага површи @@ -44,6 +46,7 @@ Comment[fi]=Suoritusohjelma, joka etsii tiedostoista, sähköposteista ja yhteystiedoista Comment[fr]=Lanceur de recherche dans les fichiers, courriels et contacts Comment[hu]=Futtató, amely fájlokban, e-mailekben és névjegyekben keres +Comment[ia]=Cursor de qual cercas a transverso de files, messages de e-posta e contactos Comment[it]=Esecutore che cerca nei file, nei messaggi di posta e nei contatti Comment[ko]=파일, 이메일, 연락처를 검색하는 실행기 Comment[lt]=Paleidiklis, kuris Ieško failuose, el. laiškuose ir kontaktuose @@ -53,6 +56,7 @@ Comment[pl]=Program, który przeszukuje pliki, pocztę i kontakty Comment[pt]=Um módulo de execução que pesquisa nos ficheiros, e-mails e contactos Comment[pt_BR]=Execução que pesquisa nos arquivos, e-mails e contatos +Comment[ru]=Поиск по содержимому файлов, писем и по адресной книге Comment[sk]=Bežec, ktorý prehľadáva vaše súbory, e-maily a kontakty Comment[sl]=Zaganjalnik, ki preišče datoteke, e-pošto in stike Comment[sr]=Извођач који тражи кроз фајлове, е‑пошту и контакте @@ -67,7 +71,7 @@ Comment[zh_TW]=搜尋檔案、電子郵件與聯絡人的執行器 X-KDE-ServiceTypes=Plasma/Runner Type=Service -Icon=edit-find +Icon=baloo X-KDE-Library=krunner_baloosearchrunner X-KDE-PluginInfo-Author=Vishesh Handa X-KDE-PluginInfo-Email=me@vhanda.in diff -Nru baloo-4.12.97/src/tools/balooshow/main.cpp baloo-4.13.0/src/tools/balooshow/main.cpp --- baloo-4.12.97/src/tools/balooshow/main.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/tools/balooshow/main.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -104,10 +104,16 @@ Baloo::File file = job->file(); int fid = Baloo::deserialize("file", file.id()); - text = colorString(QString::number(fid), 31); - text += " "; - text += colorString(file.url(), 32); - stream << text << endl; + + if (fid && !file.url().isEmpty()) { + text = colorString(QString::number(fid), 31); + text += " "; + text += colorString(file.url(), 32); + stream << text << endl; + } + else { + stream << "No index information found" << endl; + } KFileMetaData::PropertyMap propMap = file.properties(); KFileMetaData::PropertyMap::const_iterator it = propMap.constBegin(); diff -Nru baloo-4.12.97/src/xapian/xapiandatabase.cpp baloo-4.13.0/src/xapian/xapiandatabase.cpp --- baloo-4.12.97/src/xapian/xapiandatabase.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/xapian/xapiandatabase.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -1,5 +1,4 @@ /* - * * Copyright (C) 2014 Vishesh Handa * * This library is free software; you can redistribute it and/or @@ -26,98 +25,126 @@ #include #include +#include using namespace Baloo; -XapianDatabase::XapianDatabase(const QString& path) - : QObject() - , m_db(0) +XapianDatabase::XapianDatabase(const QString& path, bool writeOnly) + : m_db(0) + , m_writeOnly(writeOnly) { QDir().mkpath(path); m_path = path.toUtf8().constData(); - try { - Xapian::WritableDatabase(m_path, Xapian::DB_CREATE_OR_OPEN); - m_db = new Xapian::Database(m_path); + if (!writeOnly) { + try { + createWritableDb(); + m_db = new Xapian::Database(m_path); + } + catch (const Xapian::DatabaseError& err) { + kError() << "Serious Error: " << err.get_error_string(); + kError() << err.get_msg().c_str() << err.get_context().c_str() << err.get_description().c_str(); + } + + // Possible errors - DatabaseLock error + // Corrupt and InvalidID error } - catch (const Xapian::DatabaseError& err) { - kError() << "Serious Error: " << err.get_error_string(); - kError() << err.get_msg().c_str() << err.get_context().c_str() << err.get_description().c_str(); + else { + m_wDb = createWritableDb(); } +} - // Possible errors - DatabaseLock error - // Corrupt and InvalidID error +void XapianDatabase::replaceDocument(uint id, const XapianDocument& doc) +{ + replaceDocument(id, doc.doc()); } void XapianDatabase::replaceDocument(uint id, const Xapian::Document& doc) { + if (m_writeOnly) { + try { + m_wDb.replace_document(id, doc); + } + catch (const Xapian::Error&) { + } + return; + } m_docsToAdd << qMakePair(id, doc); } void XapianDatabase::deleteDocument(uint id) { + if (m_writeOnly) { + try { + m_wDb.delete_document(id); + } + catch (const Xapian::Error&) { + } + return; + } m_docsToRemove << id; } void XapianDatabase::commit() { + if (m_writeOnly) { + try { + m_wDb.commit(); + } + catch (const Xapian::Error& err) { + kError() << err.get_error_string(); + } + return; + } + if (m_docsToAdd.isEmpty() && m_docsToRemove.isEmpty()) { - Q_EMIT committed(); return; } - try { - Xapian::WritableDatabase wdb(m_path, Xapian::DB_CREATE_OR_OPEN); + Xapian::WritableDatabase wdb = createWritableDb(); - kDebug() << "Adding:" << m_docsToAdd.size() << "docs"; - Q_FOREACH (const DocIdPair& doc, m_docsToAdd) { + kDebug() << "Adding:" << m_docsToAdd.size() << "docs"; + Q_FOREACH (const DocIdPair& doc, m_docsToAdd) { + try { wdb.replace_document(doc.first, doc.second); } + catch (const Xapian::Error&) { + } + } - kDebug() << "Removing:" << m_docsToRemove.size() << "docs"; - Q_FOREACH (Xapian::docid id, m_docsToRemove) { - try { - wdb.delete_document(id); - } - catch (const Xapian::DocNotFoundError&) { - } + kDebug() << "Removing:" << m_docsToRemove.size() << "docs"; + Q_FOREACH (Xapian::docid id, m_docsToRemove) { + try { + wdb.delete_document(id); } + catch (const Xapian::Error&) { + } + } + try { wdb.commit(); m_db->reopen(); - kDebug() << "Xapian Committed"; - - m_docsToAdd.clear(); - m_docsToRemove.clear(); - - malloc_trim(0); - - Q_EMIT committed(); } - catch (const Xapian::DatabaseLockError& err) { - kError() << err.get_msg().c_str(); - retryCommit(); + catch (const Xapian::Error& err) { + kError() << err.get_error_string(); } - catch (const Xapian::DatabaseModifiedError& err) { - kError() << err.get_msg().c_str(); - kError() << "Commit failed, retrying in another 200 msecs"; - retryCommit(); - } - catch (const Xapian::DatabaseError& err) { - kError() << err.get_msg().c_str(); - retryCommit(); - } -} + kDebug() << "Xapian Committed"; -void XapianDatabase::retryCommit() -{ - QTimer::singleShot(200, this, SLOT(commit())); + m_docsToAdd.clear(); + m_docsToRemove.clear(); + + malloc_trim(0); } XapianDocument XapianDatabase::document(uint id) { try { - Xapian::Document xdoc = m_db->get_document(id); + Xapian::Document xdoc; + if (m_writeOnly) { + xdoc = m_wDb.get_document(id); + } else { + xdoc = m_db->get_document(id); + } return XapianDocument(xdoc); } catch (const Xapian::DatabaseModifiedError&) { @@ -129,5 +156,37 @@ } } +Xapian::WritableDatabase XapianDatabase::createWritableDb() +{ + // We need to keep sleeping for a required amount, until we reach + // a threshold. That's when we decide to abort? + for (int i = 1; i <= 20; i++) { + try { + Xapian::WritableDatabase wdb(m_path, Xapian::DB_CREATE_OR_OPEN); + return wdb; + } + catch (const Xapian::DatabaseLockError&) { + usleep(i * 50 * 1000); + } + catch (const Xapian::DatabaseModifiedError&) { + usleep(i * 50 * 1000); + } + catch (const Xapian::DatabaseCreateError& err) { + kDebug() << err.get_error_string(); + return Xapian::WritableDatabase(); + } + catch (const Xapian::DatabaseCorruptError& err) { + kError() << "Database Corrupted - What did you do?"; + kError() << err.get_error_string(); + return Xapian::WritableDatabase(); + } + catch (...) { + kError() << "Bananana Error"; + return Xapian::WritableDatabase(); + } + } + kError() << "Could not obtain lock for Xapian Database. This is bad"; + return Xapian::WritableDatabase(); +} diff -Nru baloo-4.12.97/src/xapian/xapiandatabase.h baloo-4.13.0/src/xapian/xapiandatabase.h --- baloo-4.12.97/src/xapian/xapiandatabase.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/xapian/xapiandatabase.h 2014-04-09 10:33:16.000000000 +0000 @@ -1,5 +1,4 @@ /* - * * Copyright (C) 2014 Vishesh Handa * * This library is free software; you can redistribute it and/or @@ -25,7 +24,6 @@ #include "xapian_export.h" #include -#include #include #include @@ -33,13 +31,18 @@ class XapianDocument; -class BALOO_XAPIAN_EXPORT XapianDatabase : public QObject +class BALOO_XAPIAN_EXPORT XapianDatabase { - Q_OBJECT public: - XapianDatabase(const QString& path); + /** + * Create the Xapian db at path \p path. The parameter \p + * writeOnly locks the database as long as this object is + * valid + */ + XapianDatabase(const QString& path, bool writeOnly = false); void replaceDocument(uint id, const Xapian::Document& doc); + void replaceDocument(uint id, const XapianDocument& doc); void deleteDocument(uint id); /** @@ -61,19 +64,18 @@ return m_db; } -Q_SIGNALS: - void committed(); - private: Xapian::Database* m_db; + Xapian::WritableDatabase m_wDb; typedef QPair DocIdPair; QVector m_docsToAdd; QVector m_docsToRemove; std::string m_path; + bool m_writeOnly; - void retryCommit(); + Xapian::WritableDatabase createWritableDb(); }; } diff -Nru baloo-4.12.97/src/xapian/xapiandocument.cpp baloo-4.13.0/src/xapian/xapiandocument.cpp --- baloo-4.12.97/src/xapian/xapiandocument.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/xapian/xapiandocument.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -66,7 +66,7 @@ indexText(text, QString(), wdfInc); } -Xapian::Document XapianDocument::doc() +Xapian::Document XapianDocument::doc() const { return m_doc; } diff -Nru baloo-4.12.97/src/xapian/xapiandocument.h baloo-4.13.0/src/xapian/xapiandocument.h --- baloo-4.12.97/src/xapian/xapiandocument.h 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/xapian/xapiandocument.h 2014-04-09 10:33:16.000000000 +0000 @@ -38,7 +38,7 @@ XapianDocument(); XapianDocument(const Xapian::Document& doc); - void addTerm(const QString& term, const QString& prefix); + void addTerm(const QString& term, const QString& prefix = QString()); void addBoolTerm(const QString& term, const QString& prefix = QString()); void addBoolTerm(int term, const QString& prefix); @@ -47,7 +47,7 @@ void addValue(int pos, const QString& value); - Xapian::Document doc(); + Xapian::Document doc() const; QString fetchTermStartsWith(const QByteArray& term); diff -Nru baloo-4.12.97/src/xapian/xapiansearchstore.cpp baloo-4.13.0/src/xapian/xapiansearchstore.cpp --- baloo-4.12.97/src/xapian/xapiansearchstore.cpp 2014-03-26 17:07:59.000000000 +0000 +++ baloo-4.13.0/src/xapian/xapiansearchstore.cpp 2014-04-09 10:33:16.000000000 +0000 @@ -46,12 +46,19 @@ m_dbPath = path; delete m_db; + m_db = 0; + try { m_db = new Xapian::Database(m_dbPath.toUtf8().constData()); } catch (const Xapian::DatabaseOpeningError&) { kError() << "Xapian Database does not exist at " << m_dbPath; - m_db = 0; + } + catch (const Xapian::DatabaseCorruptError&) { + kError() << "Xapian Database corrupted at " << m_dbPath; + } + catch (...) { + kError() << "Random exception, but we do not want to crash"; } } @@ -199,7 +206,12 @@ return 0; QMutexLocker lock(&m_mutex); - m_db->reopen(); + try { + m_db->reopen(); + } catch (Xapian::DatabaseError& e) { + kWarning() << "Failed to reopen database" << dbPath() << ":" << QString::fromStdString(e.get_msg()); + return 0; + } QTime queryGenerationTimer; queryGenerationTimer.start();