build-github.sh: pre-fetch source packages before building

We have intermittent build failures due to fetch errors of some large
source packages (like linux.git).

This commit tries to workaround those failures by downloading all the
source packages, with a retries mechanism, before starting the build.

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2024-04-24 12:37:17 +02:00
parent 09e302d5ef
commit c1fa1190d3
1 changed files with 13 additions and 0 deletions

View File

@ -80,6 +80,18 @@ copy_images() {
find "${1}" -type f -not -name MD5SUMS -print0 | xargs -r -0 md5sum | sed -e "s,${1}/,,g" | sort -k2,2 > "${1}"/MD5SUMS
}
#
# Pre-fetch all the source packages (with a retries mechanism)
#
fetch_all() {
local FETCH_LOG="fetch.log"
for _ in $(seq 1 3); do
bitbake --runall=fetch "${1}" 2>&1 | tee "${FETCH_LOG}"
grep -qs 'Summary.*ERROR' "${FETCH_LOG}" || break
done
rm -f "${FETCH_LOG}"
}
#
# In the buildserver we share the state-cache for all the different platforms
# we build in a jenkins job. This may cause problems with some packages that
@ -224,6 +236,7 @@ for platform in ${DY_PLATFORMS}; do
} >> conf/local.conf
for target in ${platform_targets:?}; do
printf "\n[INFO] Building the %s target.\n" "${target}"
time fetch_all "${target}"
# shellcheck disable=SC2046
time bitbake "${target}" $(swu_recipe_name "${target}")
# Build the toolchain for DEY images