[gnome-software: 17/25] build: Bump json-glib dependency to 1.6




commit 109a200fee255829bda04286cbc7e7b1697edbc0
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Feb 25 14:44:54 2022 +0000

    build: Bump json-glib dependency to 1.6
    
    This means we can use the memory mapped file support unconditionally.
    
    Debian Stable and Fedora 35 both have json-glib 1.6.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 contrib/gnome-software.spec.in                          |  2 +-
 lib/gs-odrs-provider.c                                  |  4 ----
 meson.build                                             |  2 +-
 .../gs-plugin-fedora-pkgdb-collections.c                | 17 -----------------
 4 files changed, 2 insertions(+), 23 deletions(-)
---
diff --git a/contrib/gnome-software.spec.in b/contrib/gnome-software.spec.in
index 497f7b08f..584d081ea 100644
--- a/contrib/gnome-software.spec.in
+++ b/contrib/gnome-software.spec.in
@@ -1,6 +1,6 @@
 %global glib2_version 2.61.1
 %global gtk3_version 3.22.4
-%global json_glib_version 1.2.0
+%global json_glib_version 1.6.0
 %global packagekit_version 1.1.1
 %global appstream_version 0.14.0
 %global libsoup_version 2.52.0
diff --git a/lib/gs-odrs-provider.c b/lib/gs-odrs-provider.c
index de8290443..e7e6df792 100644
--- a/lib/gs-odrs-provider.c
+++ b/lib/gs-odrs-provider.c
@@ -126,11 +126,7 @@ gs_odrs_provider_load_ratings (GsOdrsProvider  *self,
 
        /* parse the data and find the success */
        json_parser = json_parser_new_immutable ();
-#if JSON_CHECK_VERSION(1, 6, 0)
        if (!json_parser_load_from_mapped_file (json_parser, filename, &local_error)) {
-#else
-       if (!json_parser_load_from_file (json_parser, filename, &local_error)) {
-#endif
                g_set_error (error,
                             GS_ODRS_PROVIDER_ERROR,
                             GS_ODRS_PROVIDER_ERROR_PARSING_DATA,
diff --git a/meson.build b/meson.build
index 6b2163d07..37d3efdf2 100644
--- a/meson.build
+++ b/meson.build
@@ -136,7 +136,7 @@ gtk = dependency('gtk4',
     ]
   )
 glib = dependency('glib-2.0', version : '>= 2.66.0')
-json_glib = dependency('json-glib-1.0', version : '>= 1.2.0')
+json_glib = dependency('json-glib-1.0', version : '>= 1.6.0')
 libm = cc.find_library('m', required: false)
 if get_option('soup2')
   libsoup = dependency('libsoup-2.4', version : '>= 2.52.0')
diff --git a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c 
b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
index 6d28b2cd5..c380a9803 100644
--- a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
+++ b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
@@ -408,28 +408,11 @@ load_json (GsPluginFedoraPkgdbCollections  *self,
 {
        JsonArray *collections;
        JsonObject *root;
-#if !JSON_CHECK_VERSION(1, 6, 0)
-       gsize len;
-       g_autofree gchar *data = NULL;
-#endif  /* json-glib < 1.6.0 */
        g_autoptr(JsonParser) parser = NULL;
 
-#if JSON_CHECK_VERSION(1, 6, 0)
        parser = json_parser_new_immutable ();
        if (!json_parser_load_from_mapped_file (parser, self->cachefn, error))
                return FALSE;
-#else  /* if json-glib < 1.6.0 */
-       /* get cached file */
-       if (!g_file_get_contents (self->cachefn, &data, &len, error)) {
-               gs_utils_error_convert_gio (error);
-               return FALSE;
-       }
-
-       /* parse data */
-       parser = json_parser_new ();
-       if (!json_parser_load_from_data (parser, data, len, error))
-               return FALSE;
-#endif  /* json-glib < 1.6.0 */
 
        root = json_node_get_object (json_parser_get_root (parser));
        if (root == NULL) {


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