1 |
commit: 3ea5b36d1fa41f02a87828cd8e674110dee3f18c |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Apr 3 10:30:34 2019 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Apr 3 12:02:32 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ea5b36d |
7 |
|
8 |
kde-apps/akonadi: Fix a regression when updating attributes |
9 |
|
10 |
Major regression forcing mail to be re-downloaded all the time at every mail |
11 |
check, hogging the akonadi server and leading to deadlocks and other issues. |
12 |
|
13 |
Package-Manager: Portage-2.3.62, Repoman-2.3.12 |
14 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
15 |
|
16 |
kde-apps/akonadi/akonadi-18.12.3-r1.ebuild | 117 +++++++++++++++++++++ |
17 |
...lection-detach-at-wrong-time-in-attribute.patch | 97 +++++++++++++++++ |
18 |
...12.3-major-regression-updating-attributes.patch | 55 ++++++++++ |
19 |
3 files changed, 269 insertions(+) |
20 |
|
21 |
diff --git a/kde-apps/akonadi/akonadi-18.12.3-r1.ebuild b/kde-apps/akonadi/akonadi-18.12.3-r1.ebuild |
22 |
new file mode 100644 |
23 |
index 00000000000..8b3713c95d8 |
24 |
--- /dev/null |
25 |
+++ b/kde-apps/akonadi/akonadi-18.12.3-r1.ebuild |
26 |
@@ -0,0 +1,117 @@ |
27 |
+# Copyright 1999-2019 Gentoo Authors |
28 |
+# Distributed under the terms of the GNU General Public License v2 |
29 |
+ |
30 |
+EAPI=7 |
31 |
+ |
32 |
+KDE_DESIGNERPLUGIN="true" |
33 |
+KDE_TEST="forceoptional" |
34 |
+VIRTUALDBUS_TEST="true" |
35 |
+VIRTUALX_REQUIRED="test" |
36 |
+inherit kde5 |
37 |
+ |
38 |
+DESCRIPTION="Storage service for PIM data and libraries for PIM apps" |
39 |
+HOMEPAGE="https://community.kde.org/KDE_PIM/akonadi" |
40 |
+ |
41 |
+KEYWORDS="~amd64 ~arm ~arm64 ~x86" |
42 |
+LICENSE="LGPL-2.1+" |
43 |
+IUSE="+mysql postgres sqlite tools xml" |
44 |
+ |
45 |
+REQUIRED_USE="|| ( mysql postgres sqlite ) test? ( tools )" |
46 |
+ |
47 |
+COMMON_DEPEND=" |
48 |
+ $(add_frameworks_dep kcompletion) |
49 |
+ $(add_frameworks_dep kconfig) |
50 |
+ $(add_frameworks_dep kconfigwidgets) |
51 |
+ $(add_frameworks_dep kcoreaddons) |
52 |
+ $(add_frameworks_dep kcrash) |
53 |
+ $(add_frameworks_dep kdbusaddons) |
54 |
+ $(add_frameworks_dep ki18n) |
55 |
+ $(add_frameworks_dep kiconthemes) |
56 |
+ $(add_frameworks_dep kio) |
57 |
+ $(add_frameworks_dep kitemmodels) |
58 |
+ $(add_frameworks_dep kitemviews) |
59 |
+ $(add_frameworks_dep kwidgetsaddons) |
60 |
+ $(add_frameworks_dep kwindowsystem) |
61 |
+ $(add_frameworks_dep kxmlgui) |
62 |
+ $(add_qt_dep qtdbus) |
63 |
+ $(add_qt_dep qtgui) |
64 |
+ $(add_qt_dep qtnetwork) |
65 |
+ $(add_qt_dep qtsql 'mysql?,postgres?') |
66 |
+ $(add_qt_dep qtwidgets) |
67 |
+ $(add_qt_dep qtxml) |
68 |
+ sqlite? ( |
69 |
+ $(add_qt_dep qtsql 'sqlite' '' '5=') |
70 |
+ dev-db/sqlite:3 |
71 |
+ ) |
72 |
+ xml? ( dev-libs/libxml2 ) |
73 |
+" |
74 |
+DEPEND="${COMMON_DEPEND} |
75 |
+ dev-libs/boost |
76 |
+ dev-libs/libxslt |
77 |
+ test? ( sys-apps/dbus ) |
78 |
+" |
79 |
+RDEPEND="${COMMON_DEPEND} |
80 |
+ !kde-apps/akonadi:4 |
81 |
+ !<kde-apps/kapptemplate-17.11.80 |
82 |
+ !kde-apps/kdepim-l10n |
83 |
+ !kde-apps/kdepimlibs |
84 |
+ mysql? ( virtual/mysql ) |
85 |
+ postgres? ( dev-db/postgresql ) |
86 |
+" |
87 |
+ |
88 |
+# some akonadi tests time out, that probably needs more work as it's ~700 tests |
89 |
+RESTRICT+=" test" |
90 |
+ |
91 |
+PATCHES=( |
92 |
+ "${FILESDIR}/${PN}-18.12.2-mysql56-crash.patch" |
93 |
+ "${FILESDIR}/${P}-major-regression-updating-attributes.patch" |
94 |
+ "${FILESDIR}/${P}-collection-detach-at-wrong-time-in-attribute.patch" |
95 |
+) |
96 |
+ |
97 |
+pkg_setup() { |
98 |
+ # Set default storage backend in order: MySQL, PostgreSQL, SQLite |
99 |
+ # reverse driver check to keep the order |
100 |
+ use sqlite && DRIVER="QSQLITE3" |
101 |
+ use postgres && DRIVER="QPSQL" |
102 |
+ use mysql && DRIVER="QMYSQL" |
103 |
+ |
104 |
+ if use sqlite || has_version "<${CATEGORY}/${P}[sqlite]"; then |
105 |
+ ewarn "We strongly recommend you change your Akonadi database backend to either MySQL" |
106 |
+ ewarn "or PostgreSQL in your user configuration." |
107 |
+ ewarn "In particular, kde-apps/kmail does not work properly with the sqlite backend." |
108 |
+ fi |
109 |
+ |
110 |
+ kde5_pkg_setup |
111 |
+} |
112 |
+ |
113 |
+src_configure() { |
114 |
+ local mycmakeargs=( |
115 |
+ -DAKONADI_BUILD_QSQLITE=$(usex sqlite) |
116 |
+ -DBUILD_TOOLS=$(usex tools) |
117 |
+ $(cmake-utils_use_find_package xml LibXml2) |
118 |
+ ) |
119 |
+ |
120 |
+ kde5_src_configure |
121 |
+} |
122 |
+ |
123 |
+src_install() { |
124 |
+ # Who knows, maybe it accidentally fixes our permission issues |
125 |
+ cat <<-EOF > "${T}"/akonadiserverrc |
126 |
+[%General] |
127 |
+Driver=${DRIVER} |
128 |
+EOF |
129 |
+ insinto /usr/share/config/akonadi |
130 |
+ doins "${T}"/akonadiserverrc |
131 |
+ |
132 |
+ kde5_src_install |
133 |
+} |
134 |
+ |
135 |
+pkg_postinst() { |
136 |
+ kde5_pkg_postinst |
137 |
+ elog "You can select the storage backend in ~/.config/akonadi/akonadiserverrc." |
138 |
+ elog "Available drivers are:" |
139 |
+ use mysql && elog " QMYSQL" |
140 |
+ use postgres && elog " QPSQL" |
141 |
+ use sqlite && elog " QSQLITE3" |
142 |
+ elog "${DRIVER} has been set as your default akonadi storage backend." |
143 |
+} |
144 |
|
145 |
diff --git a/kde-apps/akonadi/files/akonadi-18.12.3-collection-detach-at-wrong-time-in-attribute.patch b/kde-apps/akonadi/files/akonadi-18.12.3-collection-detach-at-wrong-time-in-attribute.patch |
146 |
new file mode 100644 |
147 |
index 00000000000..bee866dc3bc |
148 |
--- /dev/null |
149 |
+++ b/kde-apps/akonadi/files/akonadi-18.12.3-collection-detach-at-wrong-time-in-attribute.patch |
150 |
@@ -0,0 +1,97 @@ |
151 |
+From 53ad3b6d73d92ea289cf0183c10e2b8a35c8127a Mon Sep 17 00:00:00 2001 |
152 |
+From: David Faure <faure@×××.org> |
153 |
+Date: Thu, 21 Mar 2019 23:37:36 +0100 |
154 |
+Subject: Fix collection detaching at the wrong time in attribute() |
155 |
+ |
156 |
+Summary: |
157 |
+Found in FatCRM where changes to collection attributes were not stored |
158 |
+anymore. |
159 |
+ |
160 |
+Test Plan: |
161 |
+New unittest to ensure that we get the attribute from the |
162 |
+detached collection, not from the original one. |
163 |
+ |
164 |
+Reviewers: dvratil |
165 |
+ |
166 |
+Reviewed By: dvratil |
167 |
+ |
168 |
+Subscribers: kde-pim |
169 |
+ |
170 |
+Tags: #kde_pim |
171 |
+ |
172 |
+Differential Revision: https://phabricator.kde.org/D19741 |
173 |
+--- |
174 |
+ autotests/libs/collectionattributetest.cpp | 15 +++++++++++++++ |
175 |
+ autotests/libs/collectionattributetest.h | 1 + |
176 |
+ src/core/collection.h | 8 ++------ |
177 |
+ 3 files changed, 18 insertions(+), 6 deletions(-) |
178 |
+ |
179 |
+diff --git a/autotests/libs/collectionattributetest.cpp b/autotests/libs/collectionattributetest.cpp |
180 |
+index e264a37..9c46561 100644 |
181 |
+--- a/autotests/libs/collectionattributetest.cpp |
182 |
++++ b/autotests/libs/collectionattributetest.cpp |
183 |
+@@ -240,3 +240,18 @@ void CollectionAttributeTest::testCollectionIdentificationAttribute() |
184 |
+ QCOMPARE(parsed.identifier(), id); |
185 |
+ QCOMPARE(parsed.collectionNamespace(), ns); |
186 |
+ } |
187 |
++ |
188 |
++void CollectionAttributeTest::testDetach() |
189 |
++{ |
190 |
++ // GIVEN a collection with an attribute |
191 |
++ Collection col; |
192 |
++ col.attribute<TestAttribute>(Akonadi::Collection::AddIfMissing); |
193 |
++ Collection col2 = col; // and a copy, so that non-const access detaches |
194 |
++ |
195 |
++ // WHEN |
196 |
++ TestAttribute *attr = col2.attribute<TestAttribute>(Akonadi::Collection::AddIfMissing); |
197 |
++ TestAttribute *attr2 = col2.attribute<TestAttribute>(); |
198 |
++ |
199 |
++ // THEN |
200 |
++ QCOMPARE(attr, attr2); |
201 |
++} |
202 |
+diff --git a/autotests/libs/collectionattributetest.h b/autotests/libs/collectionattributetest.h |
203 |
+index 420df78..2afa9eb 100644 |
204 |
+--- a/autotests/libs/collectionattributetest.h |
205 |
++++ b/autotests/libs/collectionattributetest.h |
206 |
+@@ -32,6 +32,7 @@ private Q_SLOTS: |
207 |
+ void testDefaultAttributes(); |
208 |
+ void testCollectionRightsAttribute(); |
209 |
+ void testCollectionIdentificationAttribute(); |
210 |
++ void testDetach(); |
211 |
+ }; |
212 |
+ |
213 |
+ #endif |
214 |
+diff --git a/src/core/collection.h b/src/core/collection.h |
215 |
+index b5a496c..9c19cc9 100644 |
216 |
+--- a/src/core/collection.h |
217 |
++++ b/src/core/collection.h |
218 |
+@@ -565,10 +565,10 @@ inline T *Akonadi::Collection::attribute(Collection::CreateOption option) |
219 |
+ Q_UNUSED(option); |
220 |
+ |
221 |
+ const T dummy; |
222 |
++ markAttributesChanged(); |
223 |
+ if (hasAttribute(dummy.type())) { |
224 |
+ T *attr = dynamic_cast<T *>(attribute(dummy.type())); |
225 |
+ if (attr) { |
226 |
+- markAttributesChanged(); |
227 |
+ return attr; |
228 |
+ } |
229 |
+ //Reuse 5250 |
230 |
+@@ -585,14 +585,10 @@ template <typename T> |
231 |
+ inline T *Akonadi::Collection::attribute() const |
232 |
+ { |
233 |
+ const QByteArray type = T().type(); |
234 |
++ const_cast<Collection*>(this)->markAttributesChanged(); |
235 |
+ if (hasAttribute(type)) { |
236 |
+ T *attr = dynamic_cast<T *>(attribute(type)); |
237 |
+ if (attr) { |
238 |
+- // FIXME: This method returns a non-const pointer, so callers may still modify the |
239 |
+- // attribute. Unfortunately, just making this function return a const pointer and |
240 |
+- // creating a non-const overload does not work, as many users of this function abuse the |
241 |
+- // non-const pointer and modify the attribute even on a const object. |
242 |
+- const_cast<Collection*>(this)->markAttributesChanged(); |
243 |
+ return attr; |
244 |
+ } |
245 |
+ //reuse 5250 |
246 |
+-- |
247 |
+cgit v1.1 |
248 |
|
249 |
diff --git a/kde-apps/akonadi/files/akonadi-18.12.3-major-regression-updating-attributes.patch b/kde-apps/akonadi/files/akonadi-18.12.3-major-regression-updating-attributes.patch |
250 |
new file mode 100644 |
251 |
index 00000000000..c3e62af2d02 |
252 |
--- /dev/null |
253 |
+++ b/kde-apps/akonadi/files/akonadi-18.12.3-major-regression-updating-attributes.patch |
254 |
@@ -0,0 +1,55 @@ |
255 |
+From 1d8851495bcfa6ff5d3fa35882b68fdf68b21a7f Mon Sep 17 00:00:00 2001 |
256 |
+From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <dvratil@×××.org> |
257 |
+Date: Thu, 21 Mar 2019 13:22:58 +0100 |
258 |
+Subject: Fix a regression when updating attributes |
259 |
+ |
260 |
+This fixes a regression introduced in 3a062e6a and 6054e42d where some |
261 |
+attributes were not sent to the Akonadi server in update job even though |
262 |
+they were modified. This was due to a bad API design which returns a |
263 |
+non-const pointer to an attribute from a const method, so callers sometimes |
264 |
+modify the returned attribute on a const object. Since the method itself |
265 |
+is const though, it did not mark the attribute as modified. |
266 |
+ |
267 |
+Proper fix is to introduce a purely const and non-const overloads for |
268 |
+the attribute accessors, unfortunatelly this requires fixing a lot of our code |
269 |
+in many places first to not abuse the non-constness of the returned |
270 |
+attribute. |
271 |
+ |
272 |
+Note that since the code is in an inlined method, all clients should be |
273 |
+recompiled. |
274 |
+ |
275 |
+CCMAIL: faure@×××.org |
276 |
+--- |
277 |
+ src/core/collection.h | 13 +++++++++---- |
278 |
+ 1 file changed, 9 insertions(+), 4 deletions(-) |
279 |
+ |
280 |
+diff --git a/src/core/collection.h b/src/core/collection.h |
281 |
+index 50c0926..b5a496c 100644 |
282 |
+--- a/src/core/collection.h |
283 |
++++ b/src/core/collection.h |
284 |
+@@ -584,14 +584,19 @@ inline T *Akonadi::Collection::attribute(Collection::CreateOption option) |
285 |
+ template <typename T> |
286 |
+ inline T *Akonadi::Collection::attribute() const |
287 |
+ { |
288 |
+- const T dummy; |
289 |
+- if (hasAttribute(dummy.type())) { |
290 |
+- T *attr = dynamic_cast<T *>(attribute(dummy.type())); |
291 |
++ const QByteArray type = T().type(); |
292 |
++ if (hasAttribute(type)) { |
293 |
++ T *attr = dynamic_cast<T *>(attribute(type)); |
294 |
+ if (attr) { |
295 |
++ // FIXME: This method returns a non-const pointer, so callers may still modify the |
296 |
++ // attribute. Unfortunately, just making this function return a const pointer and |
297 |
++ // creating a non-const overload does not work, as many users of this function abuse the |
298 |
++ // non-const pointer and modify the attribute even on a const object. |
299 |
++ const_cast<Collection*>(this)->markAttributesChanged(); |
300 |
+ return attr; |
301 |
+ } |
302 |
+ //reuse 5250 |
303 |
+- qWarning() << "Found attribute of unknown type" << dummy.type() |
304 |
++ qWarning() << "Found attribute of unknown type" << type |
305 |
+ << ". Did you forget to call AttributeFactory::registerAttribute()?"; |
306 |
+ } |
307 |
+ |
308 |
+-- |
309 |
+cgit v1.1 |