3 cd `rpm --eval %{_builddir}`
5 # note this works for both a.out and ELF executables
6 # it also auto-generates requirment lines for shell scripts
10 filelist=`sed "s/['\"]/\\\&/g"`
11 for i in /examples/ /doc/; do
12 filelist=`echo $filelist | sed "s!\<[^[:space:]]*$i[^[:space:]]*[[:space:]]*!!g"`
14 if [ -f __rpm_noautoreqfiles ] ; then
15 for i in `cat __rpm_noautoreqfiles`; do
16 filelist=`echo $filelist | sed "s![[:space:]]*$i[[:space:]]*!!g"`
20 # --- Alpha does not mark 64bit dependencies
23 *) mark64="()(64bit)" ;;
26 exelist=`echo $filelist | xargs -r file | grep ":.*executable" |grep -v ":.*script"| cut -d: -f1 `
27 elfexelist=`echo $exelist | xargs -r file | egrep ":.* ELF" | cut -d: -f1 `
28 aoutexelist=`echo $exelist | xargs -r file | egrep -v ":.* ELF" | cut -d: -f1 `
29 scriptlist=`echo $filelist | xargs -r file | egrep ":.* (commands|script) .*executable" | cut -d: -f1 `
30 liblist=`echo $filelist | xargs -r file | grep ":.*shared object" | cut -d : -f1 `
31 elfliblist=`echo $liblist | xargs -r file | egrep ":.* ELF" | cut -d: -f1 `
32 aoutliblist=`echo $liblist | xargs -r file | egrep -v ":.* ELF" | cut -d: -f1 `
34 aoutexerequires=`for f in $aoutexelist; do
35 ldd $f | awk '/=>/ { print $1 }'
36 done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | grep -v 'libNoVersion.so' | sort -u
39 elfexerequires=`for f in $elfexelist; do
40 lib64=`if file -L $f 2>/dev/null | \
41 grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
42 objdump -p $f | awk -v lib64="$lib64" '/NEEDED/ {print $2 lib64}'
43 done | sed "s/['\"]/\\\&/g" | grep -v 'libNoVersion.so' | sort -u
46 aoutlibrequires=`for f in $aoutliblist; do
47 ldd $f | awk '/=>/ { print $1 }'
48 done | sort -u | sed "s/['\"]/\\\&/g" | xargs -r -n 1 basename | grep -v 'libNoVersion.so' | sort -u
51 elflibrequires=`for f in $elfliblist; do
52 lib64=`if file -L $f 2>/dev/null | \
53 grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
54 objdump -p $f | awk -v lib64="$lib64" '/NEEDED/ {print $2 lib64}'
55 done | sed "s/['\"]/\\\&/g" | grep -v 'libNoVersion.so' | sort -u
58 scriptrequires=`for f in $scriptlist; do
60 head -1 $f | sed -ne '/^\#\!/p' | sed -e 's/^\#\![ ]*//' | cut -d" " -f1
65 elflibverrequires=`for f in $liblist $exelist ; do
67 BEGIN { START=0; LIBNAME=""; }
68 /Version References:/ { START=1; }
69 /required from/ && (START==1) {
73 (START==1) && (LIBNAME!="") && ($4~/^GLIBC_*/) { print LIBNAME "(" $4 ")"; }
78 # Generate name of rpm package provides library
80 allrequires="$aoutexerequires
86 if [ -f __rpm_noautoreq ] ; then
87 for i in `cat __rpm_noautoreq`; do
88 scriptrequires=`echo $scriptrequires | sed "s!\<$i[[:space:]]*!!g"`
89 allrequires=`echo $allrequires | sed "s!\<$i[[:space:]]*!!g"`
93 # omit autoreqdep for scriptrequires
94 echo "$scriptrequires"
96 # Delete all the provided stuff
98 echo $filelist|/usr/lib/rpm/find-provides|awk '
102 printf "$0 !~ \"^" $0 "$\" "
106 }' > .findreq_delprovs_$$
107 notprovreqs=`echo "$allrequires"|awk -f .findreq_delprovs_$$`
108 rm .findreq_delprovs_$$
109 echo "$notprovreqs" | sort -u
111 if [ -f __rpm_noautoreqdep ] ; then
112 for i in `cat __rpm_noautoreqdep`; do
113 notprovreqs=`echo $notprovreqs | sed "s!\<$i[[:space:]]*!!g"`
117 echo "$notprovreqs" | LC_ALL=C xargs -r -- rpm -q --whatprovides --qf "%{NAME}\n" 2>/dev/null \
118 | grep -v "no package provides" | sort -u