]> git.pld-linux.org Git - packages/rpm.git/blobdiff - rpm-find-requires
typo
[packages/rpm.git] / rpm-find-requires
index c4b1bfbbf8697ad7ae6d2b738145fe764be36283..e1db63e3537ea8ad8cbc0648632c04920b250a53 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+cd `rpm --eval %{_builddir}`
+
 # note this works for both a.out and ELF executables
 # it also auto-generates requirment lines for shell scripts
 
@@ -9,10 +11,15 @@ filelist=`sed "s/['\"]/\\\&/g"`
 for i in /examples/ /doc/; do
 filelist=`echo $filelist | sed "s!\<[^[:space:]]*$i[^[:space:]]*[[:space:]]*!!g"`
 done
-exelist=`echo $filelist | xargs -r file | grep ":.*executable" | cut -d: -f1 `
+if [ -f __rpm_noautoreqfiles ] ; then
+       for i in `cat __rpm_noautoreqfiles`; do
+               filelist=`echo $filelist | sed "s![[:space:]]*$i[[:space:]]*!!g"`
+       done
+fi
+exelist=`echo $filelist | xargs -r file | grep ":.*executable" |grep -v ":.*script"| cut -d: -f1 `
 elfexelist=`echo $exelist | xargs -r file | egrep  ":.* ELF" | cut -d: -f1 `
 aoutexelist=`echo $exelist | xargs -r file | egrep  -v ":.* ELF" | cut -d: -f1 `
-scriptlist=`echo $filelist | xargs -r file | egrep ":.* (commands|script) " | cut -d: -f1 `
+scriptlist=`echo $filelist | xargs -r file | egrep ":.* (commands|script) .*executable" | cut -d: -f1 `
 liblist=`echo $filelist | xargs -r file | grep ":.*shared object" | cut -d : -f1 `
 elfliblist=`echo $liblist | xargs -r file | egrep  ":.* ELF" | cut -d: -f1 `
 aoutliblist=`echo $liblist | xargs -r file | egrep  -v ":.* ELF" | cut -d: -f1 `
@@ -40,7 +47,7 @@ elflibrequires=`for f in $elfliblist; do
        objdump -p $f|awk '/NEEDED/ {print $2}'
 done | sed "s/['\"]/\\\&/g" | grep -v 'libNoVersion.so' | sort -u
 `
-    
+
 for f in $scriptlist; do
     if [ -x $f ]; then
        head -1 $f | sed -ne '/^\#\!/p' | sed -e 's/^\#\![      ]*//' | cut -d" " -f1
@@ -61,16 +68,37 @@ for f in $liblist $exelist ; do
 done | sort -u
 # Generate name of rpm package provides library
 
-
-echo "$aoutexerequires
+allrequires="$aoutexerequires
 $elfexerequires
 $aoutlibrequires
-$elflibrequires" \
-       | sort -u
+$elflibrequires"
 
-echo "$aoutexerequires
-$elfexerequires
-$aoutlibrequires
-$elflibrequires" \
-       | xargs -r -- rpm -q --whatprovides --qf "%{NAME}\n"  2>/dev/null \
-       | sort -u
+if [ -f __rpm_noautoreq ] ; then
+       for i in `cat __rpm_noautoreq`; do
+               allrequires=`echo $allrequires | sed "s!\<$i[[:space:]]*!!g"`
+       done
+fi
+
+if [ -f __rpm_noautoreqdep ] ; then
+       for i in `cat __rpm_noautoreqdep`; do
+               allrequires=`echo $allrequires | sed "s!\<$i[[:space:]]*!!g"`
+       done
+fi
+
+# Delete all the provided stuff
+
+echo $filelist|/usr/lib/rpm/find-provides|awk '
+{
+       if (FNR!=1)
+               printf "&& "
+       printf "$0 !~ \"^" $0 "$\" "
+}
+END {
+       print "{ print $0 }"
+}' > .findreq_delprovs_$$
+notprovreqs=`echo "$allrequires"|awk -f .findreq_delprovs_$$`
+rm .findreq_delprovs_$$
+echo "$notprovreqs" | sort -u
+
+echo "$notprovreqs" | LC_ALL=C xargs -r -- rpm -q --whatprovides --qf "%{NAME}\n"  2>/dev/null \
+       | grep -v "no package provides" | sort -u
This page took 0.041379 seconds and 4 git commands to generate.