scripts: Modified the KConfig and CMakelists.txt updating condition. [1/1]

PD#SWPL-68240

Problem:
Modified the KConfig and CMakelists.txt updating condition.

Solution:
AModified the KConfig and CMakelists.txt updating condition.

Verify:
N/A

Change-Id: Ia49d8c7ac88b1d494c42700922445833e9e0286f
Signed-off-by: Xiaohu.Huang <xiaohu.huang@amlogic.com>
diff --git a/setup.sh b/setup.sh
index 0942c82..a56284c 100755
--- a/setup.sh
+++ b/setup.sh
@@ -16,6 +16,7 @@
 special_dirs="arch soc boards"
 
 RTOS_SDK_MANIFEST_FILE="$kernel_BUILD_DIR/rtos_sdk_manifest.xml"
+RTOS_SDK_MANIFEST_OLD_FILE="$kernel_BUILD_DIR/rtos_sdk_manifest_old.xml"
 STAMP="$kernel_BUILD_DIR/.stamp"
 
 [ -n "$1" ] && BUILD_DIR=$1;
@@ -24,12 +25,6 @@
 #COMPILE_TIME="$(shell date +%g.%V.%u" "%H:%M:%S)"
 COMPILE_TIME=`date +%F" "%T`
 
-if [ -s $RTOS_SDK_MANIFEST_FILE ] && [ -s $kconfig_file ] && [ $PWD/Makefile -ot $kconfig_file ] && [ $kconfig_file -ot $STAMP ]; then
-	sed -i '/#define CONFIG_COMPILE_TIME/d' $RTOS_SDK_VERSION_FILE
-	echo "#define CONFIG_COMPILE_TIME \"$COMPILE_TIME\"" >> $RTOS_SDK_VERSION_FILE
-	exit 0
-fi
-
 # Check whether the project is a repo
 repo manifest >/dev/null 2>&1
 [ "$?" -ne 0 ] && exit 0
@@ -40,6 +35,16 @@
 	echo "Faild to save $RTOS_SDK_MANIFEST_FILE"
 	exit 1
 fi
+if [ -s $RTOS_SDK_MANIFEST_OLD_FILE ] && [ $kconfig_file -ot $STAMP ]; then
+	is_update=`comm -3 <(sort $RTOS_SDK_MANIFEST_FILE) <(sort $RTOS_SDK_MANIFEST_OLD_FILE) | wc -m`
+	if [ $is_update -eq 0 ]; then
+		sed -i '/#define CONFIG_COMPILE_TIME/d' $RTOS_SDK_VERSION_FILE
+		echo "#define CONFIG_COMPILE_TIME \"$COMPILE_TIME\"" >> $RTOS_SDK_VERSION_FILE
+		exit 0
+	else
+		echo "Update top Kconfig and CMakelists.txt."
+	fi
+fi
 
 pattern="revision="
 keyline=`grep 'default .* revision' $RTOS_SDK_MANIFEST_FILE`
@@ -158,3 +163,5 @@
 
 sleep 1
 touch $STAMP
+
+cp -arf $RTOS_SDK_MANIFEST_FILE $RTOS_SDK_MANIFEST_OLD_FILE