-# To be removed:
-# This build script can not successfully build out the image yet,
-# get the upstream image temporary so we can still test the CI job to
-# upload the image to nexus
-ISO_STX_COS=bootimage.iso
-ISO_UP_VER=6.0.0
-ISO_UP=http://mirror.starlingx.cengn.ca/mirror/starlingx/release/${ISO_UP_VER}/centos/flock/outputs/iso/${ISO_STX_COS}
-ISO_INF_COS=inf-image-centos-all-x86-64.iso
+patch_src () {
+ echo_step_start "Patching source codes for INF project"
+
+ STX_PXE_DATA="${MY_REPO}/stx/metal/installer/pxe-network-installer/centos/build_srpm.data"
+ echo_info "Patching for the ${STX_PXE_DATA}"
+ sed -i "s|/import/mirrors|${STX_MIRROR_DIR}|" ${STX_PXE_DATA}
+
+ STX_ISSUE_DIR="${MY_REPO}/stx/config-files/centos-release-config/files"
+ echo_info "Patching for the ${STX_ISSUE_DIR}"
+ grep -q "${ORAN_REL}" ${STX_ISSUE_DIR}/issue* \
+ || sed -i "s/\(@PLATFORM_RELEASE@\)/\1 - ${ORAN_REL}/" ${STX_ISSUE_DIR}/issue*
+
+ # Apply meta patches
+ cd ${SRC_META_PATCHES}
+ src_dirs=$(find . -type f -printf "%h\n"|uniq)
+ for d in ${src_dirs}; do
+ cd ${MY_REPO_ROOT_DIR}/${d}
+
+ # backup current branch
+ local_branch=$(git rev-parse --abbrev-ref HEAD)
+ if [ "${local_branch}" = "HEAD" ]; then
+ git checkout ${STX_SRC_BRANCH}
+ local_branch=$(git rev-parse --abbrev-ref HEAD)
+ fi
+ git branch -m "${local_branch}_${TIMESTAMP}"
+ git checkout ${STX_SRC_BRANCH}
+
+ for p in $(ls -1 ${SRC_META_PATCHES}/${d}); do
+ echo_info "Apllying patch: ${SRC_META_PATCHES}/${d}/${p}"
+ git am ${SRC_META_PATCHES}/${d}/${p}
+ done
+ done