Accepting request 574311 from home:michals

- Use ksym-provides tool (bsc#1077692).

OBS-URL: https://build.opensuse.org/request/show/574311
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=438
This commit is contained in:
Michael Schröder 2018-02-14 09:41:06 +00:00 committed by Git OBS Bridge
parent 4be37b0142
commit 6ba1111188
5 changed files with 120 additions and 96 deletions

81
find-provides.ksyms Normal file
View File

@ -0,0 +1,81 @@
#! /bin/bash
IFS=$'\n'
is_opensuse=false
if test "$1" = "--opensuse"; then
if test "$2" -gt 0; then
is_opensuse=true
fi
shift 2
fi
if ! $is_opensuse; then
trap 'rm -f "$tmp"' EXIT
tmp=$(mktemp)
fi
while read f; do
test -e "$f" || continue
is_module=""
case "$f" in
*.debug)
continue
;;
*/boot/vmlinu[xz]-*)
flavor=${f##*/vmlinu[xz]-}
flavor=${flavor%.gz}
echo "kernel-uname-r = $flavor"
version=${flavor}
flavor=${flavor##*-}
;;
*/lib/modules/*/*.ko | */lib/modules/*/*.ko.gz | */boot/vmlinu[xz]*)
is_module="1"
;;
*)
continue
esac
if $is_opensuse; then
continue
fi
unzip=false
case "$f" in
*.gz | */boot/vmlinuz*)
unzip=true
esac
if $unzip && gzip -cd "$f" >"$tmp"; then
f=$tmp
fi
if test -z "$flavor" -a -n "$is_module" ; then
flavor=$(/sbin/modinfo -F vermagic "$f")
flavor=${flavor%% *}
version=${flavor}
flavor=${flavor##*-}
fi
if test -z "$flavor"; then
echo "warning: cannot determine kernel flavor from $(/sbin/modinfo -F vermagic "$f" 2>&1)" >&2
continue
fi
objdir=$(readlink /lib/modules/$version/build)
objdir_build=$RPM_BUILD_ROOT$(readlink $RPM_BUILD_ROOT/lib/modules/$version/build)
for i in $objdir_build $objdir ; do
ksym_provides=$i/scripts/mod/ksym-provides
[ -x $ksym_provides ] && break
done
if [ -x $ksym_provides ] ; then
$ksym_provides $flavor $f
else
major=${version%%.*}
sub=${version#*.}
sub=${sub%%.*}
if [ "$major" -ge 4 -a "$sub" -ge 10 ] ; then
echo "error: cannot determine ksym provides of $f - missing ksym-povides tool." >&2
else
nm "$f" \
| sed -r -ne "s/^0*([0-9a-f]+) A __crc_(.+)/ksym($flavor:\\2) = \\1/p"
fi
fi
done \
| sort -u

29
find-requires.ksyms Normal file
View File

@ -0,0 +1,29 @@
#! /bin/bash
IFS=$'\n'
is_opensuse=false
if test "$1" = "--opensuse"; then
if test "$2" -gt 0; then
is_opensuse=true
fi
shift 2
fi
if ! $is_opensuse && ! test -e /sbin/modprobe; then
cat > /dev/null
exit 0
fi
for f in $(grep -E '/lib/modules/.+\.ko$' | grep -v '/lib/modules/[^/]*/kernel/'); do
flavor=${f#*/lib/modules/}
flavor=${flavor%%/*}
if $is_opensuse; then
echo "kernel-uname-r = $flavor"
continue
fi
flavor=${flavor##*-}
/sbin/modprobe --dump-modversions "$f" \
| sed -r -ne "s/^0x0*([0-9a-f]+)[[:blank:]]+(.+)/ksym($flavor:\\2) = \\1/p"
done | sort -u

View File

@ -16,98 +16,3 @@
metainfo.prov \
mono-find-requires mono-find-provides \
pkgconfigdeps.sh libtooldeps.sh \
--- ./scripts/find-provides.ksyms.orig 2018-01-31 13:08:40.820934977 +0000
+++ ./scripts/find-provides.ksyms 2018-01-31 13:08:40.820934977 +0000
@@ -0,0 +1,60 @@
+#! /bin/bash
+
+IFS=$'\n'
+
+is_opensuse=false
+
+if test "$1" = "--opensuse"; then
+ if test "$2" -gt 0; then
+ is_opensuse=true
+ fi
+ shift 2
+fi
+
+if ! $is_opensuse; then
+ trap 'rm -f "$tmp"' EXIT
+ tmp=$(mktemp)
+fi
+
+
+while read f; do
+ test -e "$f" || continue
+ case "$f" in
+ *.debug)
+ continue
+ ;;
+ */boot/vmlinu[xz]-*)
+ flavor=${f##*/vmlinu[xz]-}
+ flavor=${flavor%.gz}
+ echo "kernel-uname-r = $flavor"
+ flavor=${flavor##*-}
+ ;;
+ */lib/modules/*/*.ko | */lib/modules/*/*.ko.gz | */boot/vmlinu[xz]*)
+ ;;
+ *)
+ continue
+ esac
+ if $is_opensuse; then
+ continue
+ fi
+ unzip=false
+ case "$f" in
+ *.gz | */boot/vmlinuz*)
+ unzip=true
+ esac
+ if $unzip && gzip -cd "$f" >"$tmp"; then
+ f=$tmp
+ fi
+ if test -z "$flavor"; then
+ flavor=$(/sbin/modinfo -F vermagic "$f")
+ flavor=${flavor%% *}
+ flavor=${flavor##*-}
+ fi
+ if test -z "$flavor"; then
+ echo "warning: cannot determine kernel flavor from $(/sbin/modinfo -F vermagic "$f" 2>&1)" >&2
+ continue
+ fi
+ nm "$f" \
+ | sed -r -ne "s/^0*([0-9a-f]+) A __crc_(.+)/ksym($flavor:\\2) = \\1/p"
+done \
+| sort -u
--- ./scripts/find-requires.ksyms.orig 2018-01-31 13:08:40.821934974 +0000
+++ ./scripts/find-requires.ksyms 2018-01-31 13:08:40.820934977 +0000
@@ -0,0 +1,29 @@
+#! /bin/bash
+
+IFS=$'\n'
+
+is_opensuse=false
+
+if test "$1" = "--opensuse"; then
+ if test "$2" -gt 0; then
+ is_opensuse=true
+ fi
+ shift 2
+fi
+
+if ! $is_opensuse && ! test -e /sbin/modprobe; then
+ cat > /dev/null
+ exit 0
+fi
+
+for f in $(grep -E '/lib/modules/.+\.ko$' | grep -v '/lib/modules/[^/]*/kernel/'); do
+ flavor=${f#*/lib/modules/}
+ flavor=${flavor%%/*}
+ if $is_opensuse; then
+ echo "kernel-uname-r = $flavor"
+ continue
+ fi
+ flavor=${flavor##*-}
+ /sbin/modprobe --dump-modversions "$f" \
+ | sed -r -ne "s/^0x0*([0-9a-f]+)[[:blank:]]+(.+)/ksym($flavor:\\2) = \\1/p"
+done | sort -u

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Feb 7 17:23:48 UTC 2018 - msuchanek@suse.com
- Use ksym-provides tool (bsc#1077692).
-------------------------------------------------------------------
Wed Feb 7 09:13:41 UTC 2018 - dimstar@opensuse.org

View File

@ -63,6 +63,8 @@ Source10: beecrypt-4.1.2.tar.bz2
Source11: db-4.8.30.tar.bz2
Source12: baselibs.conf
Source13: rpmconfigcheck.service
Source14: find-provides.ksyms
Source15: find-requires.ksyms
Patch1: beecrypt-4.1.2.diff
Patch2: db.diff
Patch3: rpm-4.12.0.1-fix-bashisms.patch
@ -232,10 +234,12 @@ rm -f rpmdb/db.h
%patch6464
%endif
cp %{SOURCE14} %{SOURCE15} scripts
cp config.guess config.sub db/dist/
cp config.guess config.sub beecrypt/
#chmod 755 scripts/find-supplements{,.ksyms}
#chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms
chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms
#chmod 755 scripts/firmware.prov
#chmod 755 scripts/debuginfo.prov
tar -xjvf %{SOURCE1}