From 83da11b287a873f9ba8eab9715f1313cade2adf1 Mon Sep 17 00:00:00 2001 From: Sergey Kanzhelev Date: Wed, 8 May 2024 00:14:36 +0000 Subject: [PATCH] verify that files were not removed without changing sig.yaml --- hack/verify-generated-docs.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/hack/verify-generated-docs.sh b/hack/verify-generated-docs.sh index 9a82e65c0..cfe687c8f 100755 --- a/hack/verify-generated-docs.sh +++ b/hack/verify-generated-docs.sh @@ -28,6 +28,12 @@ function cleanup { } trap cleanup EXIT +function get_interesting_files() { + local dir=$1 + local files=$(ls ${dir}/sigs.yaml ${dir}/sig-*/README.md ${dir}/wg-*/README.md ${dir}/committee-*/README.md ${dir}/sig-list.md ${dir}/OWNERS_ALIASES) + echo "$files" +} + git archive --format=tar "$(git write-tree)" | (cd "${WORKING_DIR}" && tar xf -) cd "${WORKING_DIR}" @@ -36,7 +42,9 @@ make 1>/dev/null mismatches=0 break=$(printf "=%.0s" $(seq 1 68)) -for file in $(ls ${CRT_DIR}/sigs.yaml ${CRT_DIR}/sig-*/README.md ${CRT_DIR}/wg-*/README.md ${CRT_DIR}/committee-*/README.md ${CRT_DIR}/sig-list.md ${CRT_DIR}/OWNERS_ALIASES); do + +real_files=$(get_interesting_files "$CRT_DIR") +for file in $real_files; do real=${file#$CRT_DIR/} if ! diff -q ${file} ${WORKING_DIR}/${real} &>/dev/null; then echo "${file} does not match ${WORKING_DIR}/${real}"; @@ -44,6 +52,14 @@ for file in $(ls ${CRT_DIR}/sigs.yaml ${CRT_DIR}/sig-*/README.md ${CRT_DIR}/wg-* fi; done +real_files_count=$(echo "$real_files" | wc -w) +working_dir_files_count=$(get_interesting_files "${WORKING_DIR}" | wc -l) + +if [[ $real_files_count -ne $working_dir_files_count ]]; then + echo "Mismatch: Number of generated files in does not match the number of files in the repository." + mismatches=$((mismatches+1)) +fi + if [[ ${mismatches} -gt "0" ]]; then echo "" echo "${break}"