[gnome-software/gnome-3-20] Correctly trigger systemd offline updates when only processing OS updates
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-20] Correctly trigger systemd offline updates when only processing OS updates
- Date: Tue, 24 May 2016 12:57:55 +0000 (UTC)
commit 857225438d44a17dc68efab4d6768081c37b01c5
Author: Richard Hughes <richard hughsie com>
Date: Tue May 24 10:51:08 2016 +0100
Correctly trigger systemd offline updates when only processing OS updates
The 'OS Updates' object is a virtual update that contains the actual
package-backed GsApp's as related packages. As such, we need to look at the
related packages for each update as well as the applications themselves when
working out if we need to set up the trigger action.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1337336
src/plugins/gs-plugin-systemd-updates.c | 36 +++++++++++++++++++++++++-----
1 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/gs-plugin-systemd-updates.c b/src/plugins/gs-plugin-systemd-updates.c
index e433ca2..b46b8d9 100644
--- a/src/plugins/gs-plugin-systemd-updates.c
+++ b/src/plugins/gs-plugin-systemd-updates.c
@@ -139,6 +139,32 @@ gs_plugin_add_updates (GsPlugin *plugin,
return TRUE;
}
+static gboolean
+gs_plugin_systemd_updates_requires_trigger (GsApp *app)
+{
+ GPtrArray *related;
+ guint i;
+
+ /* look at related apps too */
+ related = gs_app_get_related (app);
+ for (i = 0; i < related->len; i++) {
+ GsApp *app_tmp = g_ptr_array_index (related, i);
+ if (gs_plugin_systemd_updates_requires_trigger (app_tmp))
+ return TRUE;
+ }
+
+ /* if we can process this online do not require a trigger */
+ if (gs_app_get_state (app) != AS_APP_STATE_UPDATABLE)
+ return FALSE;
+
+ /* only process this app if was created by this plugin */
+ if (g_strcmp0 (gs_app_get_management_plugin (app), "packagekit") != 0)
+ return FALSE;
+
+ /* success! */
+ return TRUE;
+}
+
/**
* gs_plugin_offline_update:
*/
@@ -153,12 +179,10 @@ gs_plugin_offline_update (GsPlugin *plugin,
/* any apps to process offline */
for (l = apps; l != NULL; l = l->next) {
GsApp *app = GS_APP (l->data);
-
- /* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app), "packagekit") != 0)
- continue;
- return pk_offline_trigger (PK_OFFLINE_ACTION_REBOOT,
- cancellable, error);
+ if (gs_plugin_systemd_updates_requires_trigger (app)) {
+ return pk_offline_trigger (PK_OFFLINE_ACTION_REBOOT,
+ cancellable, error);
+ }
}
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]