From: Steve Youngs Date: Sat, 15 Mar 2014 00:56:33 +0000 (+1000) Subject: Prevent update-pkg-project returning false-positives X-Git-Url: http://cgit.sxemacs.org/?p=pkgusr;a=commitdiff_plain;h=26373ab08186f51e3b6d78981695dd39041ca7dd Prevent update-pkg-project returning false-positives * usr/lib/pkgusr/pkgawk.awk: New. * usr/lib/pkgusr/update-pkg-project (pkgawk): The new awk script file for the hairy dependency extractor. This is a slightly modified version of the "one-liner" that is more robust and doesn't catch false-positives. (upd_pkg_deps): Use it. Signed-off-by: Steve Youngs --- diff --git a/usr/lib/pkgusr/pkgdeps.awk b/usr/lib/pkgusr/pkgdeps.awk new file mode 100644 index 0000000..981649f --- /dev/null +++ b/usr/lib/pkgusr/pkgdeps.awk @@ -0,0 +1,4 @@ + /NEEDED/ { lib=substr($5,2,length($5)-2); LIBS[lib]=$5 } \ +/.*=>/ {if ( $1 in LIBS ) LIBS[$1]=$3 } \ +match($0,/^\s+(\/[^ ]+\/([^ ]+)) /,m) { if ( m[2] in LIBS ) LIBS[m[2]]=m[1] } \ +END { for (lib in LIBS) print LIBS[lib] } diff --git a/usr/lib/pkgusr/update-pkg-project b/usr/lib/pkgusr/update-pkg-project index feef549..2dfcd11 100755 --- a/usr/lib/pkgusr/update-pkg-project +++ b/usr/lib/pkgusr/update-pkg-project @@ -10,16 +10,14 @@ if [ -z "${pkg}" ]; then fi pkgdir=/usr/src/${pkg} +pkgawk=/usr/lib/pkgusr/pkgdeps.awk upd_pkg_deps() { for file in $(forall_direntries_from $pkg -type f -executable -readable); do if readelf -d $file &>/dev/null && ldd $file &>/dev/null; then (readelf -d $file ; ldd $file ) | - awk '/NEEDED/ { lib=substr($5,2,length($5)-2); LIBS[lib]=$5 } \ - /.*=>/ {if ( $1 in LIBS ) LIBS[$1]=$3 } END \ - { for (lib in LIBS) print LIBS[lib] }' | - xargs stat --printf "%U:%G\n" + awk -f ${pkgawk} | xargs stat --printf "%U:%G\n" fi done|sort -u|tr -s '\n' ' ' }