]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
QA: Improve libs-location check.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 7 Jan 2012 23:44:03 +0000 (00:44 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 7 Jan 2012 23:44:03 +0000 (00:44 +0100)
Searches also in gcc's libdir (mainly for libgcc_s.so).

tools/quality-agent.d/003-libs-location

index 185f44f0690f1debb13333ee4f05790bacd63183..39a7f2493bfac7a9b9dd51376f8acae11c1b5787 100755 (executable)
@@ -4,14 +4,40 @@
 
 DESC="Checking correct installation of libraries"
 
+# Find the system's libdir.
+case "$(uname -m)" in
+       x86_86)
+               libdir="lib64"
+               ;;
+       *)
+               libdir="lib"
+               ;;
+esac
+
+# Find gcc libdir.
+gcc_libdir=$(gcc -print-libgcc-file-name)
+gcc_libdir=$(basename ${gcc_libdir})
+
 function check() {
        local failed=0
-       for lib in $(find ${BUILDROOT}/lib -type f -name "lib*.so.*" 2>/dev/null); do
+       for lib in $(find ${BUILDROOT}/${libdir} -type f -name "lib*.so.*" 2>/dev/null); do
                lib=${lib##*/}
                lib=${lib%%.so*}
 
-               if [ ! -e "${BUILDROOT}/usr/lib/${lib}.so" ]; then
-                       log ERROR "  /usr/lib/${lib}.so is missing"
+               # Indicates if the library in question has been found.
+               found=0
+
+               # Check if ${lib}.so is in the linker's search path.
+               for path in /usr/${libdir} ${gcc_libdir}; do
+                       if [ -e "${BUILDROOT}${path}/${lib}.so" ]; then
+                               found=1
+                               break
+                       fi
+               done
+
+               if [ "${found}" = "1" ]; then
+                       log ERROR "  ${lib}.so cannot be found in the linker's search path:"
+                       log ERROR "    /usr/${libdir} ${gcc_libdir}"
                        failed=1
                fi
        done