From d5f2b712b14c3d66767008ff66a598a1acf68d27 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sun, 2 Sep 2007 10:02:06 +0000 Subject: [PATCH] Implement QA check for install_names (libraries linked to, and their location) on Darwin, such that we can detect upfront if something is going to error out during runtime. Try to correct invalid install_names if they are in the image, which can be a result of gen_usr_ldscript library movements and breaks any tool shipped with that library itself, e.g. libiconv's `iconv` utility. svn path=/main/branches/prefix/; revision=7724 --- bin/misc-functions.sh | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 008f31bdc..b62d0bd03 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -326,7 +326,7 @@ install_qa_check() { abort="no" for a in "${ED}"usr/lib*/*.la ; do s=${a##*/} - if grep -qs "${ED}" "${a}" ; then + if grep -qs "${D}" "${a}" ; then vecho -ne '\a\n' eqawarn "QA Notice: ${s} appears to contain PORTAGE_TMPDIR paths" abort="yes" @@ -334,6 +334,32 @@ install_qa_check() { done [[ ${abort} == "yes" ]] && die "soiled libtool library files found" + # Check that we don't get kernel traps at runtime because of broken + # install_names on Darwin + abort="no" + [[ ${CHOST} == *-darwin* ]] && find "${ED}" -type f | while read f ; do + otool -LX "${f}" \ + | grep -v "Archive : " \ + | sed -e 's/^\t//' -e 's/ (compa.*$//' \ + | while read r ; + do + if [[ ! -e ${r} && ! -e ${D}${r} ]] ; then + # try to "repair" this if possible, happens because of + # gen_usr_ldscript tactics + s=${r%usr/*}${r##*/usr/} + if [[ -e ${D}${s} ]] ; then + ewarn "correcting install_name from ${r} to ${s} in ${f#${D}}" + install_name_tool -change \ + "${r}" "${s}" "${f}" + else + eqawarn "QA Notice: invalid reference to ${r} in ${f}" + abort="yes" + fi + fi + done + done + [[ ${abort} == "yes" ]] && die "invalid install_names found, objects will crash at runtime" + # Evaluate misc gcc warnings if [[ -n ${PORTAGE_LOG_FILE} && -r ${PORTAGE_LOG_FILE} ]] ; then local m msgs=( -- 2.26.2