]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
QA: New checks for libraries.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Feb 2010 14:15:42 +0000 (15:15 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Feb 2010 14:15:42 +0000 (15:15 +0100)
Check for NEEDED and SONAME attribute and raise an
exception if they are lacking.

pkgs/Constants
tools/quality-agent.d/050-libs-needed [new file with mode: 0755]
tools/quality-agent.d/050-libs-soname [new file with mode: 0755]

index 6c5eb3fe07f3d1d5974b468dee0249e2c082ded6..a5fb776242f07ac0c4dbc2fa25adf8783d4d7944 100644 (file)
@@ -73,3 +73,4 @@ export PKG_DEPS PKG_BUILD_DEPS
 export CONTROL_PREIN CONTROL_PREUN CONTROL_POSTIN CONTROL_POSTUN
 
 export QUALITY_AGENT_WHITELIST_EXECSTACK QUALITY_AGENT_WHITELIST_RPATH
+export QUALITY_AGENT_WHITELIST_SONAME
diff --git a/tools/quality-agent.d/050-libs-needed b/tools/quality-agent.d/050-libs-needed
new file mode 100755 (executable)
index 0000000..3fefe61
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+. $(dirname ${0})/qa-include
+
+check_files=$(find ${BUILDROOT} -name lib*.so)
+
+log "Searching bad libs that lack the NEEDED attribute"
+
+if [ -n "$check_files" ]; then
+       f=$(scanelf -ByF '%n %p' $check_files | awk '$2 == "" { print }')
+       if [ -n "$f" ]; then
+               log "  QA Notice: The following shared libraries lack NEEDED entries"
+               log "${f}"
+               exit 1
+       fi
+fi
+
+exit 0
diff --git a/tools/quality-agent.d/050-libs-soname b/tools/quality-agent.d/050-libs-soname
new file mode 100755 (executable)
index 0000000..8430e46
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+. $(dirname ${0})/qa-include
+
+log "Searching bad libs that lack a SONAME"
+
+check_files=$(find ${BUILDROOT} -name lib*.so)
+
+command="scanelf -ByF '%S %p' $check_files | awk '$2 == "" { print }'"
+
+for i in $QUALITY_AGENT_WHITELIST_SONAME; do
+       if [ -n "$FILTER" ]; then
+               FILTER="$FILTER|$i"
+       else
+               FILTER="$i"
+       fi
+done
+
+if [ -n "$FILTER" ]; then
+       command="$command | grep -vE \"$FILTER\""
+fi
+
+files=$(${command})
+if [ -n "${files}" ]; then
+       log "  QA Notice: The following shared libraries lack a SONAME"
+       log "${files}"
+
+       exit 1
+fi
+
+exit 0