build-docker-images: fix variable spelling

* Fix misspelled "workspace_root"
* Add "-v" to all invocations of "readlink -f"; without it readlink
  prints nothing on STDERR in case of errors

TESTS
==========================
* Call build-stx-images.sh with a path to a non-existant wheels file and
  make sure we see the error from readlink
* Call build-stx-images.sh with a local wheel file under $MY_WORKSPACE
  and make sure it succeeds

Signed-off-by: Davlet Panech <davlet.panech@windriver.com>
Change-Id: Iefc275aeea535d295bc4030539fe96b05f898c34
This commit is contained in:
Davlet Panech 2023-02-14 13:33:38 -05:00
parent 210df0bba2
commit 5c42946480
1 changed files with 6 additions and 6 deletions

View File

@ -7,7 +7,7 @@
# This utility builds the StarlingX container images
#
MY_SCRIPT_DIR=$(dirname $(readlink -f $0))
MY_SCRIPT_DIR=$(dirname $(readlink -fv $0))
source ${MY_SCRIPT_DIR}/../build-wheels/utils.sh
@ -131,18 +131,18 @@ function local_path_to_url {
local path="$1"
local abs_path
abs_path="$(readlink -f "$path")" || exit 1
abs_path="$(readlink -fv "$path")" || exit 1
local repo_root
repo_root="$(readlink -e "$MY_REPO_ROOT_DIR")" || exit 1
repo_root="$(readlink -ev "$MY_REPO_ROOT_DIR")" || exit 1
local workspace_root
workspace_root="$(readlink -e "$MY_WORKSPACE")" || exit 1
workspace_root="$(readlink -ev "$MY_WORKSPACE")" || exit 1
local dflt_port
if starts_with "$abs_path" "$repo_root" ; then
dflt_port="8089"
elif starts_with "$abs_path" "$workspace" ; then
elif starts_with "$abs_path" "$workspace_root" ; then
dflt_port="8088"
else
echo "ERROR: $path: path must start with \$MY_REPO_ROOT_DIR or \$MY_WORKSPACE" >&2
@ -988,7 +988,7 @@ for var in WHEELS WHEELS_PY2 ; do
# remove file:/ prefix if any
declare "$var=$(echo "${!var}" | sed -r 's#^file:/+##')"
# resolve it to an absolute path
declare "$var=$(readlink -f "${!var}")" || exit 1
declare "$var=$(readlink -fv "${!var}")" || exit 1
# convert it to a local URL
url="$(local_path_to_url "${!var}")" || exit 1
declare "$var=$url"