[gnome-software] rpm-ostree: Use Upgrade instead of DownloadUpdateRpmDiff



commit bea127b2be371c80ace8a0a49295c2046b58fbd8
Author: Kalev Lember <klember redhat com>
Date:   Thu Mar 29 15:31:27 2018 +0200

    rpm-ostree: Use Upgrade instead of DownloadUpdateRpmDiff
    
    Upgrade is new do-it-all API that supersedes DownloadUpdateRpmDiff and
    many other individual rpm-ostree dbus methods.

 plugins/rpm-ostree/gs-plugin-rpm-ostree.c | 45 +++++++++++++++++++++++++++----
 1 file changed, 40 insertions(+), 5 deletions(-)
---
diff --git a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
index aae2e6db..5b173dfd 100644
--- a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
+++ b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
@@ -364,6 +364,29 @@ make_app (GVariant *variant)
        return g_steal_pointer (&app);
 }
 
+static GVariant *
+make_rpmostree_options_variant (gboolean reboot,
+                                gboolean allow_downgrade,
+                                gboolean cache_only,
+                                gboolean download_only,
+                                gboolean skip_purge,
+                                gboolean no_pull_base,
+                                gboolean dry_run,
+                                gboolean no_overrides)
+{
+       GVariantDict dict;
+       g_variant_dict_init (&dict, NULL);
+       g_variant_dict_insert (&dict, "reboot", "b", reboot);
+       g_variant_dict_insert (&dict, "allow-downgrade", "b", allow_downgrade);
+       g_variant_dict_insert (&dict, "cache-only", "b", cache_only);
+       g_variant_dict_insert (&dict, "download-only", "b", download_only);
+       g_variant_dict_insert (&dict, "skip-purge", "b", skip_purge);
+       g_variant_dict_insert (&dict, "no-pull-base", "b", no_pull_base);
+       g_variant_dict_insert (&dict, "dry-run", "b", dry_run);
+       g_variant_dict_insert (&dict, "no-overrides", "b", no_overrides);
+       return g_variant_ref_sink (g_variant_dict_end (&dict));
+}
+
 gboolean
 gs_plugin_refresh (GsPlugin *plugin,
                    guint cache_age,
@@ -375,11 +398,23 @@ gs_plugin_refresh (GsPlugin *plugin,
 
        if (flags & GS_PLUGIN_REFRESH_FLAGS_METADATA) {
                g_autofree gchar *transaction_address = NULL;
-
-               if (!gs_rpmostree_os_call_download_update_rpm_diff_sync (priv->os_proxy,
-                                                                        &transaction_address,
-                                                                        cancellable,
-                                                                        error)) {
+               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;
                }


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