Fix error handling for missing wheel package

A missing wheel RPM caused get-stx-wheels.sh to hang on a call
to rpm2cpio due to an empty string. This update improves the
error handling to fix the bash syntax on the file check to protect
against the empty string.

This update also corrects the usage of "local" keyword added to
the wheel and image scripts in a recent update, outside a function.

Change-Id: Ib8b83b376eacf44235a3d7fcd63d2451ca919210
Story: 2004751
Task: 29787
Signed-off-by: Don Penney <don.penney@windriver.com>
This commit is contained in:
Don Penney 2019-03-01 23:45:19 -05:00
parent dc2d33642a
commit b52b953ca7
4 changed files with 6 additions and 6 deletions

View File

@ -223,7 +223,7 @@ BASE_IMAGE_PRESENT=$?
IMAGE_NAME=${DOCKER_REGISTRY}${DOCKER_USER}/stx-${OS}:${IMAGE_VERSION} IMAGE_NAME=${DOCKER_REGISTRY}${DOCKER_USER}/stx-${OS}:${IMAGE_VERSION}
IMAGE_NAME_LATEST=${DOCKER_REGISTRY}${DOCKER_USER}/stx-${OS}:${LATEST_TAG} IMAGE_NAME_LATEST=${DOCKER_REGISTRY}${DOCKER_USER}/stx-${OS}:${LATEST_TAG}
local -a BUILD_ARGS declare -a BUILD_ARGS
BUILD_ARGS+=(--build-arg RELEASE=${OS_VERSION}) BUILD_ARGS+=(--build-arg RELEASE=${OS_VERSION})
BUILD_ARGS+=(--build-arg REPO_OPTS=${REPO_OPTS}) BUILD_ARGS+=(--build-arg REPO_OPTS=${REPO_OPTS})

View File

@ -195,7 +195,7 @@ docker images --format '{{.Repository}}:{{.Tag}}' ${OS}:${OS_VERSION} | grep -q
BASE_IMAGE_PRESENT=$? BASE_IMAGE_PRESENT=$?
# Create the builder image # Create the builder image
local -a BUILD_ARGS declare -a BUILD_ARGS
BUILD_ARGS+=(--build-arg RELEASE=${OS_VERSION}) BUILD_ARGS+=(--build-arg RELEASE=${OS_VERSION})
BUILD_ARGS+=(--build-arg OPENSTACK_RELEASE=${OPENSTACK_RELEASE}) BUILD_ARGS+=(--build-arg OPENSTACK_RELEASE=${OPENSTACK_RELEASE})
if [ ! -z "$PROXY" ]; then if [ ! -z "$PROXY" ]; then
@ -218,7 +218,7 @@ if [ "${KEEP_CONTAINER}" = "no" ]; then
RM_OPT="--rm" RM_OPT="--rm"
fi fi
local -a RUN_ARGS declare -a RUN_ARGS
if [ ! -z "$PROXY" ]; then if [ ! -z "$PROXY" ]; then
RUN_ARGS+=(--env http_proxy=$PROXY) RUN_ARGS+=(--env http_proxy=$PROXY)
RUN_ARGS+=(--env https_proxy=$PROXY) RUN_ARGS+=(--env https_proxy=$PROXY)

View File

@ -132,7 +132,7 @@ if [ ${VALID_OS} -ne 0 ]; then
fi fi
# Build the base wheels and retrieve the StarlingX wheels # Build the base wheels and retrieve the StarlingX wheels
local -a BUILD_BASE_WL_ARGS declare -a BUILD_BASE_WL_ARGS
BUILD_BASE_WL_ARGS+=(--os ${OS} --os-version ${OS_VERSION} --release ${OPENSTACK_RELEASE}) BUILD_BASE_WL_ARGS+=(--os ${OS} --os-version ${OS_VERSION} --release ${OPENSTACK_RELEASE})
if [ ! -z "$PROXY" ]; then if [ ! -z "$PROXY" ]; then
BUILD_BASE_WL_ARGS+=(--proxy ${PROXY}) BUILD_BASE_WL_ARGS+=(--proxy ${PROXY})

View File

@ -107,8 +107,8 @@ for wheel in $(sed -e 's/#.*//' ${WHEELS_FILES[@]} | sort -u); do
# so use grep instead # so use grep instead
wheelfile=$(ls ${MY_WORKSPACE}/std/rpmbuild/RPMS/${wheel}-* | grep -- '[^\-]*-[^\-]*.rpm') wheelfile=$(ls ${MY_WORKSPACE}/std/rpmbuild/RPMS/${wheel}-* | grep -- '[^\-]*-[^\-]*.rpm')
if [ ! -f ${wheelfile} ]; then if [ ! -f "${wheelfile}" ]; then
echo "Could not find ${wheelfile}" >&2 echo "Could not find ${wheel}" >&2
FAILED+=($wheel) FAILED+=($wheel)
continue continue
fi fi