From 2d8182a2d3213e67be087d60002bb36826f38e4c Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Fri, 4 Jan 2019 14:26:32 +0100 Subject: Use rpmvercmp instead of internal vercmp when built with rpm support This should help make sure that the version comparison algorithm matches exactly with Fedora's when built on Fedora and supports caret, tilde, and plus characters that all have special semantics in Fedora packages. https://github.com/hughsie/appstream-glib/issues/270 --- libappstream-glib/as-utils.c | 8 ++++++++ libappstream-glib/meson.build | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/libappstream-glib/as-utils.c b/libappstream-glib/as-utils.c index e475c65..6f46e52 100644 --- a/libappstream-glib/as-utils.c +++ b/libappstream-glib/as-utils.c @@ -40,6 +40,10 @@ #include #include +#ifdef HAVE_RPM +#include +#endif + #include "as-app-private.h" #include "as-enums.h" #include "as-node.h" @@ -1465,7 +1469,11 @@ as_utils_vercmp_full (const gchar *version_a, g_autofree gchar *str_b = as_utils_version_parse (version_b); return as_utils_vercmp_internal (str_a, str_b); } else { +#ifdef HAVE_RPM + return rpmvercmp (version_a, version_b); +#else return as_utils_vercmp_internal (version_a, version_b); +#endif } } diff --git a/libappstream-glib/meson.build b/libappstream-glib/meson.build index 3de5881..5f726b0 100644 --- a/libappstream-glib/meson.build +++ b/libappstream-glib/meson.build @@ -17,6 +17,10 @@ if get_option('dep11') deps += yaml endif +if get_option('rpm') + deps += rpm +endif + if get_option('stemmer') deps += stemmer endif -- cgit v1.2.1