Skip to Content.
Sympa Menu

sm-discuss - [SM-Discuss] Computed dependencies

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: neuron <vlmarek AT volny.cz>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: [SM-Discuss] Computed dependencies
  • Date: Thu, 19 Jan 2006 00:44:02 +0100

I tried to do utility to find binary dependencies of installed spell.
It:
* Looks for all binary files in the install log
* For each binary it looks for all libraries the binary needs
* For each library it tries to find the spell to which it belongs

Example:

--------------------------------------------------

$ ./check.sh gnupg
Spell: gnupg
Executable files:
=================
/usr/bin/gpg
/usr/bin/gpgsplit
/usr/bin/gpgv
/usr/libexec/gnupg/gpgkeys_finger
/usr/libexec/gnupg/gpgkeys_hkp
/usr/libexec/gnupg/gpgkeys_http

Libraries:
==========
libncursesw.so.5:
ncurses-5.4
ncurses-5.5
ncurses-5.4
ncurses-5.5

libreadline.so.5:
readline-5.0
readline-5.0.5
readline-5.1
readline-5.0
readline-5.0.5
readline-5.1

libresolv.so.2:

libz.so.1:
zlib-1.2.3
zlib-1.2.3

Library dependencies:
=====================
ncurses
readline
zlib

--------------------------------------------------

If I do

$ gaze dependencies gnupg 2
gnupg ()
gettext (optional)
bzip2 (optional)
openldap (optional)
nasm (optional)
libusb (optional)


Isn't gnupg spell missing depends for ncurses, readline and zlib ?

I'm attaching the script. It's still quite raw, but should work.

--
neuron
#!/bin/bash

#. /var/lib/sorcery/modules/libhash
#. /etc/sorcery/config

SPELL=$1

function AddLib ()
{ (
while read DEP; do
echo $DEP
echo ${DEP%-*} >> $TMPFILE2
done
) }

TMPFILE=$( mktemp /tmp/check.XXXXXXXX )
TMPFILE2=$( mktemp /tmp/check.XXXXXXXX )
>$TMPFILE
>$TMPFILE2

echo Spell: $SPELL

echo Executable files:
echo =================
gaze -q install $SPELL |
(
while read LINE; do
if file "$LINE" | grep -q ELF; then
echo $LINE
objdump -p $LINE | grep NEEDED | gawk '{ print $2 }' |
grep -v libdl.so |
grep -v libpthread.so |
grep -v libstdc++.so |
grep -v libm.so |
grep -v libgcc_s.so |
grep -v libc.so >> $TMPFILE
fi
done
)

echo
echo Libraries:
echo ==========
cat $TMPFILE | sort | uniq | (
while read LIB; do
echo $LIB:

# look for libraries in install log
grep -E "$LIB$" /var/log/sorcery/install/* |
sed -e 's,^/var/log/sorcery/install/,,' -e 's/:.*$//'
|
AddLib

# look for libraries in md5sum log
grep -E "\s*$LIB$" /var/log/sorcery/md5sum/* |
sed -e 's,^/var/log/sorcery/md5sum/,,' -e
's/\s\+.*//' -e 's/:.\{32\}$//' |
AddLib

echo
done
)

echo Library dependencies:
echo =====================
cat $TMPFILE2 | sort | uniq | grep -v $SPELL
rm $TMPFILE $TMPFILE2

Attachment: pgptjmkQVKpeH.pgp
Description: PGP signature




Archive powered by MHonArc 2.6.24.

Top of Page