diff mbox series

[1/2] Makefile: SWDESCRIPTION sanity check

Message ID 20190312150538.11449-1-christian.storm@siemens.com
State Accepted
Headers show
Series [1/2] Makefile: SWDESCRIPTION sanity check | expand

Commit Message

Storm, Christian March 12, 2019, 3:05 p.m. UTC
Introduce a sanity check for a set CONFIG_SETSWDESCRIPTION but an empty
CONFIG_SWDESCRIPTION. This would happily compile but result in SWUpdate
not being able to find any configuration file in an .swu.
Hence, error out in such a condition.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Stefano Babic March 15, 2019, 11:02 a.m. UTC | #1
On 12/03/19 16:05, Christian Storm wrote:
> Introduce a sanity check for a set CONFIG_SETSWDESCRIPTION but an empty
> CONFIG_SWDESCRIPTION. This would happily compile but result in SWUpdate
> not being able to find any configuration file in an .swu.
> Hence, error out in such a condition.
> 
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>  Makefile | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index c9facdc..1589bf6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -377,6 +377,13 @@ shared-dirs	:= $(shareds-y)
>  shared-libs	:= $(patsubst %,%/built-in.o, $(shareds-y))
>  shared-all	:= $(shared-libs)
>  
> +PHONY += cfg-sanity-check
> +cfg-sanity-check:
> +	@if [ "x$(CONFIG_SETSWDESCRIPTION)" = "xy" -a -z "$(patsubst "%",%,$(strip $(CONFIG_SWDESCRIPTION)))" ]; then \
> +		echo "ERROR: CONFIG_SETSWDESCRIPTION set but not CONFIG_SWDESCRIPTION"; \
> +		exit 1; \
> +	fi
> +
>  all: swupdate ${tools-bins} ${lua_swupdate}
>  
>  # Do modpost on a prelinked vmlinux. The finally linked vmlinux has
> @@ -426,7 +433,7 @@ cmd_strip = $(STRIP) -s --remove-section=.note --remove-section=.comment \
>                 $@_unstripped -o $@; chmod a+x $@
>  endif
>  
> -swupdate: swupdate_unstripped
> +swupdate: cfg-sanity-check swupdate_unstripped
>  	$(call cmd,strip)
>  
>  ${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE
> 

Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index c9facdc..1589bf6 100644
--- a/Makefile
+++ b/Makefile
@@ -377,6 +377,13 @@  shared-dirs	:= $(shareds-y)
 shared-libs	:= $(patsubst %,%/built-in.o, $(shareds-y))
 shared-all	:= $(shared-libs)
 
+PHONY += cfg-sanity-check
+cfg-sanity-check:
+	@if [ "x$(CONFIG_SETSWDESCRIPTION)" = "xy" -a -z "$(patsubst "%",%,$(strip $(CONFIG_SWDESCRIPTION)))" ]; then \
+		echo "ERROR: CONFIG_SETSWDESCRIPTION set but not CONFIG_SWDESCRIPTION"; \
+		exit 1; \
+	fi
+
 all: swupdate ${tools-bins} ${lua_swupdate}
 
 # Do modpost on a prelinked vmlinux. The finally linked vmlinux has
@@ -426,7 +433,7 @@  cmd_strip = $(STRIP) -s --remove-section=.note --remove-section=.comment \
                $@_unstripped -o $@; chmod a+x $@
 endif
 
-swupdate: swupdate_unstripped
+swupdate: cfg-sanity-check swupdate_unstripped
 	$(call cmd,strip)
 
 ${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE