[gnome-software] Do not add unrelated update descriptions from AppStream



commit 20665c0e0a8372b2be2d3c4d5cf14050743b90ee
Author: Richard Hughes <richard hughsie com>
Date:   Tue May 24 12:31:48 2016 +0100

    Do not add unrelated update descriptions from AppStream
    
    Do not use the AppStream update details when the installed version is not set
    -- we don't know if the AppStream release is older than the currently installed
    application.

 src/plugins/gs-appstream.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index 8bce301..23f93bb 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -315,6 +315,14 @@ gs_appstream_refine_app_updates (GsPlugin *plugin,
        guint i;
        g_autoptr(GPtrArray) updates_list = NULL;
 
+       /* not enough data to make sense */
+       if (gs_app_get_version (app) == NULL) {
+               g_debug ("no installed version for %s, "
+                        "so unable to add AppStream releases",
+                        gs_app_get_id (app));
+               return TRUE;
+       }
+
        /* make a list of valid updates */
        updates_list = g_ptr_array_new ();
        releases = as_app_get_releases (item);
@@ -322,6 +330,10 @@ gs_appstream_refine_app_updates (GsPlugin *plugin,
                rel = g_ptr_array_index (releases, i);
 
                /* is newer than what's installed */
+               g_debug ("installed %s update is %s [%i]",
+                        gs_app_get_version (app),
+                        as_release_get_version (rel),
+                        as_release_get_state (rel));
                if (as_utils_vercmp (as_release_get_version (rel),
                                     gs_app_get_version (app)) < 0)
                        continue;


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