From: Scott Murray <scott.murray@konsulko.com>
Date: Tue, 23 Feb 2021 19:28:03 +0000 (-0500)
Subject: meta-agl-core: fix connman-ncurses compilation
X-Git-Tag: 11.91.0~27
X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F98%2F26098%2F2;p=AGL%2Fmeta-agl.git

meta-agl-core: fix connman-ncurses compilation

Add patch for connman-ncurses to fix compilation with newer json-c in
poky master.

Bug-AGL: SPEC-3819

Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: Id17b2863a04b37981d7f7cb0885365fe1a8418d2
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/26098
Tested-by: Jenkins Job builder account
ci-image-build: Jenkins Job builder account
ci-image-boot-test: Jenkins Job builder account
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
---

diff --git a/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses/stdbool-fixes.patch b/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses/stdbool-fixes.patch
new file mode 100644
index 000000000..4e858e3c4
--- /dev/null
+++ b/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses/stdbool-fixes.patch
@@ -0,0 +1,53 @@
+Replace some TRUE/FALSE usage with stdbool.h definitions
+
+Newer versions of json-c dropped its previous #defines for TRUE and
+FALSE, update affected code to use the stdbool.h boolean definitions
+to fix compilation.
+
+Upstream-Status: Pending
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+diff --git a/json_regex.c b/json_regex.c
+index 2524c18..cdb6801 100644
+--- a/json_regex.c
++++ b/json_regex.c
+@@ -24,6 +24,7 @@
+ #endif
+ 
+ #include <json.h>
++#include <stdbool.h>
+ 
+ #include "json_regex.h"
+ #include "keys.h"
+@@ -64,7 +65,7 @@ void generate_trusted_json(void)
+ 	json_object_object_add(jregex_agent_response, "Username", json_object_new_string("^([[:print:]]*)$"));
+ 	json_object_object_add(jregex_agent_response, "Password", json_object_new_string("^([[:print:]]*)$"));
+ 
+-	jregex_agent_retry_response = json_object_new_boolean(TRUE);
++	jregex_agent_retry_response = json_object_new_boolean(true);
+ 
+ 	// See commands.c __cmd_config_service for a better idea of the format.
+ 	jregex_config_service = json_object_new_object();
+@@ -94,7 +95,7 @@ void generate_trusted_json(void)
+ 	json_object_array_add(arr, json_object_new_string("^([[:print:]]*)$"));
+ 	json_object_object_add(tmp, key_serv_proxy_excludes, arr);
+ 	json_object_object_add(opt, key_serv_proxy_config, tmp);
+-	json_object_object_add(opt, key_serv_autoconnect, json_object_new_boolean(TRUE));
++	json_object_object_add(opt, key_serv_autoconnect, json_object_new_boolean(true));
+ 	arr = json_object_new_array();
+ 	json_object_array_add(arr, json_object_new_string("^([[:print:]]*)$"));
+ 	json_object_object_add(opt, key_serv_domains_config, arr);
+diff --git a/json_utils.c b/json_utils.c
+index f66d08a..8f2c195 100644
+--- a/json_utils.c
++++ b/json_utils.c
+@@ -83,7 +83,7 @@ static bool json_match_object(struct json_object *jobj,
+ 		key_is_trusted = json_object_object_get_ex(jtrusted, key,
+ 				&tmp_trusted);
+ 
+-		if (key_is_trusted == FALSE)
++		if (key_is_trusted == false)
+ 			return false;
+ 
+ 		res = __json_type_dispatch(val, tmp_trusted);
diff --git a/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses_git.bb b/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses_git.bb
index 61086dfe7..bfedb06ab 100644
--- a/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses_git.bb
+++ b/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses_git.bb
@@ -9,7 +9,8 @@ DEPENDS = "dbus ncurses connman json-c"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=8c16666ae6c159876a0ba63099614381"
 
-SRC_URI = "git://gitlab.com/iotbzh/connman-json-client.git;protocol=https"
+SRC_URI = "git://gitlab.com/iotbzh/connman-json-client.git;protocol=https \
+           file://stdbool-fixes.patch"
 SRCREV = "2b0f93ec9518c978c04807fe52e95315d6d80e6b"
 
 inherit autotools pkgconfig