From: wchang kim Date: Wed, 28 Aug 2024 01:43:54 +0000 (+0900) Subject: Add sync script X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3539c7748676754fb2717ff24286a871d0c0904;p=tools%2Ftbb.git Add sync script Change-Id: Ifa1e77a3a81f970e9b9bd60b28c5ccfcf6db11b1 --- diff --git a/support/scripts/sync_tizen2x.sh b/support/scripts/sync_tizen2x.sh new file mode 100755 index 0000000..875a10c --- /dev/null +++ b/support/scripts/sync_tizen2x.sh @@ -0,0 +1,449 @@ +#!/bin/bash + +function printc(){ + color=$1 + MSG=$2 + NC='\033[0m' # No Color + + case $color in + "black") + COLOR='\033[0;30m' + ;; + "red") + COLOR='\033[0;31m' + ;; + "lred") + COLOR='\033[1;31m' + ;; + "green") + COLOR='\033[0;32m' + ;; + "lgreen") + COLOR='\033[1;32m' + ;; + "brown" | "orange") + COLOR='\033[0;33m' + ;; + "blue") + COLOR='\033[0;34m' + ;; + "lblue") + COLOR='\033[1;34m' + ;; + "purple") + COLOR='\033[0;35m' + ;; + "lpurple") + COLOR='\033[1;35m' + ;; + "cyan") + COLOR='\033[0;36m' + ;; + "lcyan") + COLOR='\033[1;36m' + ;; + "grey") + COLOR='\033[1;30m' + ;; + "lgrey") + COLOR='\033[0;37m' + ;; + "yellow") + COLOR='\033[1;33m' + ;; + "white") + COLOR='\033[1;37m' + ;; + *) + COLOR=${NC} + ;; + esac + + echo -e "${COLOR}${MSG}${NC}" +} + + +REFERENCE_MODE=0 +ADDITIONAL=0 +if [ $# == "1" ] +then + printc "lblue" "****************" + printc "lblue" " reference mode" + printc "lblue" "****************" + REFERENCE_MODE=1 +elif [ $# == "2" -a $2 == "list" ] +then + REFERENCE_MODE=1 + ADDITIONAL=1 +elif [ $# -lt "3" ] +then + echo "Usage : sync_tizen2x.sh [list]" + echo " type : base or unified" + echo " Ex : sync_tizen2x.sh base 20240108.021538 20240108.022031" + echo " Ex : sync_tizen2x.sh unified 20240108.121712 20240108.074746" + exit +fi + +TYPE=$1 + +if [ $# == 3 ] +then +TIZEN_SNAPSHOT=$2 +TIZENX_SNAPSHOT=$3 +elif [ $# == 4 -a x"$4" == x"list" ] +then +ADDITIONAL=1 +fi + +if [ $TYPE != "base" -a $TYPE != "unified" ] +then + printc "red" "Invalid type : $TYPE" + exit +fi + +function download_tizen_reference_id(){ + if [ -e build.xml ] + then + rm -f build.xml + fi + if [ -e tizen_build.xml ] + then + rm -f tizen_build.xml + fi + if [ $TYPE == "base" ] + then + DOWNLOAD_T_URL="http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Base/reference/build.xml" + else + DOWNLOAD_T_URL="http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified/reference/build.xml" + fi + + wget -q -P . ${DOWNLOAD_T_URL} + mv build.xml tizen_build.xml + + if [ $? != 0 ] + then + printc "red" "Failed...." + exit + fi +} + +function download_tizen_x_reference_id(){ + if [ -e build.xml ] + then + rm -f build.xml + fi + if [ -e tizen_x_build.xml ] + then + rm -f tizen_x_build.xml + fi + if [ $TYPE == "base" ] + then + DOWNLOAD_T_URL="http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Base-X/reference/build.xml" + else + DOWNLOAD_T_URL="http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified-X/reference/build.xml" + fi + + wget -q -P . ${DOWNLOAD_T_URL} + mv build.xml tizen_x_build.xml + + if [ $? != 0 ] + then + printc "red" "Failed...." + exit + fi +} + +function download_tizen_list(){ + if [ $TYPE == "base" ] + then + DOWNLOAD_T_URL="http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Base/tizen-base_${TIZEN_SNAPSHOT}/builddata/manifest/" + DOWNLOAD_E_URL="" + T_FILE="tizen-base_${TIZEN_SNAPSHOT}_standard.xml" + E_FILE="" + else + DOWNLOAD_T_URL="http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified/tizen-unified_${TIZEN_SNAPSHOT}/builddata/manifest/" + DOWNLOAD_E_URL="http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified/tizen-unified_${TIZEN_SNAPSHOT}/builddata/manifest/" + T_FILE="tizen-unified_${TIZEN_SNAPSHOT}_standard.xml" + E_FILE="tizen-unified_${TIZEN_SNAPSHOT}_emulator.xml" + fi + + wget -q -P . ${DOWNLOAD_T_URL}/${T_FILE} + + if [ $? != 0 ] + then + printc "red" "Failed...." + exit + fi + + printc "lgreen" "Making standard list..." + xmlstarlet sel -t -m "//project" -c "." -n ${T_FILE} | sed -e "s/.\+ path=\"\(.\+\)\" revision=\"\(.\+\)\".\+$/\1 \2/" > tizen_${TIZEN_SNAPSHOT}_standard.lst + + if [ x"$E_FILE" != "x" ] + then + wget -q -P . ${DOWNLOAD_T_URL}/${E_FILE} + + if [ $? != 0 ] + then + printc "red" "Failed...." + exit + fi + + printc "lgreen" "Making emulator list..." + xmlstarlet sel -t -m "//project" -c "." -n ${E_FILE} | sed -e "s/.\+ path=\"\(.\+\)\" revision=\"\(.\+\)\".\+$/\1 \2/" > tizen_${TIZEN_SNAPSHOT}_emulator.lst + else + echo -n "" > tizen_${TIZEN_SNAPSHOT}_emulator.lst + fi + + sort -u tizen_${TIZEN_SNAPSHOT}_standard.lst tizen_${TIZEN_SNAPSHOT}_emulator.lst > tizen_${TIZEN_SNAPSHOT}_merge.lst + rm -f ${T_FILE} + rm -f ${E_FILE} + rm -f tizen_${TIZEN_SNAPSHOT}_standard.lst + rm -f tizen_${TIZEN_SNAPSHOT}_emulator.lst +} + + +function download_tizenx_list(){ + if [ $TYPE == "base" ] + then + DOWNLOAD_T_URL="http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Base-X/tizen-base-x_${TIZENX_SNAPSHOT}/builddata/manifest/" + DOWNLOAD_E_URL="" + T_FILE="tizen-base-x_${TIZENX_SNAPSHOT}_standard.xml" + E_FILE="" + else + DOWNLOAD_T_URL="http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified-X/tizen-unified-x_${TIZENX_SNAPSHOT}/builddata/manifest/" + DOWNLOAD_E_URL="" + T_FILE="tizen-unified-x_${TIZENX_SNAPSHOT}_standard.xml" + E_FILE="" + fi + + wget -q -P . ${DOWNLOAD_T_URL}/${T_FILE} + + if [ $? != 0 ] + then + printc "red" "Failed...." + exit + fi + + printc "lgreen" "Making standard list..." + xmlstarlet sel -t -m "//project" -c "." -n ${T_FILE} | sed -e "s/.\+ path=\"\(.\+\)\" revision=\"\(.\+\)\".\+$/\1 \2/" > tizenx_${TIZENX_SNAPSHOT}_standard.lst + + if [ x"$E_FILE" != "x" ] + then + wget -q -P . ${DOWNLOAD_T_URL}/${E_FILE} + + if [ $? != 0 ] + then + printc "red" "Failed...." + exit + fi + + printc "lgreen" "Making emulator list..." + xmlstarlet sel -t -m "//project" -c "." -n ${E_FILE} | sed -e "s/.\+ path=\"\(.\+\)\" revision=\"\(.\+\)\".\+$/\1 \2/" > tizenx_${TIZENX_SNAPSHOT}_emulator.lst + else + echo -n "" > tizenx_${TIZENX_SNAPSHOT}_emulator.lst + fi + + sort -u tizenx_${TIZENX_SNAPSHOT}_standard.lst tizenx_${TIZENX_SNAPSHOT}_emulator.lst > tizenx_${TIZENX_SNAPSHOT}_merge.lst + + rm -f ${T_FILE} + rm -f ${E_FILE} + rm -f tizenx_${TIZENX_SNAPSHOT}_standard.lst + rm -f tizenx_${TIZENX_SNAPSHOT}_emulator.lst +} + +if [ $REFERENCE_MODE == 1 ] +then + download_tizen_reference_id + download_tizen_x_reference_id + TIZEN_SNAPSHOT=`xmlstarlet sel -t -v //build/id -n tizen_build.xml | cut -d _ -f 2` + TIZENX_SNAPSHOT=`xmlstarlet sel -t -v //build/id -n tizen_x_build.xml | cut -d _ -f 2` + rm -f tizen_build.xml tizen_x_build.xml + + printc "lblue" "Tizen Snapshot : $TIZEN_SNAPSHOT" + printc "lblue" "Tizen-X Snapshot : $TIZENX_SNAPSHOT" +fi + +printc "lgreen" "Downloading tizen list xml file...." +download_tizen_list + +printc "lgreen" "Downloading x list xml file...." +download_tizenx_list + +EXCEPT_BASE_LIST="\ +platform/upstream/binutils \ +platform/upstream/configure-dumper \ +platform/upstream/gcc \ +platform/upstream/gcc-contrib \ +platform/upstream/glibc \ +platform/upstream/libgcrypt \ +platform/upstream/libxcrypt \ +platform/upstream/linux-glibc-devel \ +platform/upstream/llvm \ +platform/upstream/lttng-ust \ +platform/upstream/make \ +platform/upstream/qemu \ +platform/upstream/qemu-accel \ +platform/upstream/userspace-rcu +" + +EXCEPT_UNIFIED_LIST="\ +platform/upstream/dotnet/runtime \ +platform/upstream/tizen-debug \ +platform/core/dotnet/diagnostics \ +platform/kernel/opensbi \ +platform/kernel/linux-starfive \ +platform/upstream/strace \ +platform/kernel/linux-riscv \ +platform/kernel/u-boot-thead \ +platform/hal/backend/visionfive2/device-visionfive2 \ +platform/kernel/opensbi-spacemit \ +platform/kernel/linux-thead \ +platform/upstream/gdb \ +platform/kernel/u-boot-spacemit +" + +EXCEPT_APP_LIST="\ +profile/iot/apps/native/gallery \ +profile/iot/apps/native/share-panel \ +profile/iot/apps/native/wallpaper-ui-service \ +profile/iot/apps/native/ug-setting-notification-efl \ +profile/iot/apps/native/video-player \ +profile/iot/apps/native/softkey-container \ +profile/iot/apps/native/music-player \ +profile/iot/apps/native/quickpanel \ +profile/iot/apps/native/ug-gallery-efl \ +profile/iot/apps/native/font-viewer \ +profile/iot/apps/native/ug-image-viewer-efl \ +profile/iot/apps/native/ug-setting-homescreen-efl \ +" + +declare -A tizen_list +declare -A tizenx_list + +if [ $TYPE == "base" ] +then + RESULT_FILE="result_base_T${TIZEN_SNAPSHOT}_X${TIZENX_SNAPSHOT}.txt" +else + RESULT_FILE="result_unified_T${TIZEN_SNAPSHOT}_X${TIZENX_SNAPSHOT}.txt" +fi + +OIFS=$IFS +IFS=' ' +while read -ra line +do + index=${line[0]} + tizen_list[$index]="${line[1]}" +done < tizen_${TIZEN_SNAPSHOT}_merge.lst + +while read -ra line +do + index=${line[0]} + tizenx_list[$index]=${line[1]} +done < tizenx_${TIZENX_SNAPSHOT}_merge.lst +IFS=$OIFS +rm -f tizen_${TIZEN_SNAPSHOT}_merge.lst tizenx_${TIZENX_SNAPSHOT}_merge.lst + +printc "yellow" "tizen total : ${#tizen_list[@]}, x total : ${#tizenx_list[@]}" + +CHANGE_COUNT=0 + +if [ $TYPE == "base" ] +then + EXCEPT_LIST="$EXCEPT_BASE_LIST" +else + EXCEPT_LIST="$EXCEPT_UNIFIED_LIST $EXCEPT_APP_LIST" +fi + +echo "Tizen : ${TIZEN_SNAPSHOT} to X : ${TIZENX_SNAPSHOT}" > ${RESULT_FILE} +for key in ${!tizenx_list[@]} +do + FLAG="false" + for item in $EXCEPT_LIST + do + if [ $item == $key ] + then + FLAG="true" + continue + fi + done + + if [ $FLAG == "true" ] + then + printc "orange" "EXCEPT $key" + continue + fi + if [ x"${tizen_list[$key]}" == "x" ] + then + printc "orange" "Not Found $key in tizen list" + continue + fi + if [ ${tizen_list[$key]} != ${tizenx_list[$key]} ] + then + let "CHANGE_COUNT++" + echo "$key@${tizen_list[$key]}" >> ${RESULT_FILE} + fi +done + + +printc "green" "The number of changed packages : ${CHANGE_COUNT}" +printc "green" "**************************************************************************************" +printc "green" " Please check the result file - ${RESULT_FILE}." +printc "green" "**************************************************************************************" + +EXCEPT_LIST+="\ +platform/core/uifw/gesture-engine-default \ +apps/native/position-finder-server \ +platform/upstream/tensorflow \ +platform/core/security/vist \ +platform/upstream/bcc \ +sdk/tools/coreprofiler \ +platform/core/system/swap-probe \ +platform/upstream/libabigail \ +" +if [ x"$ADDITIONAL" != x"1" ] +then + exit 0 +fi + +if [ $TYPE == "base" ] +then + RESULT_FILE_AF="result_base_T${TIZEN_SNAPSHOT}_additional_files.txt" +else + RESULT_FILE_AF="result_unified_T${TIZEN_SNAPSHOT}_additional_files.txt" +fi + + +echo "Tizen : ${TIZEN_SNAPSHOT}" > ${RESULT_FILE_AF} + +CHANGE_COUNT=0 + +for key in ${!tizen_list[@]} +do + FLAG="false" + for item in $EXCEPT_LIST + do + if [ $item == $key ] + then + FLAG="true" + continue + fi + done + + if [ $FLAG == "true" ] + then + printc "orange" "EXCEPT $key" + continue + fi + if [ x"${tizenx_list[$key]}" == "x" ] + then + let "CHANGE_COUNT++" + echo "$key@${tizen_list[$key]}" >> ${RESULT_FILE_AF} + fi +done + +printc "green" "The number of additional packages : ${CHANGE_COUNT}" +printc "green" "**************************************************************************************" +printc "green" " Please check the result file - ${RESULT_FILE_AF}." +printc "green" "**************************************************************************************" + +sort ${RESULT_FILE_AF} > sort_${RESULT_FILE_AF}