[X2Go-Commits] [x2goclient] 281/281: macbuild.sh: make compatible with new llvm-based otool binary, which now uses proper return values.
git-admin at x2go.org
git-admin at x2go.org
Thu Jan 19 13:06:28 CET 2017
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch bugfix/osx
in repository x2goclient.
commit e552d9ad865fb9cedd91b0dae531e443e19c0aee
Author: Mihai Moldovan <ionic at ionic.de>
Date: Thu Jan 19 10:56:31 2017 +0100
macbuild.sh: make compatible with new llvm-based otool binary, which now uses proper return values.
Be backwards-compatible with otool-classic.
---
debian/changelog | 2 ++
macbuild.sh | 79 ++++++++++++++++++++++++++++++++----------------------
2 files changed, 49 insertions(+), 32 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 58d7fbf..23917e5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -537,6 +537,8 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
- src/mediawidget.cpp: simplify expression.
- src/mediawidget.cpp: add deprecation warning for ARTS.
- src/mediawidget.cpp: add deprecation warning for ESounD.
+ - macbuild.sh: make compatible with new llvm-based otool binary, which now
+ uses proper return values. Be backwards-compatible with otool-classic.
[ Bernard Cafarelli ]
* New upstream version (4.0.5.3):
diff --git a/macbuild.sh b/macbuild.sh
index 90f8afb..69e342d 100755
--- a/macbuild.sh
+++ b/macbuild.sh
@@ -514,48 +514,63 @@ if [ "${BUNDLE}" = "1" ]; then
# Try to fixup files broken by duplicates removal.
for all_entry in "${all_files[@]}"; do
- typeset otool_out="$(otool -L "${all_entry}")"
+ typeset otool_out=""
typeset -i tmp_ret="0"
- # Don't merge the declaration and initialization with the real value assignment.
- # We need the return value of parse_otool_output(), but running
- # typeset foo="$(bar)" will give us the return value of typeset, not bar().
- typeset dependencies=""
+ # Newer otool versions terminate with a non-zero return code on errors,
+ # while the classic/legacy versions do not. We need to make sure our
+ # script doesn't terminate just because otool returns a non-zero exit
+ # status.
set +e
- dependencies="$(parse_otool_output "${otool_out}")"
+ otool_out="$(otool -L "${all_entry}")"
tmp_ret="${?}"
set -e
+ # If the return code was non-zero, skip this file.
+ # A return code of zero does not automatically mean that otool finished
+ # successfully, so in that case throw otool's stdout into parse_otool_output().
if [ "${tmp_ret}" -eq "0" ]; then
- typeset line=""
- while read -r line; do
- #echo "dependency of ${all_entry}: ${line}"
-
- typeset duplicate_entry=""
- typeset -i i="0"
- for i in "${!duplicates[@]}"; do
- typeset duplicate_entry="${duplicates[${i}]}"
- #echo "checking for duplicate ${duplicate_entry}"
- typeset duplicate_format="$(lazy_canonical_path "${dependency_base_format}/${duplicate_entry}")"
-
- if [ -n "${line}" ] && [ -n "${duplicate_format}" ]; then
- if [ "${line}" = "${duplicate_format}" ]; then
- install_name_tool -change "${line}" "${to_files[${i}]}" "${all_entry}"
- fi
- else
- echo "ERROR: empty file name while replacing duplicate dependencies." >&2
- echo "ERROR: for file ${all_entry}" >&2
- echo "ERROR: at dependency ${line}" >&2
- echo "ERROR: duplicate entry: \"${duplicate_entry}\"" >&2
- echo "ERROR: dependency: \"${line}\"" >&2
- exit 1
- fi
- done
- done <<< "${dependencies}"
- else
+ # Don't merge the declaration and initialization with the real value assignment.
+ # We need the return value of parse_otool_output(), but running
+ # typeset foo="$(bar)" will give us the return value of typeset, not bar().
+ typeset dependencies=""
+ set +e
+ dependencies="$(parse_otool_output "${otool_out}")"
+ tmp_ret="${?}"
+ set -e
+ fi
+
+ if [ "${tmp_ret}" -ne "0" ]; then
echo "WARNING: otool returned error for file: ${all_entry}" >&2
echo "WARNING: skipping." >&2
+ continue
fi
+
+ typeset line=""
+ while read -r line; do
+ #echo "dependency of ${all_entry}: ${line}"
+
+ typeset duplicate_entry=""
+ typeset -i i="0"
+ for i in "${!duplicates[@]}"; do
+ typeset duplicate_entry="${duplicates[${i}]}"
+ #echo "checking for duplicate ${duplicate_entry}"
+ typeset duplicate_format="$(lazy_canonical_path "${dependency_base_format}/${duplicate_entry}")"
+
+ if [ -n "${line}" ] && [ -n "${duplicate_format}" ]; then
+ if [ "${line}" = "${duplicate_format}" ]; then
+ install_name_tool -change "${line}" "${to_files[${i}]}" "${all_entry}"
+ fi
+ else
+ echo "ERROR: empty file name while replacing duplicate dependencies." >&2
+ echo "ERROR: for file ${all_entry}" >&2
+ echo "ERROR: at dependency ${line}" >&2
+ echo "ERROR: duplicate entry: \"${duplicate_entry}\"" >&2
+ echo "ERROR: dependency: \"${line}\"" >&2
+ exit 1
+ fi
+ done
+ done <<< "${dependencies}"
done
phase "Bundling up using macdeployqt"
--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list