- # Clone the oran layer if it's not already cloned
- # Check if the script is inside the repo
- if cd ${SCRIPTS_DIR} && git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
- CLONED_ORAN_REPO=`dirname ${SCRIPTS_DIR}`
- echo_info "Use the cloned oran repo: ${CLONED_ORAN_REPO}"
- mkdir -p ${SRC_ORAN_DIR}/rtp
- cd ${SRC_ORAN_DIR}/rtp
- rm -rf meta-oran meta-stx scripts
- ln -sf ${CLONED_ORAN_REPO}/meta-oran meta-oran
- ln -sf ${CLONED_ORAN_REPO}/meta-stx meta-stx
- ln -sf ${CLONED_ORAN_REPO}/scripts scripts
- else
- echo_info "Cloning oran layer:"
- cd ${SRC_ORAN_DIR}
- clone_update_repo ${SRC_ORAN_BRANCH} ${SRC_ORAN_URL} rtp
- fi
-
- echo_info "Cloning or update Yocto layers:"
-
- cd ${SRC_LAYER_DIR}
- for layer_url in ${SRC_YP_URL}; do
- layer_name=$(basename ${layer_url%%;commit*})
- layer_commit=$(basename ${layer_url##*;commit=})
- clone_update_repo ${SRC_YP_BRANCH} ${layer_url%%;commit*} ${layer_name} ${layer_commit}
- done
-
- echo_step_end
-
- # Apply meta patches
- for l in $(ls -1 ${SRC_META_PATCHES}); do
- msg_step="Apply meta patches for ${l}"
- echo_step_start
- cd ${SRC_LAYER_DIR}/${l}
-
- # backup current branch
- local_branch=$(git rev-parse --abbrev-ref HEAD)
- git branch -m "${local_branch}_${TIMESTAMP}"
- git checkout -b ${local_branch} ${local_branch##*-}
-
- for p in $(ls -1 ${SRC_META_PATCHES}/${l}); do
- echo_info "Apllying patch: ${SRC_META_PATCHES}/${l}/${p}"
- git am ${SRC_META_PATCHES}/${l}/${p}
- done
- echo_step_end
- done
-}
-
-add_layer_stx_build () {
- msg_step="Add required layers to the StarlingX build project"
- echo_step_start
-
- source_env ${PRJ_BUILD_DIR}
- SRC_LAYERS=""
- for layer_url in ${SRC_YP_URL}; do
- layer_name=$(basename ${layer_url%%;commit*})
- case ${layer_name} in
- poky)
- continue
- ;;
- meta-openembedded)
- for sub_layer in ${SUB_LAYER_META_OE}; do
- SRC_LAYERS="${SRC_LAYERS} ${SRC_LAYER_DIR}/${layer_name}/${sub_layer}"
- done
- ;;
- meta-cloud-services)
- SRC_LAYERS="${SRC_LAYERS} ${SRC_LAYER_DIR}/${layer_name}"
- for sub_layer in ${SUB_LAYER_META_CLOUD_SERVICES}; do
- SRC_LAYERS="${SRC_LAYERS} ${SRC_LAYER_DIR}/${layer_name}/${sub_layer}"
- done
- ;;
- meta-security)
- SRC_LAYERS="${SRC_LAYERS} ${SRC_LAYER_DIR}/${layer_name}"
- for sub_layer in ${SUB_LAYER_META_SECURITY}; do
- SRC_LAYERS="${SRC_LAYERS} ${SRC_LAYER_DIR}/${layer_name}/${sub_layer}"
- done
- ;;
- *)
- SRC_LAYERS="${SRC_LAYERS} ${SRC_LAYER_DIR}/${layer_name}"
- ;;
-
- esac
- done
-
- SRC_LAYERS="${SRC_LAYERS} ${SRC_ORAN_DIR}/rtp/meta-stx"
-
- for src_layer in ${SRC_LAYERS}; do
- RUN_CMD="bitbake-layers add-layer ${src_layer}"
- echo_cmd "Add the ${src_layer} layer into the build project"
- ${RUN_CMD}
- done