Skip to content

Commit

Permalink
build: work around repetitive pacman failures by retrying.
Browse files Browse the repository at this point in the history
MSYS2 pacman gets randomly stuck on Windows/Aarch64. The actual issue is still
being investigated by upstream projects, though anyway it's bad for us right
now, to the point that there are discussions to remove Aarch64 support from the
Windows installer (whereas it just got added recently!) in #10729.

This is an attempt to a workaround. Instead of getting stuck forever and waiting
until the whole job times out (per Gitlab CI settings), I time-out the pacman
command within our script and try again, up to 2 more times. Hopefully one of
the calls would succeed.

See: msys2/MSYS2-packages#4340
  • Loading branch information
Jehan committed Feb 8, 2024
1 parent 1bf506a commit 95d1f9d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 16 deletions.
19 changes: 15 additions & 4 deletions build/windows/gitlab-ci/1_build-deps-msys2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,21 @@ fi
export DEPS_PATH="build/windows/gitlab-ci/all-deps-uni.txt"
sed -i "s/DEPS_ARCH_/${MINGW_PACKAGE_PREFIX}-/g" $DEPS_PATH
export GIMP_DEPS=`cat $DEPS_PATH`
pacman --noconfirm -S --needed git \
base-devel \
${MINGW_PACKAGE_PREFIX}-toolchain \
$GIMP_DEPS

retry=3
while [ $retry -gt 0 ]; do
: $((--retry))
timeout 10m pacman --noconfirm -S --needed git \
base-devel \
${MINGW_PACKAGE_PREFIX}-toolchain \
$GIMP_DEPS && break
echo "MSYS2 pacman timed out. Trying again."
done

if [ $? -ne 0 ]; then
echo "MSYS2 pacman repeatedly failed. See: https://github.com/msys2/MSYS2-packages/issues/4340"
exit 1
fi


# Clone babl and GEGL (follow master branch)
Expand Down
19 changes: 15 additions & 4 deletions build/windows/gitlab-ci/2_build-gimp-msys2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,20 @@ fi
export DEPS_PATH="build/windows/gitlab-ci/all-deps-uni.txt"
sed -i "s/DEPS_ARCH_/${MINGW_PACKAGE_PREFIX}-/g" $DEPS_PATH
export GIMP_DEPS=`cat $DEPS_PATH`
pacman --noconfirm -S --needed base-devel \
${MINGW_PACKAGE_PREFIX}-toolchain \
$GIMP_DEPS

retry=3
while [ $retry -gt 0 ]; do
: $((--retry))
timeout 10m pacman --noconfirm -S --needed base-devel \
${MINGW_PACKAGE_PREFIX}-toolchain \
$GIMP_DEPS && break
echo "MSYS2 pacman timed out. Trying again."
done

if [ $? -ne 0 ]; then
echo "MSYS2 pacman repeatedly failed. See: https://github.com/msys2/MSYS2-packages/issues/4340"
exit 1
fi

# Install QOI header manually
# mingw32 package of qoi was removed from MSYS2, we have download it by ourselves
Expand Down Expand Up @@ -145,4 +156,4 @@ if [[ "$BUILD_TYPE" == "CI_NATIVE" ]]; then
mv "${GIMP_PREFIX}" .
else
make_cmd local $MSYS2_PREFIX
fi
fi
26 changes: 18 additions & 8 deletions build/windows/gitlab-ci/3_package-gimp-uni_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,23 @@ fi


if [[ "$BUILD_TYPE" != "CI_CROSS" ]]; then
# Install the required (pre-built) packages again
export DEPS_PATH="build/windows/gitlab-ci/all-deps-uni.txt"
sed -i "s/DEPS_ARCH_/${MINGW_PACKAGE_PREFIX}-/g" $DEPS_PATH
export GIMP_DEPS=`cat $DEPS_PATH`
pacman --noconfirm -S --needed base-devel \
${MINGW_PACKAGE_PREFIX}-toolchain \
$GIMP_DEPS
# Install the required (pre-built) packages again
export DEPS_PATH="build/windows/gitlab-ci/all-deps-uni.txt"
sed -i "s/DEPS_ARCH_/${MINGW_PACKAGE_PREFIX}-/g" $DEPS_PATH
export GIMP_DEPS=`cat $DEPS_PATH`
retry=3
while [ $retry -gt 0 ]; do
: $((--retry))
timeout 10m pacman --noconfirm -S --needed base-devel \
${MINGW_PACKAGE_PREFIX}-toolchain \
$GIMP_DEPS && break
echo "MSYS2 pacman timed out. Trying again."
done

if [ $? -ne 0 ]; then
echo "MSYS2 pacman repeatedly failed. See: https://github.com/msys2/MSYS2-packages/issues/4340"
exit 1
fi
fi


Expand Down Expand Up @@ -177,4 +187,4 @@ done
libList=$(find ${GIMP_DISTRIB}/lib/ \( -iname '*.dll' -or -iname '*.exe' \)) && libArray=($libList)
for lib in "${libArray[@]}"; do
python3 build/windows/gitlab-ci/3_package-gimp-uni_dep.py $lib ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list;
done
done

0 comments on commit 95d1f9d

Please sign in to comment.