Merge lp:~abreu-alexandre/click/clean-trust-dbs-on-package-removal into lp:click

Proposed by Alexandre Abreu on 2016-07-07
Status: Needs review
Proposed branch: lp:~abreu-alexandre/click/clean-trust-dbs-on-package-removal
Merge into: lp:click
Diff against target: 71 lines (+55/-0)
1 file modified
pk-plugin/pk-plugin-click.c (+55/-0)
To merge this branch: bzr merge lp:~abreu-alexandre/click/clean-trust-dbs-on-package-removal
Reviewer Review Type Date Requested Status
Colin Watson 2016-07-07 Approve on 2016-07-08
Review via email: mp+299459@code.launchpad.net

Commit message

Clean the trust DB store for the location service as click apps are being removed. This is not an optimal solution and is rather static but will work until click becomes deprecated.

Description of the change

Clean the trust DB store for the location service as click apps are being removed. This is not an optimal solution and is rather static but will work until click becomes deprecated.

To post a comment you must log in.
Colin Watson (cjwatson) :
review: Needs Fixing
609. By Alexandre Abreu on 2016-07-07

Tweaks

Alexandre Abreu (abreu-alexandre) wrote :

udated

Colin Watson (cjwatson) wrote :

Looks good now provided that mentions of click_stderr in this diff are removed properly.

review: Approve
610. By Alexandre Abreu on 2016-07-08

remove unused error vars

611. By Alexandre Abreu on 2016-07-11

Cleanup all trust store DBs

Unmerged revisions

611. By Alexandre Abreu on 2016-07-11

Cleanup all trust store DBs

610. By Alexandre Abreu on 2016-07-08

remove unused error vars

609. By Alexandre Abreu on 2016-07-07

Tweaks

608. By Alexandre Abreu on 2016-07-07

Fix purge command line

607. By David Barth on 2016-07-07

add function to purge trust-store dbs (prototype stage)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pk-plugin/pk-plugin-click.c'
2--- pk-plugin/pk-plugin-click.c 2014-10-08 13:58:34 +0000
3+++ pk-plugin/pk-plugin-click.c 2016-07-11 14:36:50 +0000
4@@ -623,6 +623,58 @@
5 json_array_unref (array);
6 }
7
8+/* Fix for #1586737 - [CTA]privacies/permissions are not removed after the app
9+ has been uninstalled
10+*/
11+
12+static void
13+trust_db_purge_for_service (const gchar *package_id, const gchar *service_name)
14+{
15+ gchar **argv = NULL;
16+ gint i;
17+ gchar **envp = NULL;
18+
19+ argv = g_malloc0_n (6, sizeof (*argv));
20+ i = 0;
21+
22+ argv[i++] = g_strdup ("trust-store-cleaner");
23+ argv[i++] = g_strdup ("--for-service");
24+ argv[i++] = g_strdup (service_name);
25+ argv[i++] = g_strdup ("--purge");
26+ argv[i++] = g_strdup (package_id);
27+
28+ /* TODO: iterate over each well-known trust store services */
29+ envp = click_get_envp ();
30+ g_spawn_sync (NULL, argv, envp,
31+ G_SPAWN_SEARCH_PATH
32+ | G_SPAWN_STDOUT_TO_DEV_NULL
33+ | G_SPAWN_STDERR_TO_DEV_NULL,
34+ NULL, NULL, NULL,
35+ NULL, NULL, NULL);
36+ /* Note: we ignore errors, as we don't want the uninstall to fail for that reason */
37+
38+ g_strfreev (argv);
39+ g_strfreev (envp);
40+}
41+
42+static void
43+trust_db_purge(const gchar *package_id)
44+{
45+ static gchar* service_names[] = {
46+ "UbuntuLocationService",
47+ "CameraService",
48+ "PulseAudio",
49+ "InAppPurchases"
50+ };
51+ int i;
52+
53+ for (i = 0;
54+ i < sizeof(service_names) / sizeof(service_names[0]);
55+ ++i) {
56+ trust_db_purge_for_service(package_id, service_names[i]);
57+ }
58+}
59+
60 static gboolean
61 click_remove_package (PkPlugin *plugin, PkTransaction *transaction,
62 const gchar *package_id)
63@@ -702,6 +754,9 @@
64 summary, error->message);
65 goto out;
66 }
67+
68+ trust_db_purge (package_id);
69+
70 /* TODO: remove data? */
71 ret = TRUE;
72

Subscribers

People subscribed via source and target branches

to all changes: