From f0e09a1430ba7319020079744c6bbd1577bc67e9 Mon Sep 17 00:00:00 2001 From: David Hampton Date: Thu, 30 Apr 2020 14:34:55 -0400 Subject: [PATCH] Add a script to detect new/deleted C/C++ source files. --- .gitignore | 1 + mythtv/programs/scripts/sourcechanged.sh | 32 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100755 mythtv/programs/scripts/sourcechanged.sh diff --git a/.gitignore b/.gitignore index edb01d85a7f..6e46ef8ad71 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ GPATH GRTAGS GTAGS compile_commands.json +source-checksum diff --git a/mythtv/programs/scripts/sourcechanged.sh b/mythtv/programs/scripts/sourcechanged.sh new file mode 100755 index 00000000000..062ce27dbe0 --- /dev/null +++ b/mythtv/programs/scripts/sourcechanged.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +while [[ ! -e ".git" ]] ; do + cd .. + if [[ `pwd` == "/" ]] ; then + echo "fail." + exit + fi +done + +CHECKSUM=`find . -name \*.cpp -o -name \*.c -o -name \*.h | md5sum | cut -b -32` + +if [[ ! -e "compile_commands.json" ]] ; then + echo $CHECKSUM > "source-checksum" + echo "new" + exit +fi + +if [[ ! -e "source-checksum" ]] ; then + echo $CHECKSUM > "source-checksum" + echo "new2" + exit +fi + +line=$(head -n 1 "source-checksum") +if [[ $line != $CHECKSUM ]]; then + echo $CHECKSUM > "source-checksum" + echo "changed" +else + echo "ok" +fi +