summaryrefslogtreecommitdiff
path: root/src/devtools/lddd.in
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-01-17 21:14:02 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-01-17 21:14:02 -0500
commitc79e6971d56c347cee39fe2e601226865ac2ae1e (patch)
tree4e26187f01ac14e9f23b89b9eb70dc92f35eb952 /src/devtools/lddd.in
parent5c2dd97a91421e6e5f7e920579fcb88bb71e7fa7 (diff)
parent512436524cd3e70b9394d304bc9a43c6858c3695 (diff)
Merge commit '512436524cd3e70b9394d304bc9a43c6858c3695' as 'src/devtools'
Diffstat (limited to 'src/devtools/lddd.in')
-rw-r--r--src/devtools/lddd.in48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/devtools/lddd.in b/src/devtools/lddd.in
new file mode 100644
index 0000000..4040ce6
--- /dev/null
+++ b/src/devtools/lddd.in
@@ -0,0 +1,48 @@
+#!/bin/bash
+#
+# lddd - find broken library links on your machine
+#
+
+source @pkgdatadir@/common.sh
+
+ifs=$IFS
+IFS="${IFS}:"
+
+libdirs="/lib /usr/lib /usr/local/lib $(cat /etc/ld.so.conf.d/*)"
+extras=
+
+TEMPDIR=$(mktemp -d --tmpdir lddd-script.XXXX)
+
+msg 'Go out and drink some tea, this will take a while :) ...'
+# Check ELF binaries in the PATH and specified dir trees.
+for tree in $PATH $libdirs $extras; do
+ msg2 "DIR $tree"
+
+ # Get list of files in tree.
+ files=$(find $tree -type f ! -name '*.a' ! -name '*.la' ! -name '*.py*' ! -name '*.txt' ! -name '*.h' ! -name '*.ttf' ! \
+ -name '*.rb' ! -name '*.ko' ! -name '*.pc' ! -name '*.enc' ! -name '*.cf' ! -name '*.def' ! -name '*.rules' ! -name \
+ '*.cmi' ! -name '*.mli' ! -name '*.ml' ! -name '*.cma' ! -name '*.cmx' ! -name '*.cmxa' ! -name '*.pod' ! -name '*.pm' \
+ ! -name '*.pl' ! -name '*.al' ! -name '*.tcl' ! -name '*.bs' ! -name '*.o' ! -name '*.png' ! -name '*.gif' ! -name '*.cmo' \
+ ! -name '*.cgi' ! -name '*.defs' ! -name '*.conf' ! -name '*_LOCALE' ! -name 'Compose' ! -name '*_OBJS' ! -name '*.msg' ! \
+ -name '*.mcopclass' ! -name '*.mcoptype')
+ IFS=$ifs
+ for i in $files; do
+ if (( $(file $i | grep -c 'ELF') != 0 )); then
+ # Is an ELF binary.
+ if (( $(ldd $i 2>/dev/null | grep -c 'not found') != 0 )); then
+ # Missing lib.
+ echo "$i:" >> $TEMPDIR/raw.txt
+ ldd $i 2>/dev/null | grep 'not found' >> $TEMPDIR/raw.txt
+ fi
+ fi
+ done
+done
+grep '^/' $TEMPDIR/raw.txt | sed -e 's/://g' >> $TEMPDIR/affected-files.txt
+# invoke pacman
+for i in $(cat $TEMPDIR/affected-files.txt); do
+ pacman -Qo $i | awk '{print $4,$5}' >> $TEMPDIR/pacman.txt
+done
+# clean list
+sort -u $TEMPDIR/pacman.txt >> $TEMPDIR/possible-rebuilds.txt
+
+msg "Files saved to $TEMPDIR"