Merge lp:~online-accounts/libaccounts-glib/packaging into lp:libaccounts-glib

Proposed by Alberto Mardegan on 2016-05-06
Status: Merged
Approved by: David Barth on 2016-05-31
Approved revision: no longer in the source branch.
Merged at revision: 196
Proposed branch: lp:~online-accounts/libaccounts-glib/packaging
Merge into: lp:libaccounts-glib
Diff against target: 543 lines (+145/-108)
9 files modified
.gitlab-ci.yml (+51/-0)
NEWS (+7/-0)
README.md (+12/-2)
configure.ac (+2/-2)
debian/changelog (+9/-0)
libaccounts-glib/ag-account.c (+19/-38)
libaccounts-glib/ag-internals.h (+3/-5)
libaccounts-glib/ag-manager.c (+41/-60)
m4/gcov.m4 (+1/-1)
To merge this branch: bzr merge lp:~online-accounts/libaccounts-glib/packaging
Reviewer Review Type Date Requested Status
Online Accounts 2016-05-06 Pending
Review via email: mp+294013@code.launchpad.net

Description of the change

Migrate to GTask

To post a comment you must log in.
196. By Alberto Mardegan on 2016-05-20

Migrate to GTask Fixes: #1451728

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.gitlab-ci.yml'
2--- .gitlab-ci.yml 1970-01-01 00:00:00 +0000
3+++ .gitlab-ci.yml 2016-05-20 08:55:52 +0000
4@@ -0,0 +1,51 @@
5+image: ubuntu:xenial
6+
7+cache:
8+ key: apt-cache
9+ paths:
10+ - apt-cache/
11+
12+before_script:
13+ - export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR
14+ - apt-get update -yq && apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -yq automake autotools-dev gobject-introspection gtk-doc-tools intltool libgirepository1.0-dev libglib2.0-dev libsqlite3-dev libtool libxml2-dev libxml2-utils python3 python3-gi python-gi-dev
15+ - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -yq check dbus-test-runner lcov gcovr
16+ - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -yq sudo
17+ - useradd -m tester
18+ - adduser tester sudo
19+
20+build_amd64:
21+ stage: build
22+ script:
23+ - export PYTHON=python3
24+ - mkdir build
25+ - cd build
26+ - ../autogen.sh --enable-gtk-doc --enable-gcov --enable-debug --enable-python --disable-wal
27+ - make -j 4
28+ artifacts:
29+ paths:
30+ - ./
31+
32+test_amd64:
33+ stage: test
34+ script:
35+ - cd build
36+ - chmod a+rw -R .
37+ - sudo -u tester make check || (cat tests/test-suite.log && /bin/false)
38+ - sudo -u tester make coverage-html
39+ dependencies:
40+ - build_amd64
41+ artifacts:
42+ paths:
43+ - ./
44+
45+pages:
46+ stage: deploy
47+ script:
48+ - mkdir public
49+ - cp -a build/coveragereport public/coverage
50+ - cp -a build/docs/reference/html/* public/
51+ dependencies:
52+ - test_amd64
53+ artifacts:
54+ paths:
55+ - public
56
57=== modified file 'NEWS'
58--- NEWS 2016-02-19 09:42:37 +0000
59+++ NEWS 2016-05-20 08:55:52 +0000
60@@ -1,5 +1,12 @@
61 libaccounts-glib NEWS
62
63+Version 1.22
64+------------
65+
66+* Lib: migrate to GTask
67+* Build: enable CI in gitlab
68+* Build: add support for lcov 1.12
69+
70 Version 1.21
71 ------------
72
73
74=== modified file 'README.md'
75--- README.md 2015-09-11 15:07:12 +0000
76+++ README.md 2016-05-20 08:55:52 +0000
77@@ -2,7 +2,7 @@
78 =================================================
79
80 This project is a library for managing accounts which can be used from GLib
81-applications. It is part of the @accounts-sso project.
82+applications. It is part of the [accounts-sso project][accounts-sso].
83
84
85 License
86@@ -15,7 +15,7 @@
87 ------------------
88
89 The project depends on GLib (including GIO and GObject), libxml2, sqlite3 and
90-check.
91+[check][].
92 To build it, run:
93 ```
94 ./autogen.sh
95@@ -23,3 +23,13 @@
96 make
97 make install
98 ```
99+
100+Resources
101+---------
102+
103+[API reference documentation](http://accounts-sso.gitlab.io/libaccounts-glib/)
104+
105+[Official source code repository](https://gitlab.com/accounts-sso/libaccounts-glib)
106+
107+[accounts-sso]: https://gitlab.com/groups/accounts-sso
108+[check]: https://github.com/libcheck/check
109
110=== modified file 'configure.ac'
111--- configure.ac 2016-02-19 09:42:37 +0000
112+++ configure.ac 2016-05-20 08:55:52 +0000
113@@ -1,7 +1,7 @@
114 dnl Process this file with autoconf to produce a configure script.
115 AC_PREREQ([2.64])
116 AC_INIT([libaccounts-glib],
117- [1.21],
118+ [1.22],
119 [https://gitlab.com/accounts-sso/libaccounts-glib/issues],
120 [libaccounts-glib],
121 [https://gitlab.com/accounts-sso/libaccounts-glib])
122@@ -25,7 +25,7 @@
123 GOBJECT_INTROSPECTION_CHECK([1.30.0])
124
125 LIBACCOUNTS_REQUIRED="glib-2.0 >= 2.26
126- gio-2.0 >= 2.30
127+ gio-2.0 >= 2.36
128 gio-unix-2.0
129 gobject-2.0 >= 2.35.1
130 libxml-2.0
131
132=== modified file 'debian/changelog'
133--- debian/changelog 2016-02-22 09:12:59 +0000
134+++ debian/changelog 2016-05-20 08:55:52 +0000
135@@ -1,3 +1,12 @@
136+libaccounts-glib (1.22-0ubuntu1) UNRELEASED; urgency=medium
137+
138+ * New upstream release
139+ - Lib: migrate to GTask (LP: #1577373)
140+ - Build: enable CI in gitlab
141+ - Build: add support for lcov 1.12
142+
143+ -- Alberto Mardegan <alberto.mardegan@canonical.com> Fri, 20 May 2016 11:54:22 +0300
144+
145 libaccounts-glib (1.21+16.04.20160222-0ubuntu1) xenial; urgency=medium
146
147 [ Alberto Mardegan ]
148
149=== modified file 'libaccounts-glib/ag-account.c'
150--- libaccounts-glib/ag-account.c 2015-12-18 15:16:14 +0000
151+++ libaccounts-glib/ag-account.c 2016-05-20 08:55:52 +0000
152@@ -4,7 +4,7 @@
153 * This file is part of libaccounts-glib
154 *
155 * Copyright (C) 2009-2010 Nokia Corporation.
156- * Copyright (C) 2012 Canonical Ltd.
157+ * Copyright (C) 2012-2016 Canonical Ltd.
158 *
159 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
160 *
161@@ -185,8 +185,8 @@
162 */
163 GHashTable *changes_for_watches;
164
165- /* GSimpleAsyncResult for the ag_account_store_async operation. */
166- GSimpleAsyncResult *store_async_result;
167+ /* GTask for the ag_account_store_async operation. */
168+ GTask *store_task;
169
170 /* The "foreign" flag means that the account has been created by another
171 * instance and we got informed about it from D-Bus. In this case, all the
172@@ -697,10 +697,7 @@
173 {
174 AgAccountPrivate *priv = account->priv;
175
176-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
177- g_simple_async_result_complete_in_idle (priv->store_async_result);
178-G_GNUC_END_IGNORE_DEPRECATIONS
179- g_clear_object (&priv->store_async_result);
180+ g_clear_object (&priv->store_task);
181
182 _ag_account_changes_free (changes);
183 }
184@@ -2486,43 +2483,32 @@
185 g_return_if_fail (AG_IS_ACCOUNT (account));
186 priv = account->priv;
187
188- if (G_UNLIKELY (priv->store_async_result != NULL))
189+ if (G_UNLIKELY (priv->store_task != NULL))
190 {
191 g_critical ("ag_account_store_async called again before completion");
192-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
193- g_simple_async_report_error_in_idle ((GObject *)account,
194- callback, user_data,
195- AG_ACCOUNTS_ERROR,
196- AG_ACCOUNTS_ERROR_STORE_IN_PROGRESS,
197- "Store operation already "
198- "in progress");
199-G_GNUC_END_IGNORE_DEPRECATIONS
200+ g_task_report_new_error (account,
201+ callback, user_data,
202+ ag_account_store_async,
203+ AG_ACCOUNTS_ERROR,
204+ AG_ACCOUNTS_ERROR_STORE_IN_PROGRESS,
205+ "Store operation already in progress");
206 return;
207 }
208
209-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
210- priv->store_async_result =
211- g_simple_async_result_new ((GObject *)account,
212- callback, user_data,
213- ag_account_store_async);
214- g_simple_async_result_set_check_cancellable (priv->store_async_result,
215- cancellable);
216-G_GNUC_END_IGNORE_DEPRECATIONS
217- g_object_add_weak_pointer ((GObject *)priv->store_async_result,
218- (gpointer *)&priv->store_async_result);
219+ priv->store_task =
220+ g_task_new (account, cancellable, callback, user_data);
221+ g_object_add_weak_pointer ((GObject *)priv->store_task,
222+ (gpointer *)&priv->store_task);
223
224 if (G_UNLIKELY (priv->changes == NULL))
225 {
226 /* Nothing to do: invoke the callback immediately */
227-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
228- g_simple_async_result_complete_in_idle (priv->store_async_result);
229-G_GNUC_END_IGNORE_DEPRECATIONS
230- g_clear_object (&priv->store_async_result);
231+ g_task_return_boolean (priv->store_task, TRUE);
232+ g_clear_object (&priv->store_task);
233 return;
234 }
235
236- _ag_manager_store_async (priv->manager, account,
237- priv->store_async_result, cancellable);
238+ _ag_manager_store_async (priv->manager, account, priv->store_task);
239 }
240
241 /**
242@@ -2542,14 +2528,9 @@
243 ag_account_store_finish (AgAccount *account, GAsyncResult *res,
244 GError **error)
245 {
246- GSimpleAsyncResult *async_result;
247-
248 g_return_val_if_fail (AG_IS_ACCOUNT (account), FALSE);
249
250- async_result = (GSimpleAsyncResult *)res;
251-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
252- return !g_simple_async_result_propagate_error (async_result, error);
253-G_GNUC_END_IGNORE_DEPRECATIONS
254+ return g_task_propagate_boolean (G_TASK (res), error);
255 }
256
257 /**
258
259=== modified file 'libaccounts-glib/ag-internals.h'
260--- libaccounts-glib/ag-internals.h 2013-12-23 15:22:56 +0000
261+++ libaccounts-glib/ag-internals.h 2016-05-20 08:55:52 +0000
262@@ -4,7 +4,7 @@
263 * This file is part of libaccounts-glib
264 *
265 * Copyright (C) 2009-2010 Nokia Corporation.
266- * Copyright (C) 2012-2013 Canonical Ltd.
267+ * Copyright (C) 2012-2016 Canonical Ltd.
268 * Copyright (C) 2012 Intel Corporation.
269 *
270 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
271@@ -95,8 +95,7 @@
272 void _ag_manager_exec_transaction (AgManager *manager, const gchar *sql,
273 AgAccountChanges *changes,
274 AgAccount *account,
275- GSimpleAsyncResult *async_result,
276- GCancellable *cancellable);
277+ GTask *task);
278
279 typedef gboolean (*AgQueryCallback) (sqlite3_stmt *stmt, gpointer user_data);
280
281@@ -125,8 +124,7 @@
282
283 G_GNUC_INTERNAL
284 void _ag_manager_store_async (AgManager *manager, AgAccount *account,
285- GSimpleAsyncResult *async_result,
286- GCancellable *cancellable);
287+ GTask *task);
288 G_GNUC_INTERNAL
289 gboolean _ag_manager_store_sync (AgManager *manager, AgAccount *account,
290 GError **error);
291
292=== modified file 'libaccounts-glib/ag-manager.c'
293--- libaccounts-glib/ag-manager.c 2016-02-18 19:37:45 +0000
294+++ libaccounts-glib/ag-manager.c 2016-05-20 08:55:52 +0000
295@@ -4,7 +4,7 @@
296 * This file is part of libaccounts-glib
297 *
298 * Copyright (C) 2009-2010 Nokia Corporation.
299- * Copyright (C) 2012-2013 Canonical Ltd.
300+ * Copyright (C) 2012-2016 Canonical Ltd.
301 * Copyright (C) 2012 Intel Corporation.
302 *
303 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
304@@ -148,8 +148,7 @@
305 gchar *sql;
306 AgAccountChanges *changes;
307 guint id;
308- GSimpleAsyncResult *async_result;
309- GCancellable *cancellable;
310+ GTask *task;
311 } StoreCbData;
312
313 typedef struct {
314@@ -183,27 +182,23 @@
315 gpointer user_data)
316 {
317 GDBusConnection *conn = G_DBUS_CONNECTION (object);
318- GSimpleAsyncResult *async_result = user_data;
319+ GTask *task = user_data;
320 GVariant *result;
321 GError *error_int = NULL;
322
323-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
324 result = g_dbus_connection_call_finish (conn, res, &error_int);
325 if (G_UNLIKELY (error_int))
326 {
327 /* We always report a read-only error here */
328- GError error = {
329- AG_ACCOUNTS_ERROR,
330- AG_ACCOUNTS_ERROR_READONLY,
331- error_int->message
332- };
333- g_simple_async_result_set_from_error (async_result, &error);
334+ g_task_return_new_error (task,
335+ AG_ACCOUNTS_ERROR,
336+ AG_ACCOUNTS_ERROR_READONLY,
337+ "%s", error_int->message);
338 g_error_free (error_int);
339 }
340 else
341 {
342- GObject *source =
343- g_async_result_get_source_object ((GAsyncResult *)async_result);
344+ GObject *source = g_task_get_source_object (task);
345 AgAccount *account = AG_ACCOUNT (source);
346 /* If this was a new account, we must update the local data
347 * structure */
348@@ -213,42 +208,37 @@
349 AgAccountChanges *changes;
350
351 g_variant_get_child (result, 0, "u", &account->id);
352- changes = g_object_get_data ((GObject *)async_result,
353+ changes = g_object_get_data ((GObject *)task,
354 key_remote_changes);
355 _ag_account_done_changes (account, changes);
356 }
357 g_variant_unref (result);
358+ g_task_return_boolean (task, TRUE);
359 }
360
361- g_simple_async_result_complete_in_idle (async_result);
362- g_object_unref (async_result);
363-G_GNUC_END_IGNORE_DEPRECATIONS
364+ g_object_unref (task);
365 }
366
367 static void
368 ag_manager_store_dbus_async (AgManager *manager, AgAccount *account,
369- GSimpleAsyncResult *async_result,
370- GCancellable *cancellable)
371+ GTask *task)
372 {
373 AgManagerPrivate *priv = manager->priv;
374 AgAccountChanges *changes;
375 GVariant *dbus_changes;
376
377 if (G_UNLIKELY (!priv->use_dbus)) {
378-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
379- g_simple_async_result_set_error (async_result,
380- AG_ACCOUNTS_ERROR,
381- AG_ACCOUNTS_ERROR_READONLY,
382- "DB read-only and D-Bus disabled");
383- g_simple_async_result_complete_in_idle (async_result);
384-G_GNUC_END_IGNORE_DEPRECATIONS
385- g_object_unref (async_result);
386+ g_task_return_new_error (task,
387+ AG_ACCOUNTS_ERROR,
388+ AG_ACCOUNTS_ERROR_READONLY,
389+ "DB read-only and D-Bus disabled");
390+ g_object_unref (task);
391 return;
392 }
393
394 changes = _ag_account_steal_changes (account);
395 dbus_changes = _ag_account_build_dbus_changes (account, changes, NULL);
396- g_object_set_data_full ((GObject *)async_result,
397+ g_object_set_data_full ((GObject *)task,
398 key_remote_changes, changes,
399 (GDestroyNotify) _ag_account_changes_free);
400
401@@ -261,9 +251,9 @@
402 NULL,
403 G_DBUS_CALL_FLAGS_NONE,
404 -1,
405- cancellable,
406+ g_task_get_cancellable (task),
407 (GAsyncReadyCallback)on_dbus_store_done,
408- async_result);
409+ task);
410 }
411
412 static gboolean
413@@ -1095,11 +1085,9 @@
414 g_object_ref (account);
415
416 /* If the operation was cancelled, abort it. */
417- if (sd->cancellable != NULL)
418+ if (g_task_return_error_if_cancelled (sd->task))
419 {
420- g_cancellable_set_error_if_cancelled (sd->cancellable, &error);
421- if (error != NULL)
422- goto finish;
423+ goto finish;
424 }
425
426 g_return_val_if_fail (priv->begin_stmt != NULL, FALSE);
427@@ -1125,9 +1113,11 @@
428 finish:
429 if (error != NULL)
430 {
431-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
432- g_simple_async_result_take_error (sd->async_result, error);
433-G_GNUC_END_IGNORE_DEPRECATIONS
434+ g_task_return_error (sd->task, error);
435+ }
436+ else
437+ {
438+ g_task_return_boolean (sd->task, TRUE);
439 }
440
441 _ag_account_store_completed (account, sd->changes);
442@@ -2390,8 +2380,7 @@
443 void
444 _ag_manager_exec_transaction (AgManager *manager, const gchar *sql,
445 AgAccountChanges *changes, AgAccount *account,
446- GSimpleAsyncResult *async_result,
447- GCancellable *cancellable)
448+ GTask *task)
449 {
450 AgManagerPrivate *priv = manager->priv;
451 GError *error = NULL;
452@@ -2413,8 +2402,7 @@
453 sd->manager = manager;
454 sd->account = account;
455 sd->changes = changes;
456- sd->async_result = async_result;
457- sd->cancellable = cancellable;
458+ sd->task = task;
459 sd->sql = g_strdup (sql);
460 sd->id = g_idle_add ((GSourceFunc)exec_transaction_idle, sd);
461 priv->locks = g_list_prepend (priv->locks, sd);
462@@ -2432,9 +2420,11 @@
463 finish:
464 if (error != NULL)
465 {
466-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
467- g_simple_async_result_take_error (async_result, error);
468-G_GNUC_END_IGNORE_DEPRECATIONS
469+ g_task_return_error (task, error);
470+ }
471+ else
472+ {
473+ g_task_return_boolean (task, TRUE);
474 }
475
476 _ag_account_store_completed (account, changes);
477@@ -2485,8 +2475,7 @@
478
479 static void
480 ag_manager_store_local_async (AgManager *manager, AgAccount *account,
481- GSimpleAsyncResult *async_result,
482- GCancellable *cancellable)
483+ GTask *task)
484 {
485 AgAccountChanges *changes;
486 GError *error = NULL;
487@@ -2495,19 +2484,14 @@
488 sql = _ag_account_get_store_sql (account, &error);
489 if (G_UNLIKELY (error))
490 {
491-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
492- g_simple_async_result_take_error (async_result,
493- error);
494- g_simple_async_result_complete_in_idle (async_result);
495-G_GNUC_END_IGNORE_DEPRECATIONS
496- g_object_unref (async_result);
497+ g_task_return_error (task, error);
498+ g_object_unref (task);
499 return;
500 }
501
502 changes = _ag_account_steal_changes (account);
503
504- _ag_manager_exec_transaction (manager, sql, changes, account,
505- async_result, cancellable);
506+ _ag_manager_exec_transaction (manager, sql, changes, account, task);
507 g_free (sql);
508 }
509
510@@ -2547,18 +2531,15 @@
511
512 void
513 _ag_manager_store_async (AgManager *manager, AgAccount *account,
514- GSimpleAsyncResult *async_result,
515- GCancellable *cancellable)
516+ GTask *task)
517 {
518 if (manager->priv->is_readonly)
519 {
520- ag_manager_store_dbus_async (manager, account, async_result,
521- cancellable);
522+ ag_manager_store_dbus_async (manager, account, task);
523 }
524 else
525 {
526- ag_manager_store_local_async (manager, account, async_result,
527- cancellable);
528+ ag_manager_store_local_async (manager, account, task);
529 }
530 }
531
532
533=== modified file 'm4/gcov.m4'
534--- m4/gcov.m4 2015-07-09 10:16:42 +0000
535+++ m4/gcov.m4 2016-05-20 08:55:52 +0000
536@@ -46,7 +46,7 @@
537 AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
538 fi
539
540- lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11"
541+ lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11 1.12"
542 AC_CHECK_PROG(LCOV, lcov, lcov)
543 AC_CHECK_PROG(GENHTML, genhtml, genhtml)
544

Subscribers

No one subscribed via source and target branches