Blame SOURCES/0001-fix-building-with-json-glib-1.2.0.patch

6a33d9
From 9bd50802ae027422720b358eaea3c01f2a55ecab Mon Sep 17 00:00:00 2001
6a33d9
From: Igor Gnatenko <ignatenko@redhat.com>
6a33d9
Date: Thu, 5 Jan 2017 11:25:02 +0100
6a33d9
Subject: [PATCH] fix building with json-glib < 1.2.0
6a33d9
6a33d9
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
6a33d9
---
6a33d9
 CMakeLists.txt                      | 2 +-
6a33d9
 rhsm/rhsm-entitlement-certificate.c | 8 ++++++++
6a33d9
 rhsm/rhsm-utils.c                   | 4 ++++
6a33d9
 3 files changed, 13 insertions(+), 1 deletion(-)
6a33d9
6a33d9
diff --git a/CMakeLists.txt b/CMakeLists.txt
6a33d9
index 2eff0df..887cce2 100644
6a33d9
--- a/CMakeLists.txt
6a33d9
+++ b/CMakeLists.txt
6a33d9
@@ -20,7 +20,7 @@ find_package (PkgConfig REQUIRED)
6a33d9
 pkg_check_modules (GLIB REQUIRED glib-2.0>=2.44)
6a33d9
 pkg_check_modules (GOBJECT REQUIRED gobject-2.0>=2.44)
6a33d9
 pkg_check_modules (GIO REQUIRED gio-2.0>=2.44)
6a33d9
-pkg_check_modules (JSON_GLIB REQUIRED json-glib-1.0>=1.2)
6a33d9
+pkg_check_modules (JSON_GLIB REQUIRED json-glib-1.0)
6a33d9
 pkg_check_modules (OPENSSL REQUIRED openssl)
6a33d9
 
6a33d9
 add_subdirectory (rhsm)
6a33d9
diff --git a/rhsm/rhsm-entitlement-certificate.c b/rhsm/rhsm-entitlement-certificate.c
6a33d9
index 5d37732..23b3b2c 100644
6a33d9
--- a/rhsm/rhsm-entitlement-certificate.c
6a33d9
+++ b/rhsm/rhsm-entitlement-certificate.c
6a33d9
@@ -20,6 +20,10 @@
6a33d9
 
6a33d9
 #include <string.h>
6a33d9
 
6a33d9
+#if !JSON_CHECK_VERSION (1, 2, 0)
6a33d9
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonParser, g_object_unref)
6a33d9
+#endif
6a33d9
+
6a33d9
 /**
6a33d9
  * SECTION:rhsm-entitlement-certificate
6a33d9
  * @short_description: the entitlement certificate
6a33d9
@@ -147,7 +151,11 @@ parse_entitlement_data (const gchar  *data,
6a33d9
   g_autoptr(GInputStream) zstream = g_memory_input_stream_new_from_data (zdata, zlen, g_free);
6a33d9
   g_autoptr(GZlibDecompressor) decompressor = g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_ZLIB);
6a33d9
   g_autoptr(GInputStream) cstream = g_converter_input_stream_new (zstream, G_CONVERTER (decompressor));
6a33d9
+#if JSON_CHECK_VERSION (1, 2, 0)
6a33d9
   g_autoptr(JsonParser) parser = json_parser_new_immutable ();
6a33d9
+#else
6a33d9
+  g_autoptr(JsonParser) parser = json_parser_new ();
6a33d9
+#endif
6a33d9
   if (!json_parser_load_from_stream (parser, cstream, NULL, error))
6a33d9
     return NULL;
6a33d9
 
6a33d9
diff --git a/rhsm/rhsm-utils.c b/rhsm/rhsm-utils.c
6a33d9
index d9bb4a2..956633d 100644
6a33d9
--- a/rhsm/rhsm-utils.c
6a33d9
+++ b/rhsm/rhsm-utils.c
6a33d9
@@ -27,6 +27,10 @@
6a33d9
 #include <gio/gio.h>
6a33d9
 #include <json-glib/json-glib.h>
6a33d9
 
6a33d9
+#if !JSON_CHECK_VERSION (1, 2, 0)
6a33d9
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonNode, json_node_free)
6a33d9
+#endif
6a33d9
+
6a33d9
 /*
6a33d9
  * rhsm_utils_str_replace:
6a33d9
  * @haystack: (inout): pointer to a nul-terminated string.
6a33d9
-- 
6a33d9
2.12.1
6a33d9