[gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 237/331] Do a full upgrade only if we have system updates



commit 1e3f6f162184392f4e57e644ad97b6df8e530a59
Author: William Hua <william hua canonical com>
Date:   Thu Apr 14 15:41:38 2016 -0400

    Do a full upgrade only if we have system updates

 src/plugins/gs-plugin-apt.cc |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/gs-plugin-apt.cc b/src/plugins/gs-plugin-apt.cc
index bce74d0..bcefcfa 100644
--- a/src/plugins/gs-plugin-apt.cc
+++ b/src/plugins/gs-plugin-apt.cc
@@ -1028,19 +1028,30 @@ gs_plugin_update (GsPlugin      *plugin,
                  GCancellable  *cancellable,
                  GError       **error)
 {
-       set_list_state (apps, AS_APP_STATE_INSTALLING);
+       GList *i;
+       GsApp *app_i;
 
-       if (aptd_transaction (plugin, "UpgradeSystem", NULL, apps, g_variant_new_parsed ("(true,)"), error)) {
-               set_list_state (apps, AS_APP_STATE_INSTALLED);
+       for (i = apps; i != NULL; i = i->next) {
+               app_i = GS_APP (i->data);
 
-               unload_apt_db (plugin);
+               if (g_strcmp0 (gs_app_get_id (app_i), "os-update.virtual") == 0) {
+                       set_list_state (apps, AS_APP_STATE_INSTALLING);
 
-               return TRUE;
-       } else {
-               set_list_state (apps, AS_APP_STATE_UPDATABLE_LIVE);
+                       if (aptd_transaction (plugin, "UpgradeSystem", NULL, apps, g_variant_new_parsed 
("(true,)"), error)) {
+                               set_list_state (apps, AS_APP_STATE_INSTALLED);
 
-               return FALSE;
+                               unload_apt_db (plugin);
+
+                               return TRUE;
+                       } else {
+                               set_list_state (apps, AS_APP_STATE_UPDATABLE_LIVE);
+
+                               return FALSE;
+                       }
+               }
        }
+
+       return TRUE;
 }
 
 gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]