libosinfo changed the way OsinfoList is declared in 1.7.0, however that
was changed back to the old way in 1.8.0; the change was an ABI break,
and made OsinfoList a Module class. Starting from 2.63.3, Module
classes have already auto-cleanup functions declared for them, leading
to double declarations in certain setups.
Hence, do some version check dance to declare the OsinfoList only when
using "safe" versions of libosinfo and glib.
Reported by: Kevin Locke.
---
v2v/libosinfo-c.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/v2v/libosinfo-c.c b/v2v/libosinfo-c.c
index 1ab6bb4d..e5327dff 100644
--- a/v2v/libosinfo-c.c
+++ b/v2v/libosinfo-c.c
@@ -44,7 +44,16 @@
G_DEFINE_AUTOPTR_CLEANUP_FUNC(OsinfoFilter, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(OsinfoLoader, g_object_unref)
+/*
+ * Because of a bug in OsinfoList in libosinfo 1.7.0 (fixed in 1.8.0),
+ * and a glib auto-cleanup addition for Module classes in 2.63.3,
+ * avoid declaring this when:
+ * - libosinfo is >= 1.7.0 and < 1.8.0
+ * - glib is >= 2.63.3
+ */
+#if !IS_LIBOSINFO_VERSION(1, 7, 0) || IS_LIBOSINFO_VERSION(1, 8, 0) ||
!GLIB_CHECK_VERSION(2, 63, 3)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(OsinfoList, g_object_unref)
+#endif
G_DEFINE_AUTOPTR_CLEANUP_FUNC(OsinfoOsList, g_object_unref)
typedef OsinfoDb *OsinfoDb_t;
--
2.25.4