From 80492bcdddf90825523c6112d476fd4a3503aa47 Mon Sep 17 00:00:00 2001 From: Jackie Huang Date: Wed, 18 May 2022 17:02:38 +0800 Subject: [PATCH] build_inf_yocto.sh: add option to get sstate Add option to get sstate from dockerhub image Issue-ID: INF-274 Signed-off-by: Jackie Huang Change-Id: Ib5270b783b98d8a7ffe8398c8a24c9f754f32461 --- scripts/build_inf.sh | 4 +++- scripts/build_inf_centos/build_inf_centos.sh | 1 + scripts/build_inf_yocto/build_inf_yocto.sh | 25 ++++++++++++++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/scripts/build_inf.sh b/scripts/build_inf.sh index 797aeae..81be9d5 100755 --- a/scripts/build_inf.sh +++ b/scripts/build_inf.sh @@ -80,6 +80,7 @@ echo_cmd () { ######################################################################### DRYRUN="" +YP_ARGS="-s" while getopts "w:b:e:r:unh" OPTION; do case ${OPTION} in @@ -88,6 +89,7 @@ while getopts "w:b:e:r:unh" OPTION; do ;; n) DRYRUN="-n" + YP_ARGS="" ;; h) help_info @@ -161,4 +163,4 @@ if [ -z "${DRYRUN}" ]; then ${SCRIPT_CENTOS} -w ${WORKSPACE_CENTOS} ${DRYRUN} fi -${SCRIPT_YP} -w ${WORKSPACE_YP} ${DRYRUN} +${SCRIPT_YP} -w ${WORKSPACE_YP} ${DRYRUN} ${YP_ARGS} diff --git a/scripts/build_inf_centos/build_inf_centos.sh b/scripts/build_inf_centos/build_inf_centos.sh index 112a81b..911f524 100755 --- a/scripts/build_inf_centos/build_inf_centos.sh +++ b/scripts/build_inf_centos/build_inf_centos.sh @@ -290,6 +290,7 @@ build_image () { mkdir -p ${STX_PRJ_OUTPUT} cd ${STX_PRJ_OUTPUT} wget -q ${ISO_UP} -O ${ISO_INF_COS} + ls -lh ${STX_PRJ_OUTPUT}/${ISO_INF_COS} echo_step_end diff --git a/scripts/build_inf_yocto/build_inf_yocto.sh b/scripts/build_inf_yocto/build_inf_yocto.sh index cdfa5f4..6e3d141 100755 --- a/scripts/build_inf_yocto/build_inf_yocto.sh +++ b/scripts/build_inf_yocto/build_inf_yocto.sh @@ -210,9 +210,10 @@ DRYRUN="" EXTRA_CONF="" SKIP_UPDATE="Yes" RM_WORK="Yes" +GET_SSTATE="No" BSP="intel-corei7-64" -while getopts "w:b:e:r:unh" OPTION; do +while getopts "w:b:e:r:unsh" OPTION; do case ${OPTION} in w) WORKSPACE=`readlink -f ${OPTARG}` @@ -232,6 +233,9 @@ while getopts "w:b:e:r:unh" OPTION; do r) check_yn_rm_work ${OPTARG} ;; + s) + GET_SSTATE="Yes" + ;; h) help_info exit @@ -276,6 +280,8 @@ ISO_ANACONDA=${PRJ_BUILD_DIR_ANACONDA}/tmp-glibc/deploy/images/${BSP}/${IMG_ANAC ISO_INF=${PRJ_BUILD_DIR_ANACONDA}/tmp-glibc/deploy/images/${BSP}/${IMG_INF}-${BSP}.iso ISO_INF_ALIAS=${PRJ_OUTPUT_DIR}/inf-image-yocto-aio-${IMG_ARCH}.iso +SSTATE_CONTAINER_IMG=jackiehjm/inf-yocto-sstate:8.3 + prepare_workspace () { msg_step="Create workspace for the build" echo_step_start @@ -291,6 +297,20 @@ prepare_workspace () { echo_step_end } +# This is tend to be used for CI Jenkins build only +get_sstate () { + msg_step="Get sstate cache from dockerhub image" + echo_step_start + + docker pull ${SSTATE_CONTAINER_IMG} + docker create -ti --name inf-yocto-sstate ${SSTATE_CONTAINER_IMG} sh + rm -rf ${PRJ_SHARED_SS_DIR} + docker cp inf-yocto-sstate:/sstate ${PRJ_SHARED_SS_DIR} + docker rm inf-yocto-sstate + + echo_step_end +} + prepare_src () { msg_step="Get the source code repos" echo_step_start @@ -543,6 +563,9 @@ build_anaconda_image () { ######################################################################### prepare_workspace +if [ "${GET_SSTATE}" == "Yes" ]; then + get_sstate +fi prepare_src setup_stx_build setup_anaconda_build -- 2.16.6