From de46bab85bdf02cf50cecc53ad8729783b227342 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sun, 1 May 2022 22:48:17 -0300 Subject: [PATCH] Jenkins: Detect symlink mismatches when merging macOS bundles --- .ci/build.sh | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index 232f07032..eddd58ff7 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -388,7 +388,7 @@ then # Create merged file listing. (cd "archive_tmp_universal/$merge_src.app" && find . -type f && cd "../../archive_tmp_universal/$arch_universal.app" && find . -type f && cd ../..) | sort > universal_listing.txt - # Move files that only exist on one bundle. + # Copy files that only exist on one bundle. cat universal_listing.txt | uniq -u | while IFS= read line do if [ -e "archive_tmp_universal/$merge_src.app/$line" ] @@ -401,10 +401,9 @@ then cp -p "archive_tmp_universal/$file_src.app/$line" "archive_tmp_universal/$merge_dest.app/$line" done - # Move or lipo files that exist on both bundles. + # Copy or lipo files that exist on both bundles. cat universal_listing.txt | uniq -d | while IFS= read line do - # Merge identical files. if cmp -s "archive_tmp_universal/$merge_src.app/$line" "archive_tmp_universal/$arch_universal.app/$line" then echo "> Identical: $line" @@ -422,14 +421,33 @@ then (cd "archive_tmp_universal/$merge_src.app" && find . -type l && cd "../../archive_tmp_universal/$arch_universal.app" && find . -type l && cd ../..) | sort > universal_listing.txt cat universal_listing.txt | uniq | while IFS= read line do + # Get symlink destinations. + other_link_dest= if [ -e "archive_tmp_universal/$merge_src.app/$line" ] then file_src="$merge_src" + other_link_path="archive_tmp_universal/$arch_universal.app/$line" + if [ -L "$other_link_path" ] + then + other_link_dest="$(readlink "$other_link_path")" + elif [ -e "$other_link_path" ] + then + other_link_dest='[not a symlink]' + fi else file_src="$arch_universal" fi link_dest="$(readlink "archive_tmp_universal/$file_src.app/$line")" - echo "> Symlink: $line => $link_dest" + + # Warn if destinations differ. + if [ -n "$other_link_dest" -a "$link_dest" != "$other_link_dest" ] + then + echo "> Symlink: $line => WARNING: different targets" + echo ">> Using: [$merge_src] $link_dest" + echo ">> Other: [$arch_universal] $other_link_dest" + else + echo "> Symlink: $line => $link_dest" + fi ln -s "$link_dest" "archive_tmp_universal/$merge_dest.app/$line" done