From 8434abaedf12f7586622baa70e34c893a9ba0f13 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 10 Jul 2023 18:43:23 +0100 Subject: [PATCH] app: Provide a stub implementation of AS_CHECK_VERSION if needed Our only code that is conditional on the libappstream version wants version 0.14.0, which conveniently is exactly the version that introduced AS_CHECK_VERSION. Signed-off-by: Simon McVittie (cherry picked from commit 556984e1c142e5c65f047ad7af9c7a11c34c8419) --- app/flatpak-builtins-utils.c | 2 +- app/flatpak-builtins-utils.h | 6 ++++++ configure.ac | 3 --- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/flatpak-builtins-utils.c b/app/flatpak-builtins-utils.c index 482cde63..4917e55d 100644 --- a/app/flatpak-builtins-utils.c +++ b/app/flatpak-builtins-utils.c @@ -1130,7 +1130,7 @@ flatpak_dir_load_appstream_store (FlatpakDir *self, appstream_file = g_file_new_for_path (appstream_path); as_metadata_set_format_style (mdata, AS_FORMAT_STYLE_COLLECTION); -#ifdef HAVE_APPSTREAM_0_14_0 +#if AS_CHECK_VERSION(0, 14, 0) success = as_metadata_parse_file (mdata, appstream_file, AS_FORMAT_KIND_XML, &local_error); #else as_metadata_parse_file (mdata, appstream_file, AS_FORMAT_KIND_XML, &local_error); diff --git a/app/flatpak-builtins-utils.h b/app/flatpak-builtins-utils.h index 01893157..958cd79a 100644 --- a/app/flatpak-builtins-utils.h +++ b/app/flatpak-builtins-utils.h @@ -28,6 +28,12 @@ #include "flatpak-dir-private.h" #include "flatpak-permission-dbus-generated.h" +/* AS_CHECK_VERSION was introduced in 0.14.0; we still support 0.12.0, so + * behave as though versions without this macro are arbitrarily old */ +#ifndef AS_CHECK_VERSION +#define AS_CHECK_VERSION(major, minor, micro) (0) +#endif + /* Appstream data expires after a day */ #define FLATPAK_APPSTREAM_TTL 86400 diff --git a/configure.ac b/configure.ac index 51ebbe19..26ba8eb1 100644 --- a/configure.ac +++ b/configure.ac @@ -362,9 +362,6 @@ PKG_CHECK_MODULES(OSTREE, [ostree-1 >= $OSTREE_REQS]) PKG_CHECK_MODULES(JSON, [json-glib-1.0]) PKG_CHECK_MODULES(APPSTREAM, [appstream >= 0.12.0]) -PKG_CHECK_MODULES(APPSTREAM_0_14_0, appstream >= 0.14.0, - [AC_DEFINE([HAVE_APPSTREAM_0_14_0], [1], [Define if appstream >= 0.14.0 is available])], - [true]) PKG_CHECK_MODULES(GDK_PIXBUF, [gdk-pixbuf-2.0])