build-github: fix construction of variables from platforms with dashes

Commit d981f999f0 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.

This is ported from a2092450fa.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2018-09-11 10:46:23 +02:00
parent 60fae2e2e1
commit 407128b94c
1 changed files with 6 additions and 2 deletions

View File

@ -117,7 +117,9 @@ swu_recipe_name() {
# Per-platform data # Per-platform data
while read _pl _tgt; do while read _pl _tgt; do
[ -n "${DY_TARGET}" ] && _tgt="${DY_TARGET}" || true [ -n "${DY_TARGET}" ] && _tgt="${DY_TARGET}" || true
eval "${_pl}_tgt=\"${_tgt}\"" # Dashes are not allowed in variables so let's substitute them on
# the fly with underscores.
eval "${_pl//-/_}_tgt=\"${_tgt//,/ }\""
done<<-_EOF_ done<<-_EOF_
ccimx8x-sbc-express dey-image-qt ccimx8x-sbc-express dey-image-qt
ccimx6qpsbc dey-image-qt ccimx6qpsbc dey-image-qt
@ -159,7 +161,9 @@ fi
# Create projects and build # Create projects and build
rm -rf ${YOCTO_IMGS_DIR} ${YOCTO_PROJ_DIR} rm -rf ${YOCTO_IMGS_DIR} ${YOCTO_PROJ_DIR}
for platform in ${DY_PLATFORMS}; do for platform in ${DY_PLATFORMS}; do
eval platform_targets="\${${platform}_tgt}" # The variables <platform>_var|tgt got their dashes converted to
# underscores, so we must convert also the ones in ${platform}.
eval platform_targets=\"\${${platform//-/_}_tgt}\"
_this_prj_dir="${YOCTO_PROJ_DIR}/${platform}" _this_prj_dir="${YOCTO_PROJ_DIR}/${platform}"
_this_img_dir="${YOCTO_IMGS_DIR}/${platform}" _this_img_dir="${YOCTO_IMGS_DIR}/${platform}"
mkdir -p ${_this_img_dir} ${_this_prj_dir} mkdir -p ${_this_img_dir} ${_this_prj_dir}