]> git.pld-linux.org Git - packages/rpm.git/blob - rpm-find-provides-wrapper
- redone _noautocompress handling to use parameter instead of file
[packages/rpm.git] / rpm-find-provides-wrapper
1 #!/bin/sh
2
3 # _noauto* wrapper for builtin rpm Provides generator
4 # requires:             /bin/sh, /usr/bin/rpmdeps, coreutils, findutils
5 # input (stdin):        filenames (one per line)
6 # output (stdout):      Provides list (one per line)
7
8 # note that no large list is stored in shell variable - this was VERY slow
9
10 ulimit -c 0
11
12 PERLOPT="--define=__perl_provides /bin/sh -c 'cat >/dev/null'"
13 PHPOPT="--define=__php_provides /bin/sh -c 'cat >/dev/null'"
14 noprovfiles=''
15 noprov=''
16 buildroot=''
17 while [ $# -gt 0 ]; do
18         case "$1" in
19           --with-perl)
20                 PERLOPT=""
21                 ;;
22           --with-php)
23                 PHPOPT=""
24                 ;;
25           --buildroot=*)
26                 buildroot="${1#--buildroot=}"
27                 ;;
28           --noautoprovfiles=*)
29                 for i in ${1#--noautoprovfiles=} ; do
30                         noprovfiles="${noprovfiles}\|${buildroot}${i}"
31                 done
32                 ;;
33           --noautoprov=*)
34                 for i in ${1#--noautoprov=} ; do
35                         noprov="${noprov}\|${i}"
36                 done
37         esac
38         shift
39 done
40
41 if [ -r /etc/rpm/noautoprovfiles ]; then
42         for i in `cat /etc/rpm/noautoprovfiles | grep -v '^#'`; do
43                 noprovfiles="${noprovfiles}\|${buildroot}${i}"
44         done
45 fi
46
47 if [ -r /etc/rpm/noautoprov ]; then
48         for i in `cat /etc/rpm/noautoprov | grep -v '^#'`; do
49                 noprov="${noprov}\|${i}"
50         done
51 fi
52
53 # rpmdeps output seems sorted, but resort it in case of long list split
54 grep -v -e "^\(${noprovfiles}\)\$" | tr '\n' '\0' | \
55         xargs -r -0 /usr/bin/rpmdeps "${PERLOPT}" "${PHPOPT}" --provides | \
56         LC_ALL=C sort -u | grep -v -e "^\(${noprov}\)\$"
57
58 exit 0
This page took 0.121142 seconds and 3 git commands to generate.