[gnome-software/gnome-3-30] rpm-ostree: Go back to working update check code



commit 5cdee7f547199c6aaa5dcdd413f641755247441e
Author: Kalev Lember <klember redhat com>
Date:   Fri Oct 5 16:26:13 2018 +0200

    rpm-ostree: Go back to working update check code
    
    Commits 9c99472 and 9df8f0a regressed rpm-ostree update checking. This
    needs more work, but for now go back to how we did it in 3.28 to get
    back to a known working state for this release.

 plugins/rpm-ostree/gs-plugin-rpm-ostree.c | 132 +++++++++++++-----------------
 1 file changed, 59 insertions(+), 73 deletions(-)
---
diff --git a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
index 13241e81..fd2a9206 100644
--- a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
+++ b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
@@ -425,58 +425,6 @@ make_rpmostree_options_variant (gboolean reboot,
        return g_variant_ref_sink (g_variant_dict_end (&dict));
 }
 
-static gboolean
-_download_only (GsPlugin *plugin, GCancellable *cancellable, GError **error)
-{
-       GsPluginData *priv = gs_plugin_get_data (plugin);
-       g_autofree gchar *transaction_address = NULL;
-       g_autoptr(GVariant) options = NULL;
-
-       options = make_rpmostree_options_variant (FALSE,  /* reboot */
-                                                 FALSE,  /* allow-downgrade */
-                                                 FALSE,  /* cache-only */
-                                                 TRUE,   /* download-only */
-                                                 FALSE,  /* skip-purge */
-                                                 FALSE,  /* no-pull-base */
-                                                 FALSE,  /* dry-run */
-                                                 FALSE); /* no-overrides */
-       if (!gs_rpmostree_os_call_upgrade_sync (priv->os_proxy,
-                                               options,
-                                               NULL /* fd list */,
-                                               &transaction_address,
-                                               NULL /* fd list out */,
-                                               cancellable,
-                                               error)) {
-               gs_utils_error_convert_gio (error);
-               return FALSE;
-       }
-
-       if (!gs_rpmostree_transaction_get_response_sync (priv->sysroot_proxy,
-                                                        transaction_address,
-                                                        cancellable,
-                                                        error)) {
-               gs_utils_error_convert_gio (error);
-               return FALSE;
-       }
-
-       return TRUE;
-}
-
-gboolean
-gs_plugin_download (GsPlugin *plugin,
-                   GsAppList *list,
-                   GCancellable *cancellable,
-                   GError **error)
-{
-       /* any are us? */
-       for (guint i = 0; i < gs_app_list_length (list); i++) {
-               GsApp *app = gs_app_list_index (list, i);
-               if (g_strcmp0 (gs_app_get_management_plugin (app), "rpm-ostree") == 0)
-                       return _download_only (plugin, cancellable, error);
-       }
-       return TRUE;
-}
-
 gboolean
 gs_plugin_refresh (GsPlugin *plugin,
                    guint cache_age,
@@ -484,30 +432,68 @@ gs_plugin_refresh (GsPlugin *plugin,
                    GError **error)
 {
        GsPluginData *priv = gs_plugin_get_data (plugin);
-       GVariantDict dict;
-       g_autofree gchar *transaction_address = NULL;
-       g_autoptr(GVariant) options = NULL;
 
-       g_variant_dict_init (&dict, NULL);
-       g_variant_dict_insert (&dict, "mode", "s", "check");
-       options = g_variant_ref_sink (g_variant_dict_end (&dict));
-
-       if (!gs_rpmostree_os_call_automatic_update_trigger_sync (priv->os_proxy,
-                                                                options,
-                                                                NULL,
-                                                                &transaction_address,
-                                                                cancellable,
-                                                                error)) {
-               gs_utils_error_convert_gio (error);
-               return FALSE;
+       if (cache_age == G_MAXUINT)
+               return TRUE;
+
+       {
+               g_autofree gchar *transaction_address = NULL;
+               g_autoptr(GVariant) options = NULL;
+
+               options = make_rpmostree_options_variant (FALSE,  /* reboot */
+                                                         FALSE,  /* allow-downgrade */
+                                                         FALSE,  /* cache-only */
+                                                         TRUE,   /* download-only */
+                                                         FALSE,  /* skip-purge */
+                                                         FALSE,  /* no-pull-base */
+                                                         FALSE,  /* dry-run */
+                                                         FALSE); /* no-overrides */
+               if (!gs_rpmostree_os_call_upgrade_sync (priv->os_proxy,
+                                                       options,
+                                                       NULL /* fd list */,
+                                                       &transaction_address,
+                                                       NULL /* fd list out */,
+                                                       cancellable,
+                                                       error)) {
+                       gs_utils_error_convert_gio (error);
+                       return FALSE;
+               }
+
+               if (!gs_rpmostree_transaction_get_response_sync (priv->sysroot_proxy,
+                                                                transaction_address,
+                                                                cancellable,
+                                                                error)) {
+                       gs_utils_error_convert_gio (error);
+                       return FALSE;
+               }
        }
 
-       if (!gs_rpmostree_transaction_get_response_sync (priv->sysroot_proxy,
-                                                        transaction_address,
-                                                        cancellable,
-                                                        error)) {
-               gs_utils_error_convert_gio (error);
-               return FALSE;
+       {
+               g_autofree gchar *transaction_address = NULL;
+               g_autoptr(GVariant) options = NULL;
+               GVariantDict dict;
+
+               g_variant_dict_init (&dict, NULL);
+               g_variant_dict_insert (&dict, "mode", "s", "check");
+               options = g_variant_ref_sink (g_variant_dict_end (&dict));
+
+               if (!gs_rpmostree_os_call_automatic_update_trigger_sync (priv->os_proxy,
+                                                                        options,
+                                                                        NULL,
+                                                                        &transaction_address,
+                                                                        cancellable,
+                                                                        error)) {
+                       gs_utils_error_convert_gio (error);
+                       return FALSE;
+               }
+
+               if (!gs_rpmostree_transaction_get_response_sync (priv->sysroot_proxy,
+                                                                transaction_address,
+                                                                cancellable,
+                                                                error)) {
+                       gs_utils_error_convert_gio (error);
+                       return FALSE;
+               }
        }
 
        /* update UI */


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