From: winstone77 Date: Wed, 15 Jan 2025 05:58:14 +0000 (+0900) Subject: native-dev-rootstrap for GBS build X-Git-Tag: accepted/tizen/unified/20250122.054556^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;p=sdk%2Ftools%2Fnative-dev-rootstrap.git native-dev-rootstrap for GBS build Change-Id: I8b4410f7ee06eb2d0961448b22c9c95da2b6a454 Signed-off-by: winstone77 --- diff --git a/make_buildrequires.sh b/make_buildrequires.sh new file mode 100755 index 0000000..a4c3e83 --- /dev/null +++ b/make_buildrequires.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +ROOTSTRAP_TYPE=target +XML_LIST=`find ./rs_resource ./rs_resource_invisible -name "*-rs.xml"` +BUILD_REQ_FILE=packaging/build_requires_device.inc + +echo "" > ${BUILD_REQ_FILE} +for ifile in ${XML_LIST};do + for i in $(xmlstarlet sel -t -m "//${ROOTSTRAP_TYPE}/rpm" -v "concat(@accept, ',', @arch )" -o " " ${ifile}); do + ACCEPT=`echo $i | cut -d "," -f 1` + ARCH=`echo $i | cut -d "," -f 2` + echo "BuildRequires: ${ACCEPT}" + echo "BuildRequires: ${ACCEPT}" >> ${BUILD_REQ_FILE} + + done +done + +sort -u ${BUILD_REQ_FILE} > ${BUILD_REQ_FILE}_sorted +mv -f ${BUILD_REQ_FILE}_sorted ${BUILD_REQ_FILE} diff --git a/make_buildrequires_64.sh b/make_buildrequires_64.sh new file mode 100755 index 0000000..fb7572c --- /dev/null +++ b/make_buildrequires_64.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +./script/convert64.sh + +ROOTSTRAP_TYPE=target +XML_LIST=`find ./rs_resource ./rs_resource_invisible -name "*-rs.xml"` +BUILD_REQ_FILE=packaging/build_requires_device64.inc + +echo "" > ${BUILD_REQ_FILE} +for ifile in ${XML_LIST};do + for i in $(xmlstarlet sel -t -m "//${ROOTSTRAP_TYPE}/rpm" -v "concat(@accept, ',', @arch )" -o " " ${ifile}); do + ACCEPT=`echo $i | cut -d "," -f 1` + ARCH=`echo $i | cut -d "," -f 2` + echo "BuildRequires: ${ACCEPT}" + echo "BuildRequires: ${ACCEPT}" >> ${BUILD_REQ_FILE} + + done +done + +sort -u ${BUILD_REQ_FILE} > ${BUILD_REQ_FILE}_sorted +mv -f ${BUILD_REQ_FILE}_sorted ${BUILD_REQ_FILE} + +ROOTSTRAP_TYPE=emulator +XML_LIST=`find ./rs_resource ./rs_resource_invisible -name "*-rs.xml"` +BUILD_REQ_FILE=packaging/build_requires_emulator64.inc + +echo "" > ${BUILD_REQ_FILE} +for ifile in ${XML_LIST};do + for i in $(xmlstarlet sel -t -m "//${ROOTSTRAP_TYPE}/rpm" -v "concat(@accept, ',', @arch )" -o " " ${ifile}); do + ACCEPT=`echo $i | cut -d "," -f 1` + ARCH=`echo $i | cut -d "," -f 2` + echo "BuildRequires: ${ACCEPT}" + echo "BuildRequires: ${ACCEPT}" >> ${BUILD_REQ_FILE} + + done +done + +sort -u ${BUILD_REQ_FILE} > ${BUILD_REQ_FILE}_sorted +mv -f ${BUILD_REQ_FILE}_sorted ${BUILD_REQ_FILE} + +ROOTSTRAP_TYPE=riscv +XML_LIST=`find ./rs_resource ./rs_resource_invisible -name "*-rs.xml"` +BUILD_REQ_FILE=packaging/build_requires_riscv64.inc + +echo "" > ${BUILD_REQ_FILE} +for ifile in ${XML_LIST};do + for i in $(xmlstarlet sel -t -m "//${ROOTSTRAP_TYPE}/rpm" -v "concat(@accept, ',', @arch )" -o " " ${ifile}); do + ACCEPT=`echo $i | cut -d "," -f 1` + ARCH=`echo $i | cut -d "," -f 2` + echo "BuildRequires: ${ACCEPT}" + echo "BuildRequires: ${ACCEPT}" >> ${BUILD_REQ_FILE} + + done +done + +sort -u ${BUILD_REQ_FILE} > ${BUILD_REQ_FILE}_sorted +mv -f ${BUILD_REQ_FILE}_sorted ${BUILD_REQ_FILE} \ No newline at end of file diff --git a/make_rootstrap.sh b/make_rootstrap.sh new file mode 100755 index 0000000..5de26ca --- /dev/null +++ b/make_rootstrap.sh @@ -0,0 +1,404 @@ +#!/bin/bash + +SCRIPT_NAME="$(basename ${BASH_SOURCE[0]})" +SCRIPT_FULLPATH="$(readlink -f ${BASH_SOURCE[0]})" +SCRIPT_BASE="$(dirname ${SCRIPT_FULLPATH})" +SCRIPT_VER="0.0.2" + +CMD_RS_GEN="${SCRIPT_BASE}/script/rootstrap_gen_1.0.sh" +CMD_RS_INFO="${SCRIPT_BASE}/script/rootstrap_info_gen_1.0.sh" +CMD_RS_PLUGIN="${SCRIPT_BASE}/script/rootstrap_plugin_gen_1.0.sh" +CMD_API_FILTER="${SCRIPT_BASE}/script/api_filter.py" +CMD_API_GDBUS_FILTER="${SCRIPT_BASE}/script/api_filter_gdbus.py" + +DIR_INFO=".info" +DIR_RPM=".rpm" +DIR_PLUGIN=".plugin" +DIR_TMP=".tmp" +DIR_EMULATOR=".emulator" +DIR_TARGET=".target" +DIR_ZIP=".zip" + +PRIVATE_STRING="" + +LOGFILE="rs.log" + +if [ -e ${LOGFILE} ]; then + rm ${LOGFILE}; +fi + +touch ${LOGFILE} + +############################################################################### +# function log +############################################################################### +function log() +{ + printf "[${SCRIPT_NAME}:${BASH_LINENO[0]}] ${@}\n" +} + +############################################################################### +# function check_error +# $1 : Error code(integer) +# $2 : Error Message +# $3 : Error Xml File) +# Example : check_error $? "Fail to function" +############################################################################### +function check_error() +{ + if [ "$1" -ne "0" ]; then + printf "[${SCRIPT_NAME}:${BASH_LINENO[0]}] ERROR : $2 - exit code ($1) \n" 1>&2 + exit $1 + fi +} + +############################################################################### +# function remove_dir +# $@ : Files +# Example : remove_dir test_dir test_file +############################################################################### +function remove_dir () { + echo "remove dir : $@" + rm -rf $@ >/dev/null 2>&1 +} + +############################################################################### +## function callRootstrapGen +# $1 : emulator/target +# $2 : ${RPM_PKG_SVR_EMULATOR} +# $3 : ${BASE_PKG_SVR_EMULATOR} +# Example : callRootstrapGen emulator ${RPM_PKG_SVR_EMULATOR} ${BASE_PKG_SVR_EMULATOR} +############################################################################### +function callRootstrapGen () { + log "make rootstrap for ${1}..." 1>&2 + ROOTSTRAP_TYPE=${1}; + + if [[ -z ${3} ]] + then + FULL_RS_CMD="${CMD_RS_GEN} -t ${1} -u ${2} ${xmlList}" + else + FULL_RS_CMD="${CMD_RS_GEN} -t ${1} -u ${2} -b ${3} ${xmlList}" + fi + + FULL_RS_INFO_CMD="${CMD_RS_INFO} -t $1 -l ${xmlList} -p $PLATFORM_PROFILE -v $PLATFORM_VERSION" + + if [[ "${ROOTSTRAP_TYPE}" == "emulator" ]]; then + FULL_CMD_RS_PLUGIN_GEN="${CMD_RS_PLUGIN} -t ${ROOTSTRAP_TYPE} -i .info/$PLATFORM_PROFILE-$PLATFORM_VERSION-emulator.core.dev.xml -p ${PLATFORM_PROFILE} -v ${PLATFORM_VERSION}" + elif [[ "${ROOTSTRAP_TYPE}" == "target" ]]; then + FULL_CMD_RS_PLUGIN_GEN="${CMD_RS_PLUGIN} -t ${ROOTSTRAP_TYPE} -i .info/$PLATFORM_PROFILE-$PLATFORM_VERSION-device.core.dev.xml -p ${PLATFORM_PROFILE} -v ${PLATFORM_VERSION}" + else + exit 1; + fi + + if [[ ${DEBUG_MODE} == "1" ]] + then + log "$FULL_RS_CMD" + $FULL_RS_CMD + check_error $? "Fail to ${CMD_RS_GEN}" + + log "$FULL_RS_INFO_CMD" + $FULL_RS_INFO_CMD + check_error $? "Fail to ${CMD_RS_INFO}" + + log "$FULL_CMD_RS_PLUGIN_GEN" + $FULL_CMD_RS_PLUGIN_GEN + check_error $? "Fail to ${FULL_CMD_RS_PLUGIN_GEN}" + + else + if [[ -e ${LOGFILE} ]]; then + log "$FULL_RS_CMD" | tee -a ${LOGFILE} + fi + $FULL_RS_CMD >/dev/null + check_error $? "Fail to ${CMD_RS_GEN}" + + log "$FULL_RS_INFO_CMD" + $FULL_RS_INFO_CMD >/dev/null + check_error $? "Fail to ${CMD_RS_INFO}" + + log "$FULL_CMD_RS_PLUGIN_GEN" + $FULL_CMD_RS_PLUGIN_GEN >/dev/null + check_error $? "Fail to ${FULL_CMD_RS_PLUGIN_GEN}" + fi + + ##Append Snapshot + if [ -n "${SNAPSHOT_BASE}" ]; then + + log "ADD Snapshot : ${SNAPSHOT_BASE}" + + if [[ "${ROOTSTRAP_TYPE}" == "emulator" ]]; then + echo '' | tee -a .info/$PLATFORM_PROFILE-$PLATFORM_VERSION-emulator.core.dev.xml + elif [[ "${ROOTSTRAP_TYPE}" == "target" ]]; then + echo '' | tee -a .info/$PLATFORM_PROFILE-$PLATFORM_VERSION-device.core.dev.xml + fi + fi + + log "Done... [$SECONDS]Sec" 1>&2 +} + + +GLOBAL_ERROR="0" +OPT_TARGET=false +OPT_EMULATOR=false +OPT_DOWNLOAD_RPM=false +OPT_CLEAN=true +OPT_CONF="" +INTERNAL=false +LOCAL=false + +############################################################################### +# function usage +############################################################################### +function usage () { +echo "$SCRIPT_NAME ($SCRIPT_VER) is script to make rootstrap using xml from OBS" + echo "Usage: $SCRIPT_NAME -C [] [