From 6ba11111889a39a5b34ea7f9ed597ca60ea5b2441a19becfacd6723106f43768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Wed, 14 Feb 2018 09:41:06 +0000 Subject: [PATCH] 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 --- find-provides.ksyms | 81 ++++++++++++++++++++++++++++++++++++++ find-requires.ksyms | 29 ++++++++++++++ findksyms.diff | 95 --------------------------------------------- rpm.changes | 5 +++ rpm.spec | 6 ++- 5 files changed, 120 insertions(+), 96 deletions(-) create mode 100644 find-provides.ksyms create mode 100644 find-requires.ksyms diff --git a/find-provides.ksyms b/find-provides.ksyms new file mode 100644 index 0000000..5de8984 --- /dev/null +++ b/find-provides.ksyms @@ -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 diff --git a/find-requires.ksyms b/find-requires.ksyms new file mode 100644 index 0000000..ebb87be --- /dev/null +++ b/find-requires.ksyms @@ -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 diff --git a/findksyms.diff b/findksyms.diff index 891a35f..3f9ce7f 100644 --- a/findksyms.diff +++ b/findksyms.diff @@ -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 diff --git a/rpm.changes b/rpm.changes index e3b532b..750d653 100644 --- a/rpm.changes +++ b/rpm.changes @@ -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 diff --git a/rpm.spec b/rpm.spec index d5b86e9..1d0796f 100644 --- a/rpm.spec +++ b/rpm.spec @@ -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}