[arch-commits] Commit in akonadi/repos (10 files)
Felix Yan
fyan at archlinux.org
Tue Jun 30 03:35:21 UTC 2015
Date: Tuesday, June 30, 2015 @ 05:35:20
Author: fyan
Revision: 241407
archrelease: copy trunk to testing-i686, testing-x86_64
Added:
akonadi/repos/testing-i686/PKGBUILD
(from rev 241406, akonadi/trunk/PKGBUILD)
akonadi/repos/testing-i686/akonadi.install
(from rev 241406, akonadi/trunk/akonadi.install)
akonadi/repos/testing-i686/dont-leak-old-external-payload-files.patch
(from rev 241406, akonadi/trunk/dont-leak-old-external-payload-files.patch)
akonadi/repos/testing-x86_64/PKGBUILD
(from rev 241406, akonadi/trunk/PKGBUILD)
akonadi/repos/testing-x86_64/akonadi.install
(from rev 241406, akonadi/trunk/akonadi.install)
akonadi/repos/testing-x86_64/dont-leak-old-external-payload-files.patch
(from rev 241406, akonadi/trunk/dont-leak-old-external-payload-files.patch)
Deleted:
akonadi/repos/testing-i686/PKGBUILD
akonadi/repos/testing-i686/akonadi.install
akonadi/repos/testing-x86_64/PKGBUILD
akonadi/repos/testing-x86_64/akonadi.install
-----------------------------------------------------------+
/PKGBUILD | 108 +++++++++
/akonadi.install | 22 +
testing-i686/PKGBUILD | 48 ----
testing-i686/akonadi.install | 11
testing-i686/dont-leak-old-external-payload-files.patch | 135 ++++++++++++
testing-x86_64/PKGBUILD | 48 ----
testing-x86_64/akonadi.install | 11
testing-x86_64/dont-leak-old-external-payload-files.patch | 135 ++++++++++++
8 files changed, 400 insertions(+), 118 deletions(-)
Deleted: testing-i686/PKGBUILD
===================================================================
--- testing-i686/PKGBUILD 2015-06-30 03:34:39 UTC (rev 241406)
+++ testing-i686/PKGBUILD 2015-06-30 03:35:20 UTC (rev 241407)
@@ -1,48 +0,0 @@
-# $Id$
-# Maintainer: Felix Yan <felixonmars at archlinux.org>
-# Contributor: Andrea Scarpino <andrea at archlinux.org>
-# Contributor: Pierre Schmitz <pierre at archlinux.de>
-
-pkgname=akonadi
-pkgver=1.13.0
-pkgrel=5
-pkgdesc="PIM layer, which provides an asynchronous API to access all kind of PIM data"
-arch=('i686' 'x86_64')
-url='http://community.kde.org/KDE_PIM/Akonadi'
-license=('LGPL')
-depends=('shared-mime-info' 'boost-libs' 'qt4' 'libxslt')
-makedepends=('cmake' 'automoc4' 'boost' 'postgresql' 'mariadb')
-checkdepends=('xorg-server-xvfb')
-optdepends=('postgresql: PostgreSQL backend'
- 'mariadb: MariaDB backend')
-install="${pkgname}.install"
-source=("http://download.kde.org/stable/${pkgname}/src/${pkgname}-${pkgver}.tar.bz2")
-md5sums=('84eb2e471bd6bdfe54a2a2f1d858c07d')
-
-prepare() {
- mkdir build
-}
-
-build() {
- cd build
- cmake ../${pkgname}-${pkgver} \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DINSTALL_QSQLITE_IN_QT_PREFIX=TRUE \
- -DQT_QMAKE_EXECUTABLE=qmake-qt4 \
- -DDATABASE_BACKEND=SQLITE \
- -DWITH_SOPRANO=OFF
- make
-}
-
-check() {
- # 17 akonadi-dbconfigtest failed as we changed the default backend
- # 24~30 failed due to qt cannot find the sqldriver which is not installed yet
- cd build
- xvfb-run -a dbus-launch --exit-with-session make test || warning "Tests failed"
-}
-
-package() {
- cd build
- make DESTDIR="${pkgdir}" install
-}
Copied: akonadi/repos/testing-i686/PKGBUILD (from rev 241406, akonadi/trunk/PKGBUILD)
===================================================================
--- testing-i686/PKGBUILD (rev 0)
+++ testing-i686/PKGBUILD 2015-06-30 03:35:20 UTC (rev 241407)
@@ -0,0 +1,54 @@
+# $Id$
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Andrea Scarpino <andrea at archlinux.org>
+# Contributor: Pierre Schmitz <pierre at archlinux.de>
+
+pkgname=akonadi
+pkgver=1.13.0
+pkgrel=6
+pkgdesc="PIM layer, which provides an asynchronous API to access all kind of PIM data"
+arch=('i686' 'x86_64')
+url='http://community.kde.org/KDE_PIM/Akonadi'
+license=('LGPL')
+depends=('shared-mime-info' 'boost-libs' 'qt4' 'libxslt')
+makedepends=('cmake' 'automoc4' 'boost' 'postgresql' 'mariadb')
+checkdepends=('xorg-server-xvfb')
+optdepends=('postgresql: PostgreSQL backend'
+ 'mariadb: MariaDB backend')
+install="${pkgname}.install"
+source=("http://download.kde.org/stable/${pkgname}/src/${pkgname}-${pkgver}.tar.bz2"
+ dont-leak-old-external-payload-files.patch)
+md5sums=('84eb2e471bd6bdfe54a2a2f1d858c07d'
+ '9711e300dde3775a38637daa3c20befe')
+
+prepare() {
+ mkdir build
+
+ cd $pkgname-$pkgver
+ # https://bugs.kde.org/show_bug.cgi?id=341884
+ patch -p1 -i ../dont-leak-old-external-payload-files.patch
+}
+
+build() {
+ cd build
+ cmake ../${pkgname}-${pkgver} \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DINSTALL_QSQLITE_IN_QT_PREFIX=TRUE \
+ -DQT_QMAKE_EXECUTABLE=qmake-qt4 \
+ -DDATABASE_BACKEND=SQLITE \
+ -DWITH_SOPRANO=OFF
+ make
+}
+
+check() {
+ # 17 akonadi-dbconfigtest failed as we changed the default backend
+ # 24~30 failed due to qt cannot find the sqldriver which is not installed yet
+ cd build
+ xvfb-run -a dbus-launch --exit-with-session make test || warning "Tests failed"
+}
+
+package() {
+ cd build
+ make DESTDIR="${pkgdir}" install
+}
Deleted: testing-i686/akonadi.install
===================================================================
--- testing-i686/akonadi.install 2015-06-30 03:34:39 UTC (rev 241406)
+++ testing-i686/akonadi.install 2015-06-30 03:35:20 UTC (rev 241407)
@@ -1,11 +0,0 @@
-post_install() {
- update-mime-database usr/share/mime &> /dev/null
-}
-
-post_upgrade() {
- post_install
-}
-
-post_remove() {
- post_install
-}
Copied: akonadi/repos/testing-i686/akonadi.install (from rev 241406, akonadi/trunk/akonadi.install)
===================================================================
--- testing-i686/akonadi.install (rev 0)
+++ testing-i686/akonadi.install 2015-06-30 03:35:20 UTC (rev 241407)
@@ -0,0 +1,11 @@
+post_install() {
+ update-mime-database usr/share/mime &> /dev/null
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ post_install
+}
Copied: akonadi/repos/testing-i686/dont-leak-old-external-payload-files.patch (from rev 241406, akonadi/trunk/dont-leak-old-external-payload-files.patch)
===================================================================
--- testing-i686/dont-leak-old-external-payload-files.patch (rev 0)
+++ testing-i686/dont-leak-old-external-payload-files.patch 2015-06-30 03:35:20 UTC (rev 241407)
@@ -0,0 +1,135 @@
+From: Dan Vrátil <dvratil at redhat.com>
+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<qint64>("expectedPartSize");
+ QTest::addColumn<bool>("expectedChanged");
+ QTest::addColumn<bool>("isExternal");
++ QTest::addColumn<int>("version");
+ QTest::addColumn<PimItem>("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<Part> 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<Akonadi::Server::Response>();
+ 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));
+
Deleted: testing-x86_64/PKGBUILD
===================================================================
--- testing-x86_64/PKGBUILD 2015-06-30 03:34:39 UTC (rev 241406)
+++ testing-x86_64/PKGBUILD 2015-06-30 03:35:20 UTC (rev 241407)
@@ -1,48 +0,0 @@
-# $Id$
-# Maintainer: Felix Yan <felixonmars at archlinux.org>
-# Contributor: Andrea Scarpino <andrea at archlinux.org>
-# Contributor: Pierre Schmitz <pierre at archlinux.de>
-
-pkgname=akonadi
-pkgver=1.13.0
-pkgrel=5
-pkgdesc="PIM layer, which provides an asynchronous API to access all kind of PIM data"
-arch=('i686' 'x86_64')
-url='http://community.kde.org/KDE_PIM/Akonadi'
-license=('LGPL')
-depends=('shared-mime-info' 'boost-libs' 'qt4' 'libxslt')
-makedepends=('cmake' 'automoc4' 'boost' 'postgresql' 'mariadb')
-checkdepends=('xorg-server-xvfb')
-optdepends=('postgresql: PostgreSQL backend'
- 'mariadb: MariaDB backend')
-install="${pkgname}.install"
-source=("http://download.kde.org/stable/${pkgname}/src/${pkgname}-${pkgver}.tar.bz2")
-md5sums=('84eb2e471bd6bdfe54a2a2f1d858c07d')
-
-prepare() {
- mkdir build
-}
-
-build() {
- cd build
- cmake ../${pkgname}-${pkgver} \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DINSTALL_QSQLITE_IN_QT_PREFIX=TRUE \
- -DQT_QMAKE_EXECUTABLE=qmake-qt4 \
- -DDATABASE_BACKEND=SQLITE \
- -DWITH_SOPRANO=OFF
- make
-}
-
-check() {
- # 17 akonadi-dbconfigtest failed as we changed the default backend
- # 24~30 failed due to qt cannot find the sqldriver which is not installed yet
- cd build
- xvfb-run -a dbus-launch --exit-with-session make test || warning "Tests failed"
-}
-
-package() {
- cd build
- make DESTDIR="${pkgdir}" install
-}
Copied: akonadi/repos/testing-x86_64/PKGBUILD (from rev 241406, akonadi/trunk/PKGBUILD)
===================================================================
--- testing-x86_64/PKGBUILD (rev 0)
+++ testing-x86_64/PKGBUILD 2015-06-30 03:35:20 UTC (rev 241407)
@@ -0,0 +1,54 @@
+# $Id$
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Andrea Scarpino <andrea at archlinux.org>
+# Contributor: Pierre Schmitz <pierre at archlinux.de>
+
+pkgname=akonadi
+pkgver=1.13.0
+pkgrel=6
+pkgdesc="PIM layer, which provides an asynchronous API to access all kind of PIM data"
+arch=('i686' 'x86_64')
+url='http://community.kde.org/KDE_PIM/Akonadi'
+license=('LGPL')
+depends=('shared-mime-info' 'boost-libs' 'qt4' 'libxslt')
+makedepends=('cmake' 'automoc4' 'boost' 'postgresql' 'mariadb')
+checkdepends=('xorg-server-xvfb')
+optdepends=('postgresql: PostgreSQL backend'
+ 'mariadb: MariaDB backend')
+install="${pkgname}.install"
+source=("http://download.kde.org/stable/${pkgname}/src/${pkgname}-${pkgver}.tar.bz2"
+ dont-leak-old-external-payload-files.patch)
+md5sums=('84eb2e471bd6bdfe54a2a2f1d858c07d'
+ '9711e300dde3775a38637daa3c20befe')
+
+prepare() {
+ mkdir build
+
+ cd $pkgname-$pkgver
+ # https://bugs.kde.org/show_bug.cgi?id=341884
+ patch -p1 -i ../dont-leak-old-external-payload-files.patch
+}
+
+build() {
+ cd build
+ cmake ../${pkgname}-${pkgver} \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DINSTALL_QSQLITE_IN_QT_PREFIX=TRUE \
+ -DQT_QMAKE_EXECUTABLE=qmake-qt4 \
+ -DDATABASE_BACKEND=SQLITE \
+ -DWITH_SOPRANO=OFF
+ make
+}
+
+check() {
+ # 17 akonadi-dbconfigtest failed as we changed the default backend
+ # 24~30 failed due to qt cannot find the sqldriver which is not installed yet
+ cd build
+ xvfb-run -a dbus-launch --exit-with-session make test || warning "Tests failed"
+}
+
+package() {
+ cd build
+ make DESTDIR="${pkgdir}" install
+}
Deleted: testing-x86_64/akonadi.install
===================================================================
--- testing-x86_64/akonadi.install 2015-06-30 03:34:39 UTC (rev 241406)
+++ testing-x86_64/akonadi.install 2015-06-30 03:35:20 UTC (rev 241407)
@@ -1,11 +0,0 @@
-post_install() {
- update-mime-database usr/share/mime &> /dev/null
-}
-
-post_upgrade() {
- post_install
-}
-
-post_remove() {
- post_install
-}
Copied: akonadi/repos/testing-x86_64/akonadi.install (from rev 241406, akonadi/trunk/akonadi.install)
===================================================================
--- testing-x86_64/akonadi.install (rev 0)
+++ testing-x86_64/akonadi.install 2015-06-30 03:35:20 UTC (rev 241407)
@@ -0,0 +1,11 @@
+post_install() {
+ update-mime-database usr/share/mime &> /dev/null
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ post_install
+}
Copied: akonadi/repos/testing-x86_64/dont-leak-old-external-payload-files.patch (from rev 241406, akonadi/trunk/dont-leak-old-external-payload-files.patch)
===================================================================
--- testing-x86_64/dont-leak-old-external-payload-files.patch (rev 0)
+++ testing-x86_64/dont-leak-old-external-payload-files.patch 2015-06-30 03:35:20 UTC (rev 241407)
@@ -0,0 +1,135 @@
+From: Dan Vrátil <dvratil at redhat.com>
+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<qint64>("expectedPartSize");
+ QTest::addColumn<bool>("expectedChanged");
+ QTest::addColumn<bool>("isExternal");
++ QTest::addColumn<int>("version");
+ QTest::addColumn<PimItem>("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<Part> 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<Akonadi::Server::Response>();
+ 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));
+
More information about the arch-commits
mailing list