libpcp: optimise DSO lookups for local context mode startup
[pcp.git] / build / rpm / filter-requires
blobbeb15d38052bc7c2570961ffba1011b6a95b4c64
1 #!/bin/sh
3 # Filter to exclude some Requires targets from those automatically
4 # generated by rpmbuild's helper script find-requires
6 # Specifically intended for Perl modules that PCP uses, but which
7 # may not be packaged in some distributions.
10 _usage()
12 echo >&2 "Usage: $0 [option] path-to-real-find-requires [arg]"
13 echo >&2 "Options:"
14 echo >&2 " -f fedora_version"
15 echo >&2 " -r redhat_version"
16 echo >&2 " -v vendor (\"redhat\" or \"suse\" or ...)"
19 #debug# echo >&2 "$0 called as: $0 $*"
21 FEDORA=0
22 REDHAT=0
23 VENDOR=unknown
24 while getopts "f:r:v:?" c
26 case $c
29 FEDORA="$OPTARG"
32 REDHAT="$OPTARG"
35 VENDOR="$OPTARG"
37 esac
38 done
39 shift `expr $OPTIND - 1`
41 if [ $# -lt 1 ]
42 then
43 _usage
44 exit 1
47 if [ ! -f "$1" ]
48 then
49 echo "$0: Error: rpm script $1 not found"
50 exit 1
53 # Filtering depends on distro vendor and possibly version
55 # Lines from find-requires look like this ...
56 # /bin/sh
57 # libc.so.6()(64bit)
58 # libc.so.6(GLIBC_2.2.5)(64bit)
59 # perl(Spreadsheet::Read)
60 # perl(strict)
62 case "$VENDOR"
64 redhat)
65 # See RedHat BZ 830923 and BZ 754678 for Spreadsheet::Read
66 # issues.
67 # Does not seem to matter what version of RH or Fedora.
68 $* \
69 | sed \
70 -e '/^perl(Spreadsheet::Read)$/d'
75 esac \
76 | sed -e '/^#/d' -e '/^[ ]*$/d'
78 # last filter is because the rpm "find-requires" on some platforms emits
79 # lines with a leading # and blank lines ... these kill the rpm packaging
80 # with the dreaded "Failed to find Requires:" error message
82 exit 0