1
0
forked from pool/kernel-source
kernel-source/find-provides
OBS User autobuild 95cedd20c8 Accepting request 42266 from Kernel:openSUSE-11.3
Copy from Kernel:openSUSE-11.3/kernel-source based on submit request 42266 from user michal-m

OBS-URL: https://build.opensuse.org/request/show/42266
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kernel-source?expand=0&rev=100
2010-06-29 16:25:47 +00:00

46 lines
1.2 KiB
Bash

#! /bin/bash
set -x
builddir="$1"
shift
filelist=$(mktemp -t ${0##*/}.XXXXXXXXXX)
trap "rm -f $filelist" EXIT
cat >"$filelist"
flavor=${1##*-}
grep -v '\.ko$' | /usr/lib/rpm/find-provides "$@" | grep -v '^ksym('
# HACK: find out what subpackage is this and just print the symsets
# computed in %build. We need to do it this way because the provided
# symsets are computed from the modules AND the reference symsets, which
# we don't see here.
subpack=
samemodules()
{
cmp -s <(sed -rn 's:.*/([^/]*\.ko)$:\1:p' "$1" | sort) \
<(sed -rn 's:.*/([^/]*\.ko)$:\1:p' "$2" | sort)
}
if ! grep -q '\.ko$' "$filelist"; then
# no modules, no symsets
exit 0
fi
if samemodules "$builddir"/base-modules "$filelist"; then
symsets=("$builddir/base-symsets")
elif samemodules "$builddir"/main-modules "$filelist"; then
symsets=("$builddir/base-symsets" "$builddir/main-symsets")
elif samemodules "$builddir"/unsupported-modules "$filelist"; then
symsets=("$builddir/extra-symsets")
else
echo "find-provides: failed to determine which subpackage is this" >&2
exit 1
fi
find "${symsets[@]}" -type f -printf '%f\n' | \
sed -rn 's/^\.?(.+)\.([a-z0-9]{16})(\.fake)?$/kernel('$flavor':\1) = \2/p'
exit 0