[gnome-software] rpm-ostree: Ensure D-Bus properties are updated before reading them



commit 68f4c49157188e499bd36ef6e56239c78be5cc09
Author: Kalev Lember <klember redhat com>
Date:   Thu Mar 29 21:41:08 2018 +0200

    rpm-ostree: Ensure D-Bus properties are updated before reading them
    
    Use new Reload() API in rpm-ostree 2018.4 to make sure the daemon emits
    all D-Bus properties before reading them.

 meson.build                                         | 2 +-
 plugins/rpm-ostree/gs-plugin-rpm-ostree.c           | 6 ++++++
 plugins/rpm-ostree/org.projectatomic.rpmostree1.xml | 6 ++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index 53d10370..c22a34bb 100644
--- a/meson.build
+++ b/meson.build
@@ -154,7 +154,7 @@ endif
 
 if get_option('enable-rpm-ostree')
   ostree = dependency('ostree-1')
-  rpm_ostree = dependency('rpm-ostree-1')
+  rpm_ostree = dependency('rpm-ostree-1', version : '>= 2018.4')
 endif
 
 if get_option('enable-ubuntu-reviews')
diff --git a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
index e03f5938..d811df6f 100644
--- a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
+++ b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
@@ -452,6 +452,9 @@ gs_plugin_add_updates (GsPlugin *plugin,
        const gchar *version = NULL;
        g_auto(GVariantDict) cached_update_dict;
 
+       /* ensure D-Bus properties are updated before reading them */
+       gs_rpmostree_sysroot_call_reload_sync (priv->sysroot_proxy, cancellable, error);
+
        cached_update = gs_rpmostree_os_dup_cached_update (priv->os_proxy);
        g_variant_dict_init (&cached_update_dict, cached_update);
 
@@ -658,6 +661,9 @@ gs_plugin_refine (GsPlugin *plugin,
        g_auto(GStrv) layered_packages = NULL;
        g_autofree gchar *checksum = NULL;
 
+       /* ensure D-Bus properties are updated before reading them */
+       gs_rpmostree_sysroot_call_reload_sync (priv->sysroot_proxy, cancellable, error);
+
        booted_deployment = gs_rpmostree_os_dup_booted_deployment (priv->os_proxy);
        g_assert (g_variant_lookup (booted_deployment,
                                    "packages", "^as",
diff --git a/plugins/rpm-ostree/org.projectatomic.rpmostree1.xml 
b/plugins/rpm-ostree/org.projectatomic.rpmostree1.xml
index edfa28f3..5e5bf070 100644
--- a/plugins/rpm-ostree/org.projectatomic.rpmostree1.xml
+++ b/plugins/rpm-ostree/org.projectatomic.rpmostree1.xml
@@ -47,6 +47,12 @@
       <arg type="a{sv}" name="options" direction="in"/>
     </method>
 
+    <!-- Reload sysroot if changed. This can also be used as a way to sync with the daemon
+         to ensure e.g. D-Bus properties are updated before reading them. -->
+    <method name="Reload">
+    </method>
+
+    <!-- Like Reload, but also reload configuration files. -->
     <method name="ReloadConfig">
     </method>
 


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