Fix use of 'let -i' in scripts
Unlike "declare -i" and "local -i", the bash "let" does not support a
"-i" option. Rather, it takes it as a variable reference. If no "i"
variable is defined in scope, it does not cause an issue. If "i" has
been defined somewhere, however, it may cause a syntax issue, as the i
is evaluated.
A recent update to build-stx-images.sh added a loop that defines an
"i" variable without limiting its scope. In a current image build,
this loop ends with having "i" defined as a URL. As a result, a
"syntax error in expression" occurs, causing the "with_retries"
function to fail to increment the counter. Should a build error occur,
the "with_retries" will never hit the retry limit, looping until it
has a successful result.
This update removes the -i from all "let -i" occurrences in the build
scripts.
Change-Id: I34ad49f8872a81659ff4caf8087b256ea9fb3d32
Closes-Bug: 1891189
Signed-off-by: Don Penney <don.penney@windriver.com>
(cherry picked from commit f36db7e207
)
This commit is contained in:
parent
95611f4adf
commit
b58bd1cc5a
|
@ -117,7 +117,7 @@ function with_retries {
|
|||
local -i attempt=0
|
||||
|
||||
while :; do
|
||||
let -i attempt++
|
||||
let attempt++
|
||||
|
||||
echo "Running: ${cmd} $@"
|
||||
${cmd} "$@"
|
||||
|
@ -340,7 +340,7 @@ from_zip
|
|||
from_pypi
|
||||
|
||||
if [ -f $FAILED_LOG ]; then
|
||||
let -i failures=$(cat $FAILED_LOG | wc -l)
|
||||
let failures=$(cat $FAILED_LOG | wc -l)
|
||||
|
||||
cat <<EOF
|
||||
############################################################
|
||||
|
|
|
@ -21,7 +21,7 @@ function with_retries {
|
|||
local -i attempt=0
|
||||
|
||||
while :; do
|
||||
let -i attempt++
|
||||
let attempt++
|
||||
|
||||
echo "Running: ${cmd} $@"
|
||||
${cmd} "$@"
|
||||
|
|
|
@ -148,7 +148,7 @@ function check_requirements {
|
|||
which ${req} >&/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Unable to find required utility: ${req}" >&2
|
||||
let -i missing++
|
||||
let missing++
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ srpm_create_raw_extract_script () {
|
|||
SAME=1
|
||||
fi
|
||||
|
||||
let -i COUNT=0
|
||||
let COUNT=0
|
||||
while [ $SAME -eq 0 ]; do
|
||||
\cp -f $STDOUT_LOG $PREV_STDOUT_LOG
|
||||
\cp -f $STDERR_LOG $PREV_STDERR_LOG
|
||||
|
@ -226,7 +226,7 @@ srpm_create_raw_extract_script () {
|
|||
if [ $? -eq 0 ]; then
|
||||
SAME=1
|
||||
fi
|
||||
let -i COUNT++
|
||||
let COUNT++
|
||||
if [ $COUNT -ge 20 ]; then
|
||||
break;
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue