Commit 21bd2cc8 authored by Lukas Appelhans's avatar Lukas Appelhans
Browse files

Basically, skip dirs which we extract files into and .PKGINFO from

files of a package
parent 1c90f67f
......@@ -940,7 +940,21 @@ int QueryPerformer::insertFiles(PolKitSQLiteConnection &dbConnection, Package* p
QVariantList files;
QVariantList backup;
QVariantList uoList;
foreach (const QString &file, p->retrieveFiles(Package::FilepathNoPrefix)) {
QStringList dirs;
QStringList sortedFiles = p->retrieveFiles(Package::FilepathNoPrefix);
sortedFiles.sort();
foreach (const QString &file, sortedFiles) {
if (file == ".PKGINFO")
continue;
if (file.endsWith("/")) {
dirs << file;
continue;
}
foreach (const QString &dir, dirs) {
if (file.startsWith(dir)) {
dirs.removeAll(dir);
}
}
packages.append(QVariant::fromValue<int>(p->databaseId()));
files.append(QVariant::fromValue<QString>(file));
if (p->backupFiles().contains(file)) {
......@@ -954,6 +968,20 @@ int QueryPerformer::insertFiles(PolKitSQLiteConnection &dbConnection, Package* p
uoList.append(QVariant::fromValue<bool>(false));
}
}
foreach (const QString &dir, dirs) {
packages.append(QVariant::fromValue<int>(p->databaseId()));
files.append(QVariant::fromValue<QString>(dir));
if (p->backupFiles().contains(dir)) {
backup.append(QVariant::fromValue<QString>(p->backupFiles()[dir]));
} else {
backup.append(QVariant::fromValue<QString>(null));
}
if (p->ultimatelyOwnedFiles().contains(dir)) {
uoList.append(QVariant::fromValue<bool>(true));
} else {
uoList.append(QVariant::fromValue<bool>(false));
}
}
QVariantMap map;
map.insert(":Package", QVariant(packages));
......
......@@ -657,6 +657,7 @@ QStringList Package::retrieveFiles(FilepathMode mode)
try {
PolKitSQLiteConnection &c = d->database->d_func()->dbConnection;
SQLiteResource table = c.query(sql);
if (table.getRowsCount() != 0) {
QStringList fileList;
......@@ -666,6 +667,8 @@ QStringList Package::retrieveFiles(FilepathMode mode)
for (int y = 0; y < table.getRowsCount(); ++y) {
QString file( table.getDataAt(y, "file").toString() );
qDebug() << "Add" << file;
QString backup( table.getDataAt(y, "backup").toString() );
bool ultimatelyOwned( table.getDataAt(y, "ultimateowner").toBool() );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment