diff -Nru baloo-4.12.97/debian/changelog baloo-4.12.97/debian/changelog --- baloo-4.12.97/debian/changelog 2014-04-02 09:04:28.000000000 +0000 +++ baloo-4.12.97/debian/changelog 2014-04-07 12:30:25.000000000 +0000 @@ -1,3 +1,10 @@ +baloo (4:4.12.97-0ubuntu2) trusty; urgency=medium + + * Blanket import fixes between 4.12.97 and current git KDE/4.13 in + debian/patches/upstream_git/ + + -- Harald Sitter Mon, 07 Apr 2014 12:35:02 +0200 + baloo (4:4.12.97-0ubuntu1) trusty; urgency=medium * New upstream release candidate diff -Nru baloo-4.12.97/debian/libbaloofiles4.symbols baloo-4.12.97/debian/libbaloofiles4.symbols --- baloo-4.12.97/debian/libbaloofiles4.symbols 2014-04-02 09:04:28.000000000 +0000 +++ baloo-4.12.97/debian/libbaloofiles4.symbols 2014-04-07 12:30:25.000000000 +0000 @@ -1,4 +1,4 @@ -# SymbolsHelper-Confirmed: 4:4.12.97 i386 +# SymbolsHelper-Confirmed: 4:4.12.97-0ubuntu2 amd64 i386 libbaloofiles.so.4 libbaloofiles4 #MINVER#, baloo _ZN5Baloo10TagListJob11qt_metacallEN11QMetaObject4CallEiPPv@Base 4:4.12.80 _ZN5Baloo10TagListJob11qt_metacastEPKc@Base 4:4.12.80 @@ -14,6 +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 _ZN5Baloo11FileMapping6setUrlERK7QString@Base 4:4.12.80 _ZN5Baloo11FileMapping7fetchedEv@Base 4:4.12.80 _ZN5Baloo11FileMappingC1ERK7QString@Base 4:4.12.80 @@ -56,7 +57,6 @@ _ZN5Baloo13FileModifyJob11qt_metacallEN11QMetaObject4CallEiPPv@Base 4:4.12.80 _ZN5Baloo13FileModifyJob11qt_metacastEPKc@Base 4:4.12.80 _ZN5Baloo13FileModifyJob12modifyRatingERK11QStringListi@Base 4:4.12.80 - _ZN5Baloo13FileModifyJob13slotCommittedEv@Base 4:4.12.97 _ZN5Baloo13FileModifyJob16staticMetaObjectE@Base 4:4.12.80 _ZN5Baloo13FileModifyJob17modifyUserCommentERK11QStringListRK7QString@Base 4:4.12.80 _ZN5Baloo13FileModifyJob5startEv@Base 4:4.12.80 diff -Nru baloo-4.12.97/debian/libbalooxapian4.symbols baloo-4.12.97/debian/libbalooxapian4.symbols --- baloo-4.12.97/debian/libbalooxapian4.symbols 2014-04-02 09:04:28.000000000 +0000 +++ baloo-4.12.97/debian/libbalooxapian4.symbols 2014-04-07 12:30:25.000000000 +0000 @@ -1,24 +1,17 @@ -# SymbolsHelper-Confirmed: 4:4.12.97 amd64 +# SymbolsHelper-Confirmed: 4:4.12.97-0ubuntu2 i386 libbalooxapian.so.4 libbalooxapian4 #MINVER#, baloo - _ZN5Baloo14XapianDatabase11qt_metacallEN11QMetaObject4CallEiPPv@Base 4:4.12.97 - _ZN5Baloo14XapianDatabase11qt_metacastEPKc@Base 4:4.12.97 - _ZN5Baloo14XapianDatabase11retryCommitEv@Base 4:4.12.97 _ZN5Baloo14XapianDatabase14deleteDocumentEj@Base 4:4.12.97 _ZN5Baloo14XapianDatabase15replaceDocumentEjRKN6Xapian8DocumentE@Base 4:4.12.97 - _ZN5Baloo14XapianDatabase16staticMetaObjectE@Base 4:4.12.97 + _ZN5Baloo14XapianDatabase15replaceDocumentEjRKNS_14XapianDocumentE@Base 4:4.12.97-0ubuntu2 + _ZN5Baloo14XapianDatabase16createWritableDbEv@Base 4:4.12.97-0ubuntu2 _ZN5Baloo14XapianDatabase6commitEv@Base 4:4.12.97 _ZN5Baloo14XapianDatabase8documentEj@Base 4:4.12.97 - _ZN5Baloo14XapianDatabase9committedEv@Base 4:4.12.97 - _ZN5Baloo14XapianDatabaseC1ERK7QString@Base 4:4.12.97 - _ZN5Baloo14XapianDatabaseC2ERK7QString@Base 4:4.12.97 - _ZN5Baloo14XapianDatabaseD0Ev@Base 4:4.12.97 - _ZN5Baloo14XapianDatabaseD1Ev@Base 4:4.12.97 - _ZN5Baloo14XapianDatabaseD2Ev@Base 4:4.12.97 + _ZN5Baloo14XapianDatabaseC1ERK7QStringb@Base 4:4.12.97-0ubuntu2 + _ZN5Baloo14XapianDatabaseC2ERK7QStringb@Base 4:4.12.97-0ubuntu2 _ZN5Baloo14XapianDocument11addBoolTermERK7QStringS3_@Base 4:4.12.97 _ZN5Baloo14XapianDocument11addBoolTermEiRK7QString@Base 4:4.12.97 _ZN5Baloo14XapianDocument19fetchTermStartsWithERK10QByteArray@Base 4:4.12.97 _ZN5Baloo14XapianDocument20removeTermStartsWithERK10QByteArray@Base 4:4.12.97 - _ZN5Baloo14XapianDocument3docEv@Base 4:4.12.97 _ZN5Baloo14XapianDocument7addTermERK7QStringS3_@Base 4:4.12.97 _ZN5Baloo14XapianDocument8addValueEiRK7QString@Base 4:4.12.97 _ZN5Baloo14XapianDocument9indexTextERK7QStringS3_i@Base 4:4.12.97 @@ -52,24 +45,25 @@ _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 - _ZNK5Baloo14XapianDatabase10metaObjectEv@Base 4:4.12.97 - _ZTIN5Baloo14XapianDatabaseE@Base 4:4.12.97 + _ZNK5Baloo14XapianDocument3docEv@Base 4:4.12.97-0ubuntu2 _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 _ZTIN6Xapian20DatabaseOpeningErrorE@Base 4:4.12.80 _ZTIN6Xapian21DatabaseModifiedErrorE@Base 4:4.12.80 _ZTIN6Xapian5ErrorE@Base 4:4.12.80 - _ZTSN5Baloo14XapianDatabaseE@Base 4:4.12.97 _ZTSN5Baloo17XapianSearchStoreE@Base 4:4.12.80 _ZTSN6Xapian12RuntimeErrorE@Base 4:4.12.80 _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 _ZTSN6Xapian20DatabaseOpeningErrorE@Base 4:4.12.80 _ZTSN6Xapian21DatabaseModifiedErrorE@Base 4:4.12.80 _ZTSN6Xapian5ErrorE@Base 4:4.12.80 - _ZTVN5Baloo14XapianDatabaseE@Base 4:4.12.97 _ZTVN5Baloo17XapianSearchStoreE@Base 4:4.12.80 diff -Nru baloo-4.12.97/debian/patches/series baloo-4.12.97/debian/patches/series --- baloo-4.12.97/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/series 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,48 @@ +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 diff -Nru baloo-4.12.97/debian/patches/upstream_git/0001-KCM-Remove-developer-mode.patch baloo-4.12.97/debian/patches/upstream_git/0001-KCM-Remove-developer-mode.patch --- baloo-4.12.97/debian/patches/upstream_git/0001-KCM-Remove-developer-mode.patch 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0001-KCM-Remove-developer-mode.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,119 @@ +From eb0c51bff2aa4bda6c31a83f489dce9b39afddac Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Thu, 27 Mar 2014 12:59:24 +0100 +Subject: [PATCH 01/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0002-Extractor-Add-a-db-option-to-write-to-a-separate-db.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,56 @@ +From 9a96bd2f8990bcd160c385d557473a8972578f0f Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Thu, 27 Mar 2014 13:12:27 +0100 +Subject: [PATCH 02/48] 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.12.97/debian/patches/upstream_git/0003-Add-a-fileindexingjobtest.patch --- baloo-4.12.97/debian/patches/upstream_git/0003-Add-a-fileindexingjobtest.patch 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0003-Add-a-fileindexingjobtest.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,189 @@ +From de39e751d09a16a3f3ef278e2e9755f193074111 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Thu, 27 Mar 2014 13:29:12 +0100 +Subject: [PATCH 03/48] 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.12.97/debian/patches/upstream_git/0004-Improve-the-FileIndexingQueue-Test.patch --- baloo-4.12.97/debian/patches/upstream_git/0004-Improve-the-FileIndexingQueue-Test.patch 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0004-Improve-the-FileIndexingQueue-Test.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,262 @@ +From 6890a28af3eed5c2b2428d8cc0e5e960ef8ed3b8 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Thu, 27 Mar 2014 16:07:48 +0100 +Subject: [PATCH 04/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0005-Commit-Queue-Stop-both-the-timers-after-committing.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,24 @@ +From c127b6d1f30234707ebe7e444ab2f2d91b31953c Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Thu, 27 Mar 2014 19:31:40 +0100 +Subject: [PATCH 05/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0006-BasicIndexingQueueTest-Print-io-usage-by-the-basic-i.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,46 @@ +From 2d4ef34670a57a5076511cf6f1bea16cff73ffad Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Thu, 27 Mar 2014 19:32:09 +0100 +Subject: [PATCH 06/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0007-BasicIndxingQueue-Determine-the-mimetype-without-loo.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,73 @@ +From 0f7d29f09e72357217ba10de8de5f67aa0b69c64 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Thu, 27 Mar 2014 19:39:45 +0100 +Subject: [PATCH 07/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0008-BasicIndexingTest-Improve-debug-messages-for-io-usag.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,59 @@ +From 1f49eeec80efcffb7f808cbd4830dab66aefc62f Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Fri, 28 Mar 2014 10:33:25 +0100 +Subject: [PATCH 08/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0009-Autostart-Baloo-in-GNOME-Unity-and-XFCE.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,31 @@ +From a7377e0cca4f63ca4ce56bef87ac1f82dd219970 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Fri, 28 Mar 2014 12:03:46 +0100 +Subject: [PATCH 09/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0010-sqlite-Enable-WAL-journaling-mode.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,37 @@ +From a94b4283574bae7dee0419d9a9c3195af82b0e96 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Fri, 28 Mar 2014 12:07:01 +0100 +Subject: [PATCH 10/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0011-FileMap-Db-Do-not-set-the-id-as-auto-increment.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,33 @@ +From 6d5f9746494d19610c07d79e5a9a07d844667127 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Fri, 28 Mar 2014 14:30:32 +0100 +Subject: [PATCH 11/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0012-xattr-the-size-returned-can-be-0.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,32 @@ +From 4ffff55c97f165ec098a7b4cb770bcf62c55babb Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Fri, 28 Mar 2014 16:09:17 +0100 +Subject: [PATCH 12/48] 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.12.97/debian/patches/upstream_git/0013-Extractor-Implement-debug-mode.patch --- baloo-4.12.97/debian/patches/upstream_git/0013-Extractor-Implement-debug-mode.patch 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0013-Extractor-Implement-debug-mode.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,111 @@ +From 74143bf37c1e98df0755e891b4645a9c2dea7716 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Fri, 28 Mar 2014 19:01:44 +0100 +Subject: [PATCH 13/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0014-Use-KLocalizedString-instead-of-ki18n.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,25 @@ +From 29a334fe6dfb46fb36d44abd7adae06b47cba723 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Sat, 29 Mar 2014 13:02:09 +0100 +Subject: [PATCH 14/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0015-Normalize-email-address-before-to-store-it-in-baloo.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,105 @@ +From 06c4e2305c179a2f445f45e94279c733f505d528 Mon Sep 17 00:00:00 2001 +From: Montel Laurent +Date: Sat, 29 Mar 2014 16:56:56 +0100 +Subject: [PATCH 15/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0016-Catch-DatabaseError-exception-in-XapianSearchStore.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,30 @@ +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/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0017-KCM-Always-call-the-cleaner.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,62 @@ +From 457969987a601d047ff97a9ee575be5182d7246e Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Sat, 29 Mar 2014 15:31:03 +0100 +Subject: [PATCH 17/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0018-KCM-Use-dbus-asyncCall-instead-of-send.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,33 @@ +From e54afe1e2d131d46a2ac6df4303aadc41507c0c2 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Sat, 29 Mar 2014 15:31:49 +0100 +Subject: [PATCH 18/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0019-IndexScheduler-Update-everything-when-the-config-cha.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,93 @@ +From a200834ac5461c4f7c914c4438fcfe91c8b245ea Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Sat, 29 Mar 2014 17:17:51 +0100 +Subject: [PATCH 19/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0020-Cleaner-Always-remove-it-from-both-the-databases.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,61 @@ +From 632abbd8a255bf01e334565e18c8b5d3c6ad0ebf Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Sat, 29 Mar 2014 17:23:52 +0100 +Subject: [PATCH 20/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0021-Cleaner-Commit-the-changes-every-1000-documents.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,37 @@ +From 6493efc09e69bfd974b86937017eaa9210cf7420 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Sat, 29 Mar 2014 17:45:27 +0100 +Subject: [PATCH 21/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0022-Cleaner-Do-faster-mimetype-detection.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,28 @@ +From 2fd777302ef070dcba04f1142ff7c494ff0b8891 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Sat, 29 Mar 2014 17:47:59 +0100 +Subject: [PATCH 22/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0023-BasicIndexingJob-Do-not-add-the-type-as-file.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,26 @@ +From a088f5cce9884294ac29f04f57e5842c5c16b28f Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Sat, 29 Mar 2014 19:06:54 +0100 +Subject: [PATCH 23/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0024-Catch-Xapian-DatabaseException-in-EmailQuery.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,33 @@ +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/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0025-IndexerConfigTest-Show-both-fast-and-slow-mimetype.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,33 @@ +From 9d1c2d8c8e7d195b7d0648af0ca9bf6c874780fa Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Tue, 1 Apr 2014 11:34:40 +0200 +Subject: [PATCH 25/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0026-FileIndexingJob-Assert-instead-of-failing-gracefully.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,28 @@ +From f8ce8ab4d3e763f36eb21cd63238eaafa15007ea Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Tue, 1 Apr 2014 12:36:06 +0200 +Subject: [PATCH 26/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0027-Add-autotest-for-the-file-indexing-job.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,267 @@ +From f453048fd0e830f8b94da06c1ab91805fd067499 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Tue, 1 Apr 2014 15:22:42 +0200 +Subject: [PATCH 27/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0028-FileIndexingJobTest-Test-when-multiple-files-fail-to.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,89 @@ +From 3ad8f77301f25be1ede51bd38116bbb417fc3568 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Tue, 1 Apr 2014 15:44:20 +0200 +Subject: [PATCH 28/48] 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.12.97/debian/patches/upstream_git/0029-FileIndexingJobTest-Test-timeouts.patch --- baloo-4.12.97/debian/patches/upstream_git/0029-FileIndexingJobTest-Test-timeouts.patch 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0029-FileIndexingJobTest-Test-timeouts.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,165 @@ +From a6631dc63d582e9bd1c5bea9ed1779ade6f61ed9 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Tue, 1 Apr 2014 15:56:16 +0200 +Subject: [PATCH 29/48] 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.12.97/debian/patches/upstream_git/0030-FileIndexingJob-Improve-logic.patch --- baloo-4.12.97/debian/patches/upstream_git/0030-FileIndexingJob-Improve-logic.patch 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0030-FileIndexingJob-Improve-logic.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,105 @@ +From 3f2ba1154d6f97db080ec2da272418e9fd93807a Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Tue, 1 Apr 2014 16:37:14 +0200 +Subject: [PATCH 30/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0031-FileIndexingJob-Remember-to-disconnect-the-process-b.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,38 @@ +From f99a0a4d081f8086ab00c4fda33d116d0a0747c1 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Tue, 1 Apr 2014 16:38:37 +0200 +Subject: [PATCH 31/48] 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.12.97/debian/patches/upstream_git/0032-FileIndexingJob-Remove-unnecessary-check.patch --- baloo-4.12.97/debian/patches/upstream_git/0032-FileIndexingJob-Remove-unnecessary-check.patch 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0032-FileIndexingJob-Remove-unnecessary-check.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,33 @@ +From 995bbe7baf7306bf442adbec742bb6873b47fbdd Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Tue, 1 Apr 2014 16:42:17 +0200 +Subject: [PATCH 32/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0033-FileIndexingJob-Minimize-the-number-of-calls-to-the-.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,101 @@ +From d0c63165ffcd8be0bcb3b69f4a54cb12ce1543f2 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Tue, 1 Apr 2014 17:45:31 +0200 +Subject: [PATCH 33/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0034-FileIndexer-Sync-the-config-file-after-initial-index.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,64 @@ +From 13ac6feef102a3c9fd1b81c34666e55aa4d05a34 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Tue, 1 Apr 2014 18:51:52 +0200 +Subject: [PATCH 34/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0035-XapianDatabase-Add-missing-slots-declaration.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,32 @@ +From 562f1706f1b6b548fd7d74fec76f47012aeb4b91 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Wed, 2 Apr 2014 12:13:15 +0200 +Subject: [PATCH 35/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0036-IndexSchduler-Decrease-fileIQ-delay-when-idle.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,27 @@ +From 3fe4d2e97aabbb878b30a1d572cebb5d65fc2848 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Wed, 2 Apr 2014 12:13:32 +0200 +Subject: [PATCH 36/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0037-Add-a-script-to-keep-creating-and-deleting-files.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,35 @@ +From b4f886837cf1a209f96c47903bd57873d59dfee9 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Wed, 2 Apr 2014 12:14:49 +0200 +Subject: [PATCH 37/48] 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.12.97/debian/patches/upstream_git/0038-Index-contactgroup-too.patch --- baloo-4.12.97/debian/patches/upstream_git/0038-Index-contactgroup-too.patch 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0038-Index-contactgroup-too.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,121 @@ +From 572f20ef063c0e19cc49a932fa3ec293e736c50b Mon Sep 17 00:00:00 2001 +From: Montel Laurent +Date: Wed, 2 Apr 2014 14:06:57 +0200 +Subject: [PATCH 38/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0039-FileIndexerConfig-Use-a-simple-config.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,26 @@ +From 2fdf8a9ab98dbec7ed9d48e13276e09d6b3ebed2 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Wed, 2 Apr 2014 12:49:31 +0200 +Subject: [PATCH 39/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0040-FileIndexingJob-Avoid-calling-KStandardDirs-findExe-.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,26 @@ +From d5c016ea3a1730605c16eb4dc000cb0a6f0023da Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Wed, 2 Apr 2014 12:49:47 +0200 +Subject: [PATCH 40/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0041-FileIndexerConfig-Remove-all-locking-code.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,100 @@ +From c7036c46b8dffe1a8b9ce1c2eec52e40bf4b3a66 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Wed, 2 Apr 2014 12:52:35 +0200 +Subject: [PATCH 41/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0042-MetaDataMover-Remove-internal-queue-and-make-it-sync.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,323 @@ +From 3b5cb08a5450cc01e7700697e46262bf80847324 Mon Sep 17 00:00:00 2001 +From: Nitul Datt +Date: Wed, 2 Apr 2014 13:02:45 +0200 +Subject: [PATCH 42/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0043-XapianDatabase-Make-the-commit-function-blocking.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,385 @@ +From d6e8b93f87932670abff3940273e442ef9846e50 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Wed, 2 Apr 2014 14:39:03 +0200 +Subject: [PATCH 43/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0044-XapianDB-Implement-a-write-only-mode.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,307 @@ +From 0350407984eae51e79ca9c7607970d4d92e3a9c8 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Wed, 2 Apr 2014 15:38:44 +0200 +Subject: [PATCH 44/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0045-ContactIndexer-Port-to-the-Baloo-Xapian-library.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,268 @@ +From fdccf18bd1559b4dd8aae934dc8a40af255159fe Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Wed, 2 Apr 2014 16:55:07 +0200 +Subject: [PATCH 45/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0046-Runner-Use-the-Baloo-icon.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,25 @@ +From 6f85025610f48076ac3b11613934cf33b6f67cd2 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Thu, 3 Apr 2014 11:01:07 +0200 +Subject: [PATCH 46/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0047-XapianSearchStore-Catch-some-more-exceptions.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,37 @@ +From ca31cdaf61fd6865091aacb4e9768d5650360d46 Mon Sep 17 00:00:00 2001 +From: Vishesh Handa +Date: Thu, 3 Apr 2014 15:10:57 +0200 +Subject: [PATCH 47/48] 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.12.97/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 1970-01-01 00:00:00.000000000 +0000 +++ baloo-4.12.97/debian/patches/upstream_git/0048-SVN_SILENT-made-messages-.desktop-file.patch 2014-04-07 12:30:25.000000000 +0000 @@ -0,0 +1,50 @@ +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/48] 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 +