summaryrefslogtreecommitdiff
path: root/build/rpm/filter-requires
blob: 379415dc9a514dcfdcd154be8e8b4b919141e882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
#
# Filter to exclude some Requires targets from those automatically
# generated by rpmbuild's helper script find-requires
#
# Specifically intended for Perl modules that PCP uses, but which
# may not be packaged in some distributions.
#

_usage()
{
    echo >&2 "Usage: $0 [option] path-to-real-find-requires [arg]"
    echo >&2 "Options:"
    echo >&2 " -f fedora_version"
    echo >&2 " -r redhat_version"
    echo >&2 " -v vendor (\"redhat\" or \"suse\" or ...)"
}

#debug# echo >&2 "$0 called as: $0 $*"

FEDORA=0
REDHAT=0
VENDOR=unknown
while getopts "f:r:v:?" c
do
    case $c
    in
	f)
	    FEDORA="$OPTARG"
	    ;;
	r)
	    REDHAT="$OPTARG"
	    ;;
	v)
	    VENDOR="$OPTARG"
	    ;;
    esac
done
shift `expr $OPTIND - 1`

if [ $# -lt 1 ]
then
    _usage
    exit 1
fi

if [ ! -f "$1" ]
then
    echo "$0: Error: rpm script $1 not found"
    exit 1
fi

# Filtering depends on distro vendor and possibly version
#
# Lines from find-requires look like this ...
# /bin/sh
# libc.so.6()(64bit)
# libc.so.6(GLIBC_2.2.5)(64bit)
# perl(Spreadsheet::Read)
# perl(strict)
#
case "$VENDOR"
in
    redhat)
	# See RedHat BZ 830923 and BZ 754678 for Spreadsheet::Read
	# issues.
	# Does not seem to matter what version of RH or Fedora.
	$* \
	| sed \
	    -e '/^perl(Spreadsheet::Read)$/d'
	;;
    *)
	$*
	;;
esac