Add support for QA_SONAME variable (bug #281964). Add support for QA_NEEDED variable.
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
Fri, 21 Aug 2009 17:13:53 +0000 (17:13 -0000)
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
Fri, 21 Aug 2009 17:13:53 +0000 (17:13 -0000)
svn path=/main/trunk/; revision=14115

bin/misc-functions.sh
man/ebuild.5

index 473bde00f2ae414028875c8536e9a3707dddd012..69c0ff1ce36514aa793de2b3775b5077c2fcee5f 100755 (executable)
@@ -243,26 +243,71 @@ install_qa_check() {
                        die "Aborting due to QA concerns: ${die_msg}"
                fi
 
-               # Run some sanity checks on shared libraries
-               for d in "${D}"lib* "${D}"usr/lib* ; do
-                       f=$(scanelf -ByF '%S %p' "${d}"/lib*.so* | gawk '$2 == "" { print }')
+               # Check for shared libraries lacking SONAMEs
+               qa_var="QA_SONAME_${ARCH/-/_}"
+               eval "[[ -n \${!qa_var} ]] && QA_SONAME=(\"\${${qa_var}[@]}\")"
+               f=$(scanelf -ByF '%S %p' "${D}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${D}:/:")
+               if [[ -n ${f} ]] ; then
+                       echo "${f}" > "${T}"/scanelf-missing-SONAME.log
+                       if [[ "${QA_STRICT_SONAME-unset}" == unset ]] ; then
+                               if [[ ${#QA_SONAME[@]} -gt 1 ]] ; then
+                                       for x in "${QA_SONAME[@]}" ; do
+                                               sed -e "s#^/${x#/}\$##" -i "${T}"/scanelf-missing-SONAME.log
+                                       done
+                               else
+                                       local shopts=$-
+                                       set -o noglob
+                                       for x in ${QA_SONAME} ; do
+                                               sed -e "s#^/${x#/}\$##" -i "${T}"/scanelf-missing-SONAME.log
+                                       done
+                                       set +o noglob
+                                       set -${shopts}
+                               fi
+                       fi
+                       f=$(<"${T}"/scanelf-missing-SONAME.log)
                        if [[ -n ${f} ]] ; then
                                vecho -ne '\a\n'
                                eqawarn "QA Notice: The following shared libraries lack a SONAME"
                                eqawarn "${f}"
                                vecho -ne '\a\n'
                                sleep 1
+                       else
+                               rm -f "${T}"/scanelf-missing-SONAME.log
                        fi
+               fi
 
-                       f=$(scanelf -ByF '%n %p' "${d}"/lib*.so* | gawk '$2 == "" { print }')
+               # Check for shared libraries lacking NEEDED entries
+               qa_var="QA_NEEDED_${ARCH/-/_}"
+               eval "[[ -n \${!qa_var} ]] && QA_NEEDED=(\"\${${qa_var}[@]}\")"
+               f=$(scanelf -ByF '%n %p' "${D}"{,usr/}lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${D}:/:")
+               if [[ -n ${f} ]] ; then
+                       echo "${f}" > "${T}"/scanelf-missing-NEEDED.log
+                       if [[ "${QA_STRICT_NEEDED-unset}" == unset ]] ; then
+                               if [[ ${#QA_NEEDED[@]} -gt 1 ]] ; then
+                                       for x in "${QA_NEEDED[@]}" ; do
+                                               sed -e "s#^/${x#/}\$##" -i "${T}"/scanelf-missing-NEEDED.log
+                                       done
+                               else
+                                       local shopts=$-
+                                       set -o noglob
+                                       for x in ${QA_NEEDED} ; do
+                                               sed -e "s#^/${x#/}\$##" -i "${T}"/scanelf-missing-NEEDED.log
+                                       done
+                                       set +o noglob
+                                       set -${shopts}
+                               fi
+                       fi
+                       f=$(<"${T}"/scanelf-missing-NEEDED.log)
                        if [[ -n ${f} ]] ; then
                                vecho -ne '\a\n'
                                eqawarn "QA Notice: The following shared libraries lack NEEDED entries"
                                eqawarn "${f}"
                                vecho -ne '\a\n'
                                sleep 1
+                       else
+                               rm -f "${T}"/scanelf-missing-NEEDED.log
                        fi
-               done
+               fi
 
                PORTAGE_QUIET=${tmp_quiet}
        fi
index fba66f57a8649f89c81fbfb73bb698a29a62074a..4a2d296014ac3b09bf7e76aefaf21fdd28b58f89 100644 (file)
@@ -494,6 +494,16 @@ LDFLAGS variable.
 This should contain a list of file paths, relative to the image directory, of
 files that contain pre-stripped binaries. The paths may contain regular
 expressions with escape\-quoted special characters.
+.TP
+\fBQA_SONAME\fR
+This should contain a list of file paths, relative to the image directory, of
+shared libraries that lack SONAMEs. The paths may contain regular expressions
+with escape\-quoted special characters.
+.TP
+\fBQA_NEEDED\fR
+This should contain a list of file paths, relative to the image directory, of
+shared libraries that lack NEEDED entries. The paths may contain regular
+expressions with escape\-quoted special characters.
 .SH "PORTAGE DECLARATIONS"
 .TP
 .B inherit