[Bug 839411] [libqapt] src: If the xapian index is not found in openXapianIndex, make xapianIndexNeedsUpdate()

Jonathan Thomas echidnaman at kubuntu.org
Fri Sep 2 21:13:34 UTC 2011


Git commit 6a51b2f63e6eeb34d518da6f1ab3385a8210fe3f by Jonathan Thomas.
Committed on 02/09/2011 at 23:09.
Pushed by jmthomas into branch 'master'.

If the xapian index is not found in openXapianIndex, make xapianIndexNeedsUpdate()
return true.

Fixes xapianIndexNeedsUpdating() returning false when there is no index
at all.

CCMAIL:839411 at bugs.launchpad.net

M  +8    -2    src/backend.cpp
M  +4    -1    src/changelog.cpp

http://commits.kde.org/libqapt/6a51b2f63e6eeb34d518da6f1ab3385a8210fe3f

diff --git a/src/backend.cpp b/src/backend.cpp
index 4003361..b34dbf9 100644
--- a/src/backend.cpp
+++ b/src/backend.cpp
@@ -95,6 +95,7 @@ public:
     // Xapian
     time_t xapianTimeStamp;
     Xapian::Database xapianDatabase;
+    bool xapianIndexExists;
 
     // DBus
     QDBusServiceWatcher *watcher;
@@ -647,12 +648,14 @@ bool Backend::xapianIndexNeedsUpdate() const
    // If the cache has been modified after the xapian timestamp, we need to rebuild
    QDateTime aptCacheTime = QFileInfo(QLatin1String(_config->FindFile("Dir::Cache::pkgcache").c_str())).lastModified();
    QDateTime dpkgStatusTime = QFileInfo(QLatin1String("/var/lib/dpkg/status")).lastModified();
+
+   bool outdated = false;
    if (d->xapianTimeStamp < aptCacheTime.toTime_t() ||
        d->xapianTimeStamp < dpkgStatusTime.toTime_t()) {
-      return true;
+       outdated = true;
    }
 
-   return false;
+   return (outdated || (!d->xapianIndexExists));
 }
 
 bool Backend::openXapianIndex()
@@ -665,9 +668,12 @@ bool Backend::openXapianIndex()
     try {
         d->xapianDatabase.add_database(Xapian::Database("/var/lib/apt-xapian-index/index"));
     } catch (Xapian::DatabaseOpeningError) {
+        d->xapianIndexExists = false;
         return false;
     };
 
+    d->xapianIndexExists = true;
+
     return true;
 }
 
diff --git a/src/changelog.cpp b/src/changelog.cpp
index b4bf5b7..69e9fe4 100644
--- a/src/changelog.cpp
+++ b/src/changelog.cpp
@@ -25,7 +25,6 @@
 #include <QtCore/QSharedData>
 #include <QtCore/QStringBuilder>
 #include <QtCore/QStringList>
-#include <QDebug>
 
 // QApt includes
 #include "package.h"
@@ -58,6 +57,7 @@ public:
     QString version;
     QDateTime issueDate;
     QString description;
+    QStringList CVEUrls;
 
     void parseData(const QString &sourcePackage);
 };
@@ -97,6 +97,9 @@ void ChangelogEntryPrivate::parseData(const QString &sourcePackage)
                 break;
             }
         }
+
+
+        QRegExp rxCVE("CVE-\\d{4}-\\d{4}");
     }
 }

-- 
You received this bug notification because you are a member of Kubuntu
Bugs, which is subscribed to qapt in Ubuntu.
https://bugs.launchpad.net/bugs/839411

Title:
  initial install can not search

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qapt/+bug/839411/+subscriptions




More information about the kubuntu-bugs mailing list