jammy-amd64-tf-a-build: Improve timeout handling

Use exponential backoff in curl operations and adjust some too short
timeouts failing regularly.

According to man curl:
"When curl is about to retry a transfer, it will first  wait  one
second  and  then for all forthcoming retries it will double the
waiting time until it reaches 10 minutes which then will be  the
delay  between  the rest of the retries.  By using --retry-delay
you  disable  this  exponential  backoff  algorithm."

So, we should not use explicit --retry-delay, and instead should
drop it and rely on exponential backoff delay, which should make
retries more robust.

This is similar to change previously done to bionic-amd64-tf-a-build.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: I00f70391d3959db11c6952683883a04970756a20
diff --git a/jammy-amd64-tf-a-build/tf-dependencies.install b/jammy-amd64-tf-a-build/tf-dependencies.install
index d4a6244..7d75306 100755
--- a/jammy-amd64-tf-a-build/tf-dependencies.install
+++ b/jammy-amd64-tf-a-build/tf-dependencies.install
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-set -e
+set -ex
 
 # Install cppcheck
 wget -q https://github.com/danmar/cppcheck/archive/refs/tags/2.7.tar.gz -O /tmp/cppcheck.tar.gz
@@ -8,7 +8,7 @@
 (cd /opt/cppcheck-*; make FILESDIR=/opt/cppcheck-2.7/cfg; make FILESDIR=/opt/cppcheck-2.7/cfg install; make clean)
 
 # Install PlantUML
-curl --connect-timeout 5 --retry 5 --retry-delay 1 --create-dirs -fsSLo ${PLANTUML_JAR_PATH} \
+curl --connect-timeout 5 --retry 5 --create-dirs -fsSLo ${PLANTUML_JAR_PATH} \
   https://repo1.maven.org/maven2/net/sourceforge/plantuml/plantuml/1.2019.6/plantuml-1.2019.6.jar
 cat << EOF > /usr/bin/plantuml
 #!/bin/sh
@@ -17,30 +17,30 @@
 chmod 0755 /usr/bin/plantuml
 
 # Install CMake
-curl --connect-timeout 5 --retry 5 --retry-delay 1 --create-dirs -fsSLo /tmp/cmake-Linux-x86_64.tar.gz \
+curl --connect-timeout 5 --retry 5 --create-dirs -fsSLo /tmp/cmake-Linux-x86_64.tar.gz \
   https://github.com/Kitware/CMake/releases/download/v3.15.7/cmake-3.15.7-Linux-x86_64.tar.gz
 tar -xf /tmp/cmake-Linux-x86_64.tar.gz -C ${TOOLS_DIR} --strip-components=1
 
 # Install Arm GCC toolchain (arm-none-eabi GNU-A)
-curl --connect-timeout 5 --retry 5 --retry-delay 1 --create-dirs -fsSLo /tmp/gcc-arm-x86_64-arm-none-eabi.tar.xz \
+curl --connect-timeout 15 --retry 5 --create-dirs -fsSLo /tmp/gcc-arm-x86_64-arm-none-eabi.tar.xz \
   https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi.tar.xz
 tar -Jxf /tmp/gcc-arm-x86_64-arm-none-eabi.tar.xz -C ${TOOLS_DIR} --strip-components=1
 
 # Install Arm GCC toolchain (arm-none-eabi GNU-RM)
-curl --connect-timeout 5 --retry 5 --retry-delay 1 --create-dirs -fsSLo /tmp/gcc-arm-x86_64-arm-none-eabi.tar.bz2 \
+curl --connect-timeout 15 --retry 5 --create-dirs -fsSLo /tmp/gcc-arm-x86_64-arm-none-eabi.tar.bz2 \
   https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
 mkdir -p ${TOOLS_DIR}/gnu-rm
 tar xjf /tmp/gcc-arm-x86_64-arm-none-eabi.tar.bz2 -C ${TOOLS_DIR}/gnu-rm --strip-components=1
 
 # Install Arm GCC toolchain (aarch64-none-elf)
-curl --connect-timeout 5 --retry 5 --retry-delay 1 --create-dirs -fsSLo /tmp/gcc-arm-x86_64-aarch64-none-elf.tar.xz \
+curl --connect-timeout 15 --retry 5 --create-dirs -fsSLo /tmp/gcc-arm-x86_64-aarch64-none-elf.tar.xz \
   https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf.tar.xz
 tar -Jxf /tmp/gcc-arm-x86_64-aarch64-none-elf.tar.xz -C ${TOOLS_DIR} --strip-components=1
 
 # Install Linaro GCC 6.2.1 toolchain (aarch64-none-elf), which is required by some platforms, i.e. marvell
 # NOTE: Toolchain is not available through PATH so to use it, CROSS_COMPILE should point to
 # CROSS_COMPILE=${TOOLS_DIR}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
-curl --connect-timeout 5 --retry 5 --retry-delay 1 --create-dirs -fsSLo /tmp/gcc-linaro-x86_64_aarch64-linux-gnu.tar.xz \
+curl --connect-timeout 5 --retry 5 --create-dirs -fsSLo /tmp/gcc-linaro-x86_64_aarch64-linux-gnu.tar.xz \
   https://releases.linaro.org/components/toolchain/binaries/6.2-2016.11/aarch64-linux-gnu/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu.tar.xz
 tar -Jxf /tmp/gcc-linaro-x86_64_aarch64-linux-gnu.tar.xz -C ${TOOLS_DIR}
 
@@ -67,7 +67,7 @@
 /tmp/armclang-6.13/install_x86_64.sh --no-interactive --i-agree-to-the-contained-eula -d ${TOOLS_DIR}
 
 # Install LLVM Clang toolchain (clang)
-curl --connect-timeout 5 --retry 5 --retry-delay 1 --create-dirs -fsSLo /tmp/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz \
+curl --connect-timeout 5 --retry 5 --create-dirs -fsSLo /tmp/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz \
   https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
 tar -xf /tmp/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz -C ${TOOLS_DIR} --strip-components=1
 
@@ -86,7 +86,7 @@
 OPENSSL_DIRNAME="openssl-${OPENSSL_VER}"
 OPENSSL_FILENAME="openssl-${OPENSSL_VER}"
 OPENSSL_CHECKSUM="98e91ccead4d4756ae3c9cde5e09191a8e586d9f4d50838e7ec09d6411dfdb63"
-curl --connect-timeout 5 --retry 5 --retry-delay 1 --create-dirs -fsSLo /tmp/${OPENSSL_FILENAME}.tar.gz \
+curl --connect-timeout 5 --retry 5 --create-dirs -fsSLo /tmp/${OPENSSL_FILENAME}.tar.gz \
   https://www.openssl.org/source/${OPENSSL_FILENAME}.tar.gz
 echo "${OPENSSL_CHECKSUM}  /tmp/${OPENSSL_FILENAME}.tar.gz" | sha256sum -c
 mkdir -p ${TOOLS_DIR}/${OPENSSL_DIRNAME} && tar -xzf /tmp/${OPENSSL_FILENAME}.tar.gz -C ${TOOLS_DIR}/${OPENSSL_DIRNAME} --strip-components=1