summaryrefslogtreecommitdiff
path: root/revdep
diff options
context:
space:
mode:
authorMatt Housh <jaeger@morpheus.net>2014-02-20 14:11:30 +0100
committerJuergen Daubert <jue@jue.li>2014-02-20 14:11:30 +0100
commit797ab496918f468b0476b599d01256a1ff0a3c7a (patch)
tree16a0af31ff06c4bf098c581d19d8d884ecef113e /revdep
parentc3dec92a22ff7b0dae9123c5522ff1567511d59c (diff)
downloadprt-utils-797ab496918f468b0476b599d01256a1ff0a3c7a.tar.gz
prt-utils-797ab496918f468b0476b599d01256a1ff0a3c7a.tar.xz
revdep: fix false errors for libraries in non-standard locations
Diffstat (limited to 'revdep')
-rwxr-xr-xrevdep61
1 files changed, 46 insertions, 15 deletions
diff --git a/revdep b/revdep
index 385764c..fbae8f4 100755
--- a/revdep
+++ b/revdep
@@ -1,35 +1,66 @@
#!/bin/bash
-# check linkage
-# Johannes Winkelmann, jw at tks6 dot net
+#
+# revdep - check library and executable linking for issues after
+# package upgrades
+#
+# Johannes Winkelmann, jw at tks6 dot net
+# Matt Housh, jaeger at morpheus dot net
+#
# Usage:
#
# Formatted listing:
-# RD_VERBOSE=1 ./revdep
-# Include errorous files:
-# RD_VERBOSE=2 ./revdep
+# RD_VERBOSE=1 revdep
+# Include individual broken files in output:
+# RD_VERBOSE=2 revdep
#
-# Pure list to be used as input to prt-get update
-# ./revdep
+# Pure list to be used as input to prt-get update:
+# revdep
#
-# With an optional argument, only that port is checked
+# With an optional argument, only that port is checked:
+# revdep samba
+#
+
+#set -x
+
+get_lib_paths() {
+ missing_files=($(ldd "$1" 2>/dev/null | awk '/not found/ { print $1 }'))
+ (for file in ${missing_files[*]}; do \
+ if [ "$file" != "" ]; then \
+ dirname /$(pkginfo -o "$file" | awk 'NR==2 { print $2 }'); \
+ fi; \
+ done) | sort | uniq
+}
check_linking() {
- # set -x
+ #set -x
err=0
- files="`awk -v p="$1" -v RS="" '$1==p' /var/lib/pkg/db`"
+ files="$(awk -v p="$1" -v RS="" '$1==p' /var/lib/pkg/db)"
for f in $files; do
if [ -f "/$f" ]; then
if [ ! -r "/$f" ]; then
[ "$RD_VERBOSE" = "2" ] && echo "$1: couldn't read $f"
else
- file -b "/$f" |grep -q 'shared'
+ file -b "/$f" | grep -q "shared"
if [ $? -eq 0 ]; then
- ldd "/$f" 2> /dev/null |grep "not found" &> /dev/null
+ ldd "/$f" 2>/dev/null | grep "not found" &>/dev/null
if [ $? -eq 0 ]; then
- [ "$RD_VERBOSE" = "2" ] && echo "$1: error in /$f"
- err=1
+ owner=$(pkginfo -o "/$f" | awk 'NR==2 { print $1 }')
+ if [ "$owner" = "$1" ]; then
+ lib_paths=($(get_lib_paths "/$f"))
+ export IFS=$':'
+ paths=$(echo "${lib_paths[*]}")
+ unset IFS
+ LD_LIBRARY_PATH=$paths:$LD_LIBRARY_PATH ldd "/$f" 2>/dev/null | grep "not found" &>/dev/null
+ if [ $? -eq 0 ]; then
+ [ "$RD_VERBOSE" = "2" ] && echo "$1: error in /$f"
+ err=1
+ fi
+ else
+ [ "$RD_VERBOSE" = "2" ] && echo "$1: error in /$f"
+ err=1
+ fi
fi
fi
fi
@@ -42,7 +73,7 @@ check_linking() {
[ -n "$RD_VERBOSE" ] && echo "** calculating deps"
if [ -z "$1" ]; then
- ports=(`pkginfo -i|awk '{print $1}'`)
+ ports=($(pkginfo -i| awk '{ print $1 }'))
[ -n "$RD_VERBOSE" ] && echo "** Checking ${#ports[*]} ports"
else
ports=($@)

Generated by cgit