diff mbox series

[V2] Fix build if DOWNLOAD is set, but no JSON

Message ID 1516807796-26341-1-git-send-email-sbabic@denx.de
State Accepted
Headers show
Series [V2] Fix build if DOWNLOAD is set, but no JSON | expand

Commit Message

Stefano Babic Jan. 24, 2018, 3:29 p.m. UTC
The downloader does not require JSON, but channel_curl is built
even if not called. Build fails with the error:

corelib/channel_curl.c:27:10: fatal error: json-c/json.h: No such file or directory

Add a CONFIG_CHANNEL_CURL that is automatically set by the modules
reuiring it (suricatta and swuforwarder).

Signed-off-by: Stefano Babic <sbabic@denx.de>
Reported-by: Jörg Krause <joerg.krause@embedded.rocks>
---

Changes since V1:
	- rework Config

 Kconfig             | 7 +++++++
 corelib/Makefile    | 2 +-
 handlers/Config.in  | 3 +--
 suricatta/Config.in | 3 +--
 4 files changed, 10 insertions(+), 5 deletions(-)

Comments

Jörg Krause Jan. 24, 2018, 8:03 p.m. UTC | #1
Hi Stefano,

On Wed, 2018-01-24 at 16:29 +0100, Stefano Babic wrote:
> The downloader does not require JSON, but channel_curl is built
> even if not called. Build fails with the error:
> 
> corelib/channel_curl.c:27:10: fatal error: json-c/json.h: No such file or directory
> 
> Add a CONFIG_CHANNEL_CURL that is automatically set by the modules
> reuiring it (suricatta and swuforwarder).
> 
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> Reported-by: Jörg Krause <joerg.krause@embedded.rocks>
> ---
> 
> Changes since V1:
> 	- rework Config
> 
>  Kconfig             | 7 +++++++
>  corelib/Makefile    | 2 +-
>  handlers/Config.in  | 3 +--
>  suricatta/Config.in | 3 +--
>  4 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/Kconfig b/Kconfig
> index 4469096..e344572 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -294,6 +294,13 @@ config DOWNLOAD
>  comment "Image downloading support needs libcurl"
>  	depends on !HAVE_LIBCURL
>  
> +config CHANNEL_CURL
> +	bool
> +	depends on HAVE_LIBCURL
> +	depends on HAVE_JSON_C
> +	select CURL
> +	select JSON
> +
>  config HASH_VERIFY
>  	bool "Allow to add sha256 hash to each image"
>  	depends on HAVE_LIBSSL
> diff --git a/corelib/Makefile b/corelib/Makefile
> index 282bffd..4b30f9c 100644
> --- a/corelib/Makefile
> +++ b/corelib/Makefile
> @@ -17,4 +17,4 @@ lib-$(CONFIG_ENCRYPTED_IMAGES)	+= swupdate_decrypt.o
>  lib-$(CONFIG_LIBCONFIG)		+= swupdate_settings.o \
>  				   parsing_library_libconfig.o
>  lib-$(CONFIG_JSON)		+= parsing_library_libjson.o
> -lib-$(CONFIG_CURL)		+= channel_curl.o
> +lib-$(CONFIG_CHANNEL_CURL)	+= channel_curl.o
> diff --git a/handlers/Config.in b/handlers/Config.in
> index 596f069..6456028 100644
> --- a/handlers/Config.in
> +++ b/handlers/Config.in
> @@ -164,8 +164,7 @@ comment "remote handler needs zeromq"
>  config SWUFORWARDER_HANDLER
>  	bool "SWU forwarder"
>  	depends on HAVE_LIBCURL

Missing depends on HAVE_JSON_C. Also missing in the comment.

> -	select CURL
> -	select JSON
> +	select CHANNEL_CURL
>  	default n
>  	help
>  	  This allows to build a chain of updater. A
> diff --git a/suricatta/Config.in b/suricatta/Config.in
> index 62e448a..2586169 100644
> --- a/suricatta/Config.in
> +++ b/suricatta/Config.in
> @@ -71,8 +71,7 @@ config SURICATTA_HAWKBIT
>  	bool "hawkBit support"
>  	depends on HAVE_LIBCURL
>  	depends on HAVE_JSON_C
> -	select JSON
> -	select CURL
> +	select CHANNEL_CURL
>  	help
>  	  Support for hawkBit server.
>  	  https://projects.eclipse.org/projects/iot.hawkbit

With that change you could also add my Acked-by.

Thanks, Jörg
Stefano Babic Jan. 24, 2018, 8:22 p.m. UTC | #2
On 24/01/2018 21:03, Jörg Krause wrote:
> Hi Stefano,
> 
> On Wed, 2018-01-24 at 16:29 +0100, Stefano Babic wrote:
>> The downloader does not require JSON, but channel_curl is built
>> even if not called. Build fails with the error:
>>
>> corelib/channel_curl.c:27:10: fatal error: json-c/json.h: No such file or directory
>>
>> Add a CONFIG_CHANNEL_CURL that is automatically set by the modules
>> reuiring it (suricatta and swuforwarder).
>>
>> Signed-off-by: Stefano Babic <sbabic@denx.de>
>> Reported-by: Jörg Krause <joerg.krause@embedded.rocks>
>> ---
>>
>> Changes since V1:
>> 	- rework Config
>>
>>  Kconfig             | 7 +++++++
>>  corelib/Makefile    | 2 +-
>>  handlers/Config.in  | 3 +--
>>  suricatta/Config.in | 3 +--
>>  4 files changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/Kconfig b/Kconfig
>> index 4469096..e344572 100644
>> --- a/Kconfig
>> +++ b/Kconfig
>> @@ -294,6 +294,13 @@ config DOWNLOAD
>>  comment "Image downloading support needs libcurl"
>>  	depends on !HAVE_LIBCURL
>>  
>> +config CHANNEL_CURL
>> +	bool
>> +	depends on HAVE_LIBCURL
>> +	depends on HAVE_JSON_C
>> +	select CURL
>> +	select JSON
>> +
>>  config HASH_VERIFY
>>  	bool "Allow to add sha256 hash to each image"
>>  	depends on HAVE_LIBSSL
>> diff --git a/corelib/Makefile b/corelib/Makefile
>> index 282bffd..4b30f9c 100644
>> --- a/corelib/Makefile
>> +++ b/corelib/Makefile
>> @@ -17,4 +17,4 @@ lib-$(CONFIG_ENCRYPTED_IMAGES)	+= swupdate_decrypt.o
>>  lib-$(CONFIG_LIBCONFIG)		+= swupdate_settings.o \
>>  				   parsing_library_libconfig.o
>>  lib-$(CONFIG_JSON)		+= parsing_library_libjson.o
>> -lib-$(CONFIG_CURL)		+= channel_curl.o
>> +lib-$(CONFIG_CHANNEL_CURL)	+= channel_curl.o
>> diff --git a/handlers/Config.in b/handlers/Config.in
>> index 596f069..6456028 100644
>> --- a/handlers/Config.in
>> +++ b/handlers/Config.in
>> @@ -164,8 +164,7 @@ comment "remote handler needs zeromq"
>>  config SWUFORWARDER_HANDLER
>>  	bool "SWU forwarder"
>>  	depends on HAVE_LIBCURL
> 
> Missing depends on HAVE_JSON_C. Also missing in the comment.

Sure.

> 
>> -	select CURL
>> -	select JSON
>> +	select CHANNEL_CURL
>>  	default n
>>  	help
>>  	  This allows to build a chain of updater. A
>> diff --git a/suricatta/Config.in b/suricatta/Config.in
>> index 62e448a..2586169 100644
>> --- a/suricatta/Config.in
>> +++ b/suricatta/Config.in
>> @@ -71,8 +71,7 @@ config SURICATTA_HAWKBIT
>>  	bool "hawkBit support"
>>  	depends on HAVE_LIBCURL
>>  	depends on HAVE_JSON_C
>> -	select JSON
>> -	select CURL
>> +	select CHANNEL_CURL
>>  	help
>>  	  Support for hawkBit server.
>>  	  https://projects.eclipse.org/projects/iot.hawkbit
> 
> With that change you could also add my Acked-by.
> 
> Thanks, Jörg
> 

Done and applied, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/Kconfig b/Kconfig
index 4469096..e344572 100644
--- a/Kconfig
+++ b/Kconfig
@@ -294,6 +294,13 @@  config DOWNLOAD
 comment "Image downloading support needs libcurl"
 	depends on !HAVE_LIBCURL
 
+config CHANNEL_CURL
+	bool
+	depends on HAVE_LIBCURL
+	depends on HAVE_JSON_C
+	select CURL
+	select JSON
+
 config HASH_VERIFY
 	bool "Allow to add sha256 hash to each image"
 	depends on HAVE_LIBSSL
diff --git a/corelib/Makefile b/corelib/Makefile
index 282bffd..4b30f9c 100644
--- a/corelib/Makefile
+++ b/corelib/Makefile
@@ -17,4 +17,4 @@  lib-$(CONFIG_ENCRYPTED_IMAGES)	+= swupdate_decrypt.o
 lib-$(CONFIG_LIBCONFIG)		+= swupdate_settings.o \
 				   parsing_library_libconfig.o
 lib-$(CONFIG_JSON)		+= parsing_library_libjson.o
-lib-$(CONFIG_CURL)		+= channel_curl.o
+lib-$(CONFIG_CHANNEL_CURL)	+= channel_curl.o
diff --git a/handlers/Config.in b/handlers/Config.in
index 596f069..6456028 100644
--- a/handlers/Config.in
+++ b/handlers/Config.in
@@ -164,8 +164,7 @@  comment "remote handler needs zeromq"
 config SWUFORWARDER_HANDLER
 	bool "SWU forwarder"
 	depends on HAVE_LIBCURL
-	select CURL
-	select JSON
+	select CHANNEL_CURL
 	default n
 	help
 	  This allows to build a chain of updater. A
diff --git a/suricatta/Config.in b/suricatta/Config.in
index 62e448a..2586169 100644
--- a/suricatta/Config.in
+++ b/suricatta/Config.in
@@ -71,8 +71,7 @@  config SURICATTA_HAWKBIT
 	bool "hawkBit support"
 	depends on HAVE_LIBCURL
 	depends on HAVE_JSON_C
-	select JSON
-	select CURL
+	select CHANNEL_CURL
 	help
 	  Support for hawkBit server.
 	  https://projects.eclipse.org/projects/iot.hawkbit