From 4abadb24f7699af22ffe05bd65ad58f8095a4918 Mon Sep 17 00:00:00 2001 From: Matthias Gatto Date: Mon, 14 Oct 2024 11:45:52 +0200 Subject: [PATCH] check that osc-api.json seems valide Signed-off-by: Matthias Gatto --- Makefile | 3 +++ bin/osc-api-seems-valid.sh | 15 +++++++++++++++ configure | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 bin/osc-api-seems-valid.sh diff --git a/Makefile b/Makefile index 1f6817c..ee5066a 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,9 @@ help: include oapi-cli.mk +osc-api.json:: + ./bin/osc-api-seems-valid.sh osc-api.json "need_remove" + make_cli: $(CLI_NAME) $(CLI_NAME)-completion.bash bin/funclist: bin/funclist.c diff --git a/bin/osc-api-seems-valid.sh b/bin/osc-api-seems-valid.sh new file mode 100755 index 0000000..de662bc --- /dev/null +++ b/bin/osc-api-seems-valid.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# check if $1 is valide, if $2 is present, remove invalide file + +test=$(json-search -sn Request $1 | json-search -n properties) +test_ret=$? + +if [ "$test_ret" == "1" -o "$test" == "null" ]; then + echo "$1 is invalide" >&2 + if [ "$#" -gt 1 ]; then + rm $1 + fi +fi + + diff --git a/configure b/configure index 193aeb4..f28a0ea 100755 --- a/configure +++ b/configure @@ -114,7 +114,7 @@ echo JSON_C_CFLAGS=$JSON_C_CFLAGS >> config.mk echo JSON_C_RULE=$JSON_C_RULE >> config.mk echo API_VERSION=$API_VERSION >> config.mk echo CLI_NAME=$CLI_NAME >> config.mk -echo -e "osc-api.json:\n\t$API_SCRIPT" >> config.mk +echo -e "osc-api.json::\n\t$API_SCRIPT" >> config.mk echo $SDK_VERSION > sdk-version echo "config done:" cat config.mk