aboutsummaryrefslogtreecommitdiffstats
path: root/find-provides.in
blob: 90b0c3da1eb2b02726d5b025646703a0f3c138ad (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
76
77
#!/bin/bash

# This script reads filenames from STDIN and outputs any relevant provides
# information that needs to be included in the package.

filelist=`sed "s/['\"]/\\\&/g"`

rubygemlist=$(echo "$filelist"| egrep "\.gemspec$")                                                                                                         

# fix parsing output of objdump when localized (mga#7883):
export LC_ALL=C

#
# --- If libperl.so is found in buildroot, we provide perlapi-<version>
if [ -n "`echo $filelist | grep -e '/CORE/libperl\.so'`" ]; then
    for i in $filelist; do
        if [ -n "`echo $i | grep -e '/CORE/libperl\.so\$'`" ]; then
            perlpath=$i
            version=${i/CORE*/}
            version=$(echo $version| sed -e 's!/$!!' -e 's!/[^/]*$!!' -e 's!.*/!!')
            minor=$(echo $version| sed -e 's!^.*\.!!')
            major=$(echo $version| sed -e 's!\.[0-9]*$!!')
            if [ -n "$version" ] && [ -n "$minor" ]; then
               for i in $(seq 0 $minor); do echo "perlapi-$major.$i"; done
            fi
        fi
    done
fi

#
# --- Kernel modules.
[ -x @RPMVENDORDIR@/kmod.prov ] &&
    echo "$filelist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/kmod.prov | sort -u \
    	&& test ${PIPESTATUS[2]} -ne 0 && echo 'error: @RPMVENDORDIR@/kmod.prov failed' >&2 && exit 1

#
# --- typelib() gobject-introspection bindings
[ -x @RPMVENDORDIR@/gi-find-deps.sh ] &&
    echo "$filelist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/gi-find-deps.sh -P | sort -u \
        && test ${PIPESTATUS[2]} -ne 0 && echo 'error: @RPMVENDORDIR@/gi-find-deps.sh failed' >&2 && exit 1

[ -x /usr/lib/rpm/rpmdeps -a -n "$filelist" ] &&
	echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/rpmdeps --provides

#
# --- Ruby gems
[ -x /usr/bin/ruby -a -x @RPMVENDORDIR@/rubygems.rb -a -n "$rubygemlist" ] &&
    echo $rubygemlist | tr '[:blank:]' \\n | @RPMVENDORDIR@/rubygems.rb --provides | sort -u \
    	&& test ${PIPESTATUS[2]} -ne 0 && echo 'error: @RPMVENDORDIR@/rubygems.rb failed' >&2 && exit 1

#
# --- .so files.
for i in `echo $filelist | tr '[:blank:]' "\n" | egrep '(/usr(/X11R6)?)?/lib(|64)(/gcc(-lib)?/.+)?/[^/]+\.so$'`; do
    objd=`objdump -p ${i} | grep SONAME`
    [ -h ${i} -a -n "${objd}" ] && \
    lib64=`if file -L $i 2>/dev/null | grep "ELF 64-bit" >/dev/null; then echo "(64bit)"; fi` && \
    echo ${objd} | perl -p -e "s/.*SONAME\s+(\S+)\.so.*/devel(\1$lib64)/g"
done | sort -u

#
# --- haskell provides
if [ -x /usr/bin/haskell-find-provides ]; then
echo $filelist | tr '[:blank:]' '\n' | /usr/bin/haskell-find-provides \
    	&& test ${PIPESTATUS[2]} -ne 0 && echo 'error: /usr/bin/haskell-find-provides failed' >&2 && exit 1
fi

#
# --- gstreamer modules.
[ -x @RPMVENDORDIR@/gstreamer.prov ] &&
    echo "$solist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/gstreamer.prov | sort -u \
    	&& test ${PIPESTATUS[2]} -ne 0 && echo 'error: @RPMVENDORDIR@/gstreamer.prov failed' >&2 && exit 1

[ -x @RPMVENDORDIR@/gstreamer1.0.prov ] &&
    echo "$solist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/gstreamer1.0.prov | sort -u \
        && test ${PIPESTATUS[2]} -ne 0 && echo 'error: @RPMVENDORDIR@/gstreamer1.0.prov failed' >&2 && exit 1

exit 0