From d1e3c70508f1187c55f50be1a4b5efc00cab29c6 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 27 Apr 2020 14:53:01 +0000 Subject: [PATCH] build.sh: Retry the build when source could not be loaded Signed-off-by: Michael Tremer --- build.sh | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/build.sh b/build.sh index 701652d..db8b738 100755 --- a/build.sh +++ b/build.sh @@ -111,9 +111,12 @@ build() { branch=$(git branch -r | awk -F/ '{ print $NF }' | grep ^core | sort --version-sort | tail -n1) fi - # If the branch was not updated, we won't build local commit_new="$(git rev-parse origin/${branch})" - [ "${commit_old}" = "${commit_new}" ] && return 2 + + # If the branch was not updated, we won't build + if [ ! -e "${dir}/.force-build" ] && [ "${commit_old}" = "${commit_new}" ]; then + return 2 + fi local current_branch="$(git rev-parse --abbrev-ref HEAD)" if [ "${current_branch}" != "${branch}" ]; then @@ -134,14 +137,13 @@ build() { local build="${build_path}/${target}" local status="failed" - # Ready for build - ./make.sh --target="${target}" clean - - # Download the toolchain if required - ./make.sh --target="${target}" gettoolchain || continue - - # Download all sources - ./make.sh --target="${target}" downloadsrc || continue + # Ready for build: Download toolchain and sources + for action in clean gettoolchain downloadsrc; do + if ! ./make.sh --target="${target}" "${action}"; then + touch "${dir}/.force-build" + continue + fi + done # Execute the build mkdir -p "${build}" @@ -162,14 +164,14 @@ build() { fi mv -v log/ "${build}" - # Cleanup the build environment - ./make.sh --target="${target}" clean - # Upload the result sync # Send an email notification send_email "${status}" "${target}" "${branch}" "${commit_new}" "${build}" + + # Cleanup the build environment + ./make.sh --target="${target}" clean done popd -- 2.47.3