From 4ac0ae037378cbb746ee20e9dd1493d9f88f898f Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 25 Oct 2022 19:21:00 -0300 Subject: [PATCH] Jenkins: Workaround for MacPorts upgrade dependency issues, and fix macOS architecture switching when building for x86_64h --- .ci/build.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index 6d982a042..58d5e50c7 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -555,8 +555,8 @@ then # Switch into the correct architecture if required. case $arch in - x86_64*) arch_mac="i386";; - *) arch_mac="$arch";; + x86_64*) arch_mac="i386"; arch_cmd="x86_64";; + *) arch_mac="$arch"; arch_cmd="$arch";; esac if [ "$(arch)" != "$arch" -a "$(arch)" != "$arch_mac" ] then @@ -566,7 +566,7 @@ then args= [ $strip -ne 0 ] && args="-t $args" [ $skip_archive -ne 0 ] && args="-n $args" - arch -"$arch" zsh -lc 'exec "'"$0"'" -b "'"$package_name"'" "'"$arch"'" '"$args""$cmake_flags" + arch -"$arch_cmd" zsh -lc 'exec "'"$0"'" -b "'"$package_name"'" "'"$arch"'" '"$args""$cmake_flags" exit $? fi echo [-] Using architecture [$(arch)] @@ -599,7 +599,21 @@ then sudo sed -i -e 's/-no-feature-vulkan/-feature-vulkan/g' "$qt5_portfile" sudo sed -i -e 's/configure.env-append MAKE=/configure.env-append VULKAN_SDK=${prefix} MAKE=/g' "$qt5_portfile" fi - sudo "$macports/bin/port" install $(cat .ci/dependencies_macports.txt) + while : + do + # Attempt to install dependencies. + sudo "$macports/bin/port" install $(cat .ci/dependencies_macports.txt) 2>&1 | tee macports.log + + # Stop if no port version activation errors were found. + stuck_dep=$(grep " cannot be built while another version of " macports.log | cut -d" " -f2) + [ -z $stuck_dep ] && break + + # Deactivate the stuck dependency and try again. + sudo "$macports/bin/port" -f deactivate $stuck_dep + done + + # Remove MacPorts error detection log. + rm -f macports.log # Save build tag to skip this later. Doing it here (once everything is # in place) is important to avoid potential issues with retried builds.