build.sh: improve build_all_pkg.sh fix warning [1/1]

PD#SWPL-67525

Problem:
improve build_all_pkg.sh

Solution:
improve build_all_pkg.sh

Verify:
ad401_a113l

Signed-off-by: shijie.xiong <shijie.xiong@amlogic.com>
Change-Id: I2f9bebbef4db085ba9c52347fafc27bb9f27e276
diff --git a/build_all_pkg.sh b/build_all_pkg.sh
index cac29b4..6b3b4c3 100755
--- a/build_all_pkg.sh
+++ b/build_all_pkg.sh
@@ -9,6 +9,8 @@
 cat <<EOF > $BUILD_LOG
 EOF
 
+TEMP_LOG="$OUTPUT_DIR/temp.log"
+
 source scripts/publish.sh
 
 function get_new_package_dir() {
@@ -18,6 +20,13 @@
 	export CURRENT_PRODUCTS_DIR_NAME
 }
 
+# compile warning check
+function compile_warning_check(){
+	touch $TEMP_LOG
+	CAT_LINE=`sed -n -e '/UBOOT COMPILE START/=' $1`
+	sed -n "1,${CAT_LINE}p" $1 >> $TEMP_LOG
+}
+
 echo "======== Building all packages ========" | tee -a $BUILD_LOG
 
 source scripts/gen_package_combination.sh
@@ -30,8 +39,9 @@
 	make package >> $BUILD_LOG 2>&1
 	get_new_package_dir
 	[ "$?" -ne 0 ] && echo "failed!" && cat $BUILD_LOG && echo -e "\nAborted with errors!\n" && exit 3
-	grep -qr "warning: " $BUILD_LOG
-	[ "$?" -eq 0 ] && cat $BUILD_LOG && echo -e "\nAborted with warnings!\n" && exit 1
+	compile_warning_check $BUILD_LOG
+	grep -qr "warning: " $TEMP_LOG
+	[ "$?" -eq 0 ] && cat $BUILD_LOG && echo -e "\nAborted with warnings!\n" && rm $TEMP_LOG && exit 1
 	echo "OK."
 	if [[ "$SUBMIT_TYPE" == "release" ]]; then
 		publish_packages >> $BUILD_LOG 2>&1
@@ -40,6 +50,8 @@
 	index=$((index + 1))
 done <"$PACKAGE_COMBINATION"
 
+rm $TEMP_LOG
+
 [[ "$SUBMIT_TYPE" == "release" ]] && post_publish_packages >> $BUILD_LOG 2>&1
 
 echo -e "======== Done ========\n" | tee -a $BUILD_LOG