summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2022-05-24 14:45:56 +0000
committerLee Jones <lee.jones@linaro.org>2022-06-10 10:05:29 +0000
commit5855d890e367f3ad53b9b49da8773a87e12123f1 (patch)
treec9d7dcc54637524ea5235ffc78a1066e8bfcc76c
parent975366a206bec8e48a5ae8bbe7fc2820315b2e7f (diff)
downloadtests-5855d890e367f3ad53b9b49da8773a87e12123f1.tar.gz
build_rootfs.sh: Make debootstrap process more resilient to network glitches
When building Rock Pi images on CloudTop, it was common for debootstrap to fail to pull down one or more (sometimes many) packages during the "Retrieving Packages" sequence, amusingly due to network anomalies: E: Couldn't download packages: libc-l10n libc6 locales libgmp10 [SNIPPED] Filesystem generation process failed. This resulted in complete failure and required the whole build process to be started over from scratch, multiple times. Simply re-invoking the same debootstrap command a few times successively without cleaning, consistently resulted in all of the packages being downloaded. Signed-off-by: Lee Jones <lee.jones@linaro.org> Change-Id: Iafbf7f55a6f6245911c308c44c8532244522d9d9
-rwxr-xr-xnet/test/build_rootfs.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/net/test/build_rootfs.sh b/net/test/build_rootfs.sh
index 6cfac70..8acc47a 100755
--- a/net/test/build_rootfs.sh
+++ b/net/test/build_rootfs.sh
@@ -178,8 +178,17 @@ sudo chown root:root "${workdir}"
# Run the debootstrap first
cd "${workdir}"
-sudo debootstrap --arch="${arch}" --variant=minbase --include="${packages}" \
- --foreign "${suite%-*}" . "${mirror}"
+
+retries=5
+while ! sudo debootstrap --arch="${arch}" --variant=minbase --include="${packages}" \
+ --foreign "${suite%-*}" . "${mirror}"; do
+ retries=$((${retries} - 1))
+ if [ ${retries} -le 0 ]; then
+ failure
+ exit 1
+ fi
+ echo "debootstrap failed - trying again - ${retries} retries left"
+done
# Copy some bootstrapping scripts into the rootfs
sudo cp -a "${SCRIPT_DIR}"/rootfs/*.sh root/