From a2092450faaa6bc332d08a56cf3e49b97755dc3c Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Mon, 4 Jun 2018 11:17:01 +0200 Subject: [PATCH] build: fix construction of variables from platforms with dashes Commit d981f999f0afc245002f7a81cf445350854afece introduced a new platform with dashes on its name, which broke Jenkins build because middle variables are being created using the name of the platform and dashes are not allowed in bash variable names. To fix it, this commit changes the dashes to underscores on the fly. Signed-off-by: Hector Palacios --- sdk/build.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sdk/build.sh b/sdk/build.sh index c02f173ee..a5191d980 100755 --- a/sdk/build.sh +++ b/sdk/build.sh @@ -166,8 +166,10 @@ while read _pl _var _tgt; do fi fi [ -n "${DY_TARGET}" ] && _tgt="${DY_TARGET}" || true - eval "${_pl}_var=\"${_var//,/ }\"" - eval "${_pl}_tgt=\"${_tgt//,/ }\"" + # Dashes are not allowed in variables so let's substitute them on + # the fly with underscores. + eval "${_pl//-/_}_var=\"${_var//,/ }\"" + eval "${_pl//-/_}_tgt=\"${_tgt//,/ }\"" done<<-_EOF_ ccimx8x-sbc-express DONTBUILDVARIANTS dey-image-qt,dey-image-aws ccimx6qpsbc DONTBUILDVARIANTS dey-image-qt,dey-image-aws @@ -215,8 +217,10 @@ fi # Create projects and build rm -rf ${YOCTO_IMGS_DIR} ${YOCTO_PROJ_DIR} for platform in ${DY_PLATFORMS}; do - eval platform_variants="\${${platform}_var}" - eval platform_targets="\${${platform}_tgt}" + # The variables _var|tgt got their dashes converted to + # underscores, so we must convert also the ones in ${platform}. + eval platform_variants=\"\${${platform//-/_}_var}\" + eval platform_targets=\"\${${platform//-/_}_tgt}\" for variant in ${platform_variants}; do _this_prj_dir="${YOCTO_PROJ_DIR}/${platform}" _this_img_dir="${YOCTO_IMGS_DIR}/${platform}"