[gnome-software] Use new appstream-glib API for correctly comparing package versions



commit 6d14df5d1f0f3458d9934602a87215d42e3b8191
Author: Kalev Lember <klember redhat com>
Date:   Wed Oct 24 11:41:28 2018 +0200

    Use new appstream-glib API for correctly comparing package versions
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-software/issues/501

 lib/gs-plugin-loader.c |  6 ++++++
 src/gs-update-dialog.c | 10 ++++++++++
 2 files changed, 16 insertions(+)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 7095cf64..109eda9a 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -1379,8 +1379,14 @@ gs_plugin_loader_app_sort_prio_cb (GsApp *app1, GsApp *app2, gpointer user_data)
 static gint
 gs_plugin_loader_app_sort_version_cb (GsApp *app1, GsApp *app2, gpointer user_data)
 {
+#if AS_CHECK_VERSION(0,7,14)
+       return as_utils_vercmp_full (gs_app_get_version (app1),
+                                    gs_app_get_version (app2),
+                                    AS_VERSION_COMPARE_FLAG_NONE);
+#else
        return as_utils_vercmp (gs_app_get_version (app1),
                                gs_app_get_version (app2));
+#endif
 }
 
 /******************************************************************************/
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index 23dd1b07..23a2d193 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -375,12 +375,22 @@ is_downgrade (const gchar *evr1,
         * part of the semantic version */
 
        /* check version */
+#if AS_CHECK_VERSION(0,7,14)
+       rc = as_utils_vercmp_full (version1, version2,
+                                  AS_VERSION_COMPARE_FLAG_NONE);
+#else
        rc = as_utils_vercmp (version1, version2);
+#endif
        if (rc != 0)
                return rc > 0;
 
        /* check release */
+#if AS_CHECK_VERSION(0,7,14)
+       rc = as_utils_vercmp_full (version1, version2,
+                                  AS_VERSION_COMPARE_FLAG_NONE);
+#else
        rc = as_utils_vercmp (release1, release2);
+#endif
        if (rc != 0)
                return rc > 0;
 


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