From 36a316e29a826a1fdebd34bf5c56443e5b0c45ac Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 27 Jul 2021 12:59:54 +0200 Subject: [PATCH] make+scripts: fix rpc-check command --- Makefile | 2 +- scripts/check-rest-annotations.sh | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 scripts/check-rest-annotations.sh diff --git a/Makefile b/Makefile index 911bd2760..9ac4c611e 100644 --- a/Makefile +++ b/Makefile @@ -289,7 +289,7 @@ rpc-format: rpc-check: rpc @$(call print, "Verifying protos.") - for rpc in $$(find lnrpc/ -name "*.proto" | $(XARGS) awk '/ rpc /{print $$2}'); do if ! grep -q $$rpc lnrpc/rest-annotations.yaml; then echo "RPC $$rpc not added to lnrpc/rest-annotations.yaml"; exit 1; fi; done + cd ./lnrpc; ../scripts/check-rest-annotations.sh if test -n "$$(git describe --dirty | grep dirty)"; then echo "Protos not properly formatted or not compiled with v3.4.0"; git status; git diff; exit 1; fi sample-conf-check: diff --git a/scripts/check-rest-annotations.sh b/scripts/check-rest-annotations.sh new file mode 100755 index 000000000..380e09772 --- /dev/null +++ b/scripts/check-rest-annotations.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +for proto in $(find . -name "*.proto"); do + for rpc in $(awk '/ rpc /{print $2}' "$proto"); do + yaml=${proto%%.proto}.yaml + if ! grep -q "$rpc" "$yaml"; then + echo "RPC $rpc not added to $yaml file" + exit 1 + fi + done +done