From: Michael Tremer Date: Sun, 14 Feb 2010 14:15:42 +0000 (+0100) Subject: QA: New checks for libraries. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=808707d743bd60aaf94113f381f8a91a96e2339f;p=ipfire-3.x.git QA: New checks for libraries. Check for NEEDED and SONAME attribute and raise an exception if they are lacking. --- diff --git a/pkgs/Constants b/pkgs/Constants index 6c5eb3fe0..a5fb77624 100644 --- a/pkgs/Constants +++ b/pkgs/Constants @@ -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 index 000000000..3fefe61e5 --- /dev/null +++ b/tools/quality-agent.d/050-libs-needed @@ -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 index 000000000..8430e46bd --- /dev/null +++ b/tools/quality-agent.d/050-libs-soname @@ -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