[gnome-software/wip/temp/ubuntu-xenial-rebased: 221/329] apt: Update virtual meta-package
- From: Iain Lane <iainl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/temp/ubuntu-xenial-rebased: 221/329] apt: Update virtual meta-package
- Date: Fri, 29 Apr 2016 14:03:55 +0000 (UTC)
commit 0ef670609028f75eb7034196eef7527b836d14ab
Author: William Hua <william hua canonical com>
Date: Tue Apr 12 17:20:35 2016 -0400
apt: Update virtual meta-package
src/plugins/gs-plugin-apt.cc | 51 +++++++++++++++++++++++++++++++++++------
1 files changed, 43 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/gs-plugin-apt.cc b/src/plugins/gs-plugin-apt.cc
index 38e721f..6bba63b 100644
--- a/src/plugins/gs-plugin-apt.cc
+++ b/src/plugins/gs-plugin-apt.cc
@@ -773,15 +773,50 @@ gs_plugin_update_app (GsPlugin *plugin,
GCancellable *cancellable,
GError **error)
{
- if (!app_is_ours (app))
- return TRUE;
+ GPtrArray *apps;
+ GsApp *app_i;
+ guint i;
+ GVariantBuilder builder;
- gs_app_set_state (app, AS_APP_STATE_INSTALLING);
- if (aptd_transaction (plugin, "UpgradePackages", app, NULL, error))
- gs_app_set_state (app, AS_APP_STATE_INSTALLED);
- else {
- gs_app_set_state (app, AS_APP_STATE_UPDATABLE_LIVE);
- return FALSE;
+ if (g_strcmp0 (gs_app_get_id (app), "os-update.virtual") == 0) {
+ apps = gs_app_get_related (app);
+
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("(as)"));
+ g_variant_builder_open (&builder, G_VARIANT_TYPE ("as"));
+
+ gs_app_set_state (app, AS_APP_STATE_INSTALLING);
+
+ for (i = 0; i < apps->len; i++) {
+ app_i = GS_APP (g_ptr_array_index (apps, i));
+ gs_app_set_state (app_i, AS_APP_STATE_INSTALLING);
+ g_variant_builder_add (&builder, "s", gs_app_get_source_default (app_i));
+ }
+
+ g_variant_builder_close (&builder);
+
+ if (aptd_transaction (plugin, "UpgradePackages", app, g_variant_builder_end (&builder),
error)) {
+ gs_app_set_state (app, AS_APP_STATE_INSTALLED);
+
+ for (i = 0; i < apps->len; i++)
+ gs_app_set_state (GS_APP (g_ptr_array_index (apps, i)),
AS_APP_STATE_INSTALLED);
+ } else {
+ gs_app_set_state (app, AS_APP_STATE_UPDATABLE_LIVE);
+
+ for (i = 0; i < apps->len; i++)
+ gs_app_set_state (GS_APP (g_ptr_array_index (apps, i)),
AS_APP_STATE_UPDATABLE_LIVE);
+
+ return FALSE;
+ }
+ } else if (app_is_ours (app)) {
+ gs_app_set_state (app, AS_APP_STATE_INSTALLING);
+
+ if (aptd_transaction (plugin, "UpgradePackages", app, NULL, error))
+ gs_app_set_state (app, AS_APP_STATE_INSTALLED);
+ else {
+ gs_app_set_state (app, AS_APP_STATE_UPDATABLE_LIVE);
+
+ return FALSE;
+ }
}
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]