From 0cde22eb2fd99eefe502d711448b127c75865ede Mon Sep 17 00:00:00 2001 From: "Adrian Chaves (Gallaecio)" Date: Sun, 18 Sep 2016 21:47:08 +0200 Subject: [PATCH] Rebuilt kdepimlibs4 with akonadi support Required by kdenetwork-kopete. --- akonadi-qt4/PKGBUILD | 18 +-- ...dont-leak-old-external-payload-files.patch | 135 ++++++++++++++++++ kdepimlibs4/PKGBUILD | 35 +++-- 3 files changed, 161 insertions(+), 27 deletions(-) create mode 100644 akonadi-qt4/dont-leak-old-external-payload-files.patch diff --git a/akonadi-qt4/PKGBUILD b/akonadi-qt4/PKGBUILD index 512628cb5..76b2a1a76 100644 --- a/akonadi-qt4/PKGBUILD +++ b/akonadi-qt4/PKGBUILD @@ -4,15 +4,14 @@ # Contributor: Pierre Schmitz pkgbase=akonadi-qt4 -pkgname=(libakonadi-qt4 akonadi-qt4 akonadi-qt4-dbus) +pkgname=(libakonadi-qt4 akonadi-qt4) pkgver=1.13.0 -pkgrel=7 +pkgrel=8 pkgdesc="PIM layer, which provides an asynchronous API to access all kind of PIM data (Qt4 version)" arch=('x86_64') url='http://community.kde.org/KDE_PIM/Akonadi' license=('LGPL') -makedepends=('cmake' 'automoc4' 'boost' 'postgresql' 'mariadb' 'libxslt' 'qt4') -install="${pkgname}.install" +makedepends=('cmake' 'automoc4' 'boost' 'postgresql' 'mariadb' 'qt4' 'libxslt') source=("http://download.kde.org/stable/akonadi/src/akonadi-${pkgver}.tar.bz2" dont-leak-old-external-payload-files.patch) md5sums=('84eb2e471bd6bdfe54a2a2f1d858c07d' @@ -28,11 +27,10 @@ prepare() { build() { cd build - cmake ../akonadi-${pkgver} \ + cmake ../akonadi-$pkgver \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ -DINSTALL_QSQLITE_IN_QT_PREFIX=TRUE \ - -DDATABASE_BACKEND=SQLITE \ -DWITH_SOPRANO=OFF make } @@ -60,11 +58,3 @@ package_akonadi-qt4() { # provided by libakonadi-qt4 rm -r "$pkgdir"/usr/{lib,include} } - -package_akonadi-qt4-dbus() { - depends=() - conflicts=('akonadi<15') - - mkdir -p "$pkgdir"/usr/share/dbus-1/interfaces - install -m644 "$srcdir"/akonadi-$pkgver/interfaces/*.xml "$pkgdir"/usr/share/dbus-1/interfaces/ -} diff --git a/akonadi-qt4/dont-leak-old-external-payload-files.patch b/akonadi-qt4/dont-leak-old-external-payload-files.patch new file mode 100644 index 000000000..227450d53 --- /dev/null +++ b/akonadi-qt4/dont-leak-old-external-payload-files.patch @@ -0,0 +1,135 @@ +From: Dan Vrátil +Date: Mon, 29 Jun 2015 20:45:11 +0000 +Subject: Don't leak old external payload files +X-Git-Url: http://quickgit.kde.org/?p=akonadi.git&a=commitdiff&h=9c0dc6b3f0826d32eac310b2e7ecd858ca3df681 +--- +Don't leak old external payload files + +Actually delete old payload files after we increase the payload revision or +switch from external to internal payload. This caused ~/.local/share/akonadi/file_db_data +to grow insanely for all users, leaving them with many duplicated files (just with +different revisions). + +It is recommended that users run akonadictl fsck to clean up the leaked payload +files. + +Note that there won't be any more releases of Akonadi 1.13 (and this has been +fixed in master already), so I strongly recommend distributions to pick this +patch into their packaging. + +BUG: 341884 +CCBUG: 338402 +--- + + +--- a/server/src/storage/partstreamer.cpp ++++ b/server/src/storage/partstreamer.cpp +@@ -290,6 +290,12 @@ + mDataChanged = true; + } + ++ // If the part is external, remember it's current file name ++ QString originalFile; ++ if (part.isValid() && part.external()) { ++ originalFile = PartHelper::resolveAbsolutePath(part.data()); ++ } ++ + part.setPartType(partType); + part.setVersion(partVersion); + part.setPimItemId(mItem.id()); +@@ -306,6 +312,14 @@ + *changed = mDataChanged; + } + ++ if (!originalFile.isEmpty()) { ++ // If the part was external but is not anymore, or if it's still external ++ // but the filename has changed (revision update), remove the original file ++ if (!part.external() || (part.external() && originalFile != PartHelper::resolveAbsolutePath(part.data()))) { ++ PartHelper::removeFile(originalFile); ++ } ++ } ++ + return ok; + } + + +--- a/server/tests/unittest/partstreamertest.cpp ++++ b/server/tests/unittest/partstreamertest.cpp +@@ -91,6 +91,7 @@ + QTest::addColumn("expectedPartSize"); + QTest::addColumn("expectedChanged"); + QTest::addColumn("isExternal"); ++ QTest::addColumn("version"); + QTest::addColumn("pimItem"); + + PimItem item; +@@ -101,22 +102,22 @@ + QVERIFY(item.insert()); + + // Order of these tests matters! +- QTest::newRow("item 1, internal") << QByteArray("PLD:DATA") << QByteArray("123") << 3ll << true << false << item; +- QTest::newRow("item 1, change to external") << QByteArray("PLD:DATA") << QByteArray("123456789") << 9ll << true << true << item; +- QTest::newRow("item 1, update external") << QByteArray("PLD:DATA") << QByteArray("987654321") << 9ll << true << true << item; +- QTest::newRow("item 1, external, no change") << QByteArray("PLD:DATA") << QByteArray("987654321") << 9ll << false << true << item; +- QTest::newRow("item 1, change to internal") << QByteArray("PLD:DATA") << QByteArray("1234") << 4ll << true << false << item; +- QTest::newRow("item 1, internal, no change") << QByteArray("PLD:DATA") << QByteArray("1234") << 4ll << false << false << item; ++ QTest::newRow("item 1, internal") << QByteArray("PLD:DATA") << QByteArray("123") << 3ll << true << false << -1 << item; ++ QTest::newRow("item 1, change to external") << QByteArray("PLD:DATA") << QByteArray("123456789") << 9ll << true << true << 0 << item; ++ QTest::newRow("item 1, update external") << QByteArray("PLD:DATA") << QByteArray("987654321") << 9ll << true << true << 1 << item; ++ QTest::newRow("item 1, external, no change") << QByteArray("PLD:DATA") << QByteArray("987654321") << 9ll << false << true << 2 << item; ++ QTest::newRow("item 1, change to internal") << QByteArray("PLD:DATA") << QByteArray("1234") << 4ll << true << false << 2 << item; ++ QTest::newRow("item 1, internal, no change") << QByteArray("PLD:DATA") << QByteArray("1234") << 4ll << false << false << 2 << item; + } + + void testStreamer() + { +- return; + QFETCH(QByteArray, expectedPartName); + QFETCH(QByteArray, expectedData); + QFETCH(qint64, expectedPartSize); + QFETCH(bool, expectedChanged); + QFETCH(bool, isExternal); ++ QFETCH(int, version); + QFETCH(PimItem, pimItem); + + FakeConnection connection; +@@ -160,17 +161,18 @@ + + PimItem item = PimItem::retrieveById(pimItem.id()); + const QVector parts = item.parts(); +- QVERIFY(parts.count() == 1); ++ QCOMPARE(parts.count(), 1); + const Part part = parts[0]; + QCOMPARE(part.datasize(), expectedPartSize); + QCOMPARE(part.external(), isExternal); ++ qDebug() << part.version() << part.data(); + const QByteArray data = part.data(); + if (isExternal) { + QVERIFY(streamerSpy.count() == 1); + QVERIFY(streamerSpy.first().count() == 1); + const Response response = streamerSpy.first().first().value(); + const QByteArray str = response.asString(); +- const QByteArray expectedResponse = "+ STREAM [FILE " + QByteArray::number(part.id()) + "_r" + QByteArray::number(part.version()) + "]"; ++ const QByteArray expectedResponse = "+ STREAM [FILE " + QByteArray::number(part.id()) + "_r" + QByteArray::number(version) + "]"; + QCOMPARE(QString::fromUtf8(str), QString::fromUtf8(expectedResponse)); + + QFile file(PartHelper::resolveAbsolutePath(data)); +@@ -182,7 +184,7 @@ + QCOMPARE(fileData, expectedData); + + // Make sure no previous versions are left behind in file_db_data +- for (int i = 0; i < part.version(); ++i) { ++ for (int i = 0; i < version; ++i) { + const QByteArray fileName = QByteArray::number(part.id()) + "_r" + QByteArray::number(part.version()); + const QString filePath = PartHelper::resolveAbsolutePath(fileName); + QVERIFY(!QFile::exists(filePath)); +@@ -194,7 +196,7 @@ + QCOMPARE(data, expectedData); + + // Make sure nothing is left behind in file_db_data +- for (int i = 0; i <= part.version(); ++i) { ++ for (int i = 0; i <= version; ++i) { + const QByteArray fileName = QByteArray::number(part.id()) + "_r" + QByteArray::number(part.version()); + const QString filePath = PartHelper::resolveAbsolutePath(fileName); + QVERIFY(!QFile::exists(filePath)); + diff --git a/kdepimlibs4/PKGBUILD b/kdepimlibs4/PKGBUILD index aa71a1738..aa757866f 100644 --- a/kdepimlibs4/PKGBUILD +++ b/kdepimlibs4/PKGBUILD @@ -1,37 +1,46 @@ -# Include global configuration -source ../kdeapps.conf - pkgname=kdepimlibs4 pkgver=4.14.10 _kdeappver=15.04.3 -pkgrel=8 +pkgrel=9 pkgdesc="KDE4 PIM Libraries" arch=('x86_64') url='https://projects.kde.org/projects/kde/kdepimlibs' license=('GPL' 'LGPL') -depends=('kdelibs' 'gpgme' 'libical' 'prison' 'qjson') -makedepends=('cmake' 'automoc4' 'boost' 'cyrus-sasl' 'docbook-xsl') -install='kdepimlibs4.install' -options=('!docs') -source=("http://download.kde.org/Attic/applications/${_kdeappver}/src/kdepimlibs-${pkgver}.tar.xz") -sha1sums=('8db2f59b8a33f4d1bbebfdff8b772d30669c9932') +depends=('kdelibs' 'gpgme' 'libakonadi-qt4' 'libical' 'prison' 'qjson') +makedepends=('cmake' 'automoc4' 'boost' 'cyrus-sasl' 'docbook-xsl' 'akonadi-qt4') +conflicts=('kdepimlibs') +provides=('kdepimlibs') +replaces=('kdepimlibs') +source=("http://download.kde.org/Attic/applications/${_kdeappver}/src/kdepimlibs-${pkgver}.tar.xz" + kdepimlibs4-bug338658-1.patch::"https://quickgit.kde.org/?p=kdepimlibs.git&a=commitdiff&h=4429619&o=plain" + kdepimlibs4-bug338658-2.patch::"https://quickgit.kde.org/?p=kdepimlibs.git&a=commitdiff&h=d8b5da7&o=plain") +sha1sums=('8db2f59b8a33f4d1bbebfdff8b772d30669c9932' + '453bc1b79453336c6a02babfc44ce8381eebc40a' + '0df47345dd630aa2f31a62f8cf0c062df3c25c67') prepare() { mkdir -p build + + # Fix https://bugs.kde.org/show_bug.cgi?id=338658 + cd kdepimlibs-$pkgver + patch -p1 -i ../kdepimlibs4-bug338658-1.patch + patch -p1 -i ../kdepimlibs4-bug338658-2.patch } build() { cd build cmake ../kdepimlibs-${pkgver} \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DKDE4_BUILD_TESTS=OFF \ -DCMAKE_SKIP_RPATH=ON \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DKDEPIM_ONLY_KLEO=TRUE + -DCMAKE_INSTALL_PREFIX=/usr make } package() { cd build make DESTDIR="${pkgdir}" install + + # Conflicts with KF5 libs + rm -r "$pkgdir"/usr/{bin,share/{akonadi,config.kcfg}} }