From e8624b5d06be2ae06c96514b3c9b118f3f834f7ba0707a1e83ab2d2fb3a6972b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismail=20D=C3=B6nmez?= Date: Wed, 27 May 2020 09:35:59 +0000 Subject: [PATCH] - Add mono-find-provides and mono-find-requires from Fedora and use it instead. Fixes boo#1152775 OBS-URL: https://build.opensuse.org/package/show/Mono:Factory/mono-core?expand=0&rev=211 --- mono-core.changes | 6 ++++ mono-core.spec | 8 +++++ mono-find-provides | 42 ++++++++++++++++++++++ mono-find-requires | 86 ++++++++++++++++++++++++++++++++++++++++++++++ mono.attr | 4 +-- 5 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 mono-find-provides create mode 100644 mono-find-requires diff --git a/mono-core.changes b/mono-core.changes index 96d2449..45b5330 100644 --- a/mono-core.changes +++ b/mono-core.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed May 27 09:35:05 UTC 2020 - Ismail Dönmez + +- Add mono-find-provides and mono-find-requires from Fedora and use + it instead. Fixes boo#1152775 + ------------------------------------------------------------------- Tue May 26 19:57:47 UTC 2020 - Michael Gorse diff --git a/mono-core.spec b/mono-core.spec index eb8576f..0c95598 100644 --- a/mono-core.spec +++ b/mono-core.spec @@ -52,6 +52,8 @@ Source0: http://download.mono-project.com/sources/mono/mono-%{version}.%{ Source1: mono-core.rpmlintrc Source2: gmcs Source3: mono.attr +Source4: mono-find-provides +Source5: mono-find-requires # ppc build segfault so exclude it ExcludeArch: ppc # PATCH-FIX-OPENSUSE remove checks for libmono in mono-find-provides and mono-find-requires scripts @@ -285,6 +287,10 @@ make # install the rpm file attributes to arm the dependency scanner mkdir -p %{buildroot}%{_rpmconfigdir}/fileattrs install %{SOURCE3} %{buildroot}%{_rpmconfigdir}/fileattrs/mono.attr + +# Install custom mono-find-{provides/requires} +install -p -m755 %{SOURCE4} %{SOURCE5} %{buildroot}%{_rpmconfigdir} + %endif # Remove hardcoded lib directory from the config @@ -1306,6 +1312,8 @@ Mono development tools. %if 0%{?suse_version} > 1500 %{_rpmconfigdir}/fileattrs/mono.attr +%{_rpmconfigdir}/mono-find-provides +%{_rpmconfigdir}/mono-find-requires %endif %{_bindir}/mono-find-provides diff --git a/mono-find-provides b/mono-find-provides new file mode 100644 index 0000000..d2cb60f --- /dev/null +++ b/mono-find-provides @@ -0,0 +1,42 @@ +#!/usr/bin/bash +# +# mono-find-provides +# +# Authors: +# Ben Maurer (bmaurer@ximian.com) +# +# (C) 2005 Novell (http://www.novell.com) +# +# Args: builddir buildroot libdir + +IFS=$'\n' +filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/')) +monolist=($(printf "%s\n" "${filelist[@]}" | grep -E "\\.(exe|dll)\$")) + +# If monodis is in the package being installed, use that one +# This is to support building mono +build_bindir="$2/usr/bin" +build_libdir="$2$3" + +if [ -x $build_bindir/monodis ]; then + monodis="$build_bindir/monodis" + export LD_LIBRARY_PATH=$build_libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} +elif [ -x /usr/bin/monodis ]; then + monodis="/usr/bin/monodis" +else + exit 0; +fi + +export MONO_SHARED_DIR=$1 + +for i in "${monolist[@]}"; do + ($monodis --assembly $i | awk ' + BEGIN { LIBNAME=""; VERSION=""; } + /^Version:/ { VERSION=$2 } + /^Name:/ { LIBNAME=$2 } + END { + if (VERSION && LIBNAME) + print "mono(" LIBNAME ") = " VERSION + } + ') 2>/dev/null +done diff --git a/mono-find-requires b/mono-find-requires new file mode 100644 index 0000000..5955a48 --- /dev/null +++ b/mono-find-requires @@ -0,0 +1,86 @@ +#!/usr/bin/bash +# +# mono-find-requires +# +# Authors: +# Ben Maurer (bmaurer@ximian.com) +# +# (C) 2005 Novell (http://www.novell.com) +# +# Args: builddir buildroot libdir + +IFS=$'\n' +filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/')) +monolist=($(printf "%s\n" "${filelist[@]}" | grep -E "\\.(exe|dll)\$")) + +# If monodis is in the package being installed, use that one +# This is to support building mono +build_bindir="$2/usr/bin" +build_libdir="$2$3" + +if [ -x $build_bindir/monodis ]; then + monodis="$build_bindir/monodis" + export LD_LIBRARY_PATH=$build_libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} +elif [ -x /usr/bin/monodis ]; then + monodis="/usr/bin/monodis" +else + exit 0; +fi + +export MONO_SHARED_DIR=$1 + +REQUIRES=$( + for i in "${monolist[@]}"; do + ($monodis --assemblyref $i | awk ' + BEGIN { START=0; LIBNAME=""; VERSION=""; } + (START==0) && /^[0-9]+: Version=/ { + START=1; + sub(/Version=/, "", $2); + VERSION=$2 + } + + (START==1) && /^\tName=/ { + sub(/Name=/, "", $1); + LIBNAME=$1 + + print "mono(" LIBNAME ") = " VERSION + START=0 + } + ') 2> /dev/null + done +) + +PROVIDES=$( + for i in "${monolist[@]}"; do + ($monodis --assembly $i | awk ' + BEGIN { LIBNAME=""; VERSION=""; } + /^Version:/ { VERSION=$2 } + /^Name:/ { LIBNAME=$2 } + END { + if (VERSION && LIBNAME) + print "mono(" LIBNAME ") = " VERSION + } + ') 2>/dev/null + done +) +# +# This is a little magic trick to get all REQUIRES that are not +# in PROVIDES. While RPM functions correctly when such deps exist, +# they make the metadata a bit bloated. +# + +# Filter out dups from both lists +REQUIRES=$(echo "$REQUIRES" | sort | uniq) +PROVIDES=$(echo "$PROVIDES" | sort | uniq) + +# +# Get a list of elements that exist in exactly one of PROVIDES or REQUIRES +# +UNIQ=$(echo "$PROVIDES +$REQUIRES" | sort | uniq -u) + +# +# Of those, only chose the ones that are in REQUIRES +# +echo "$UNIQ +$REQUIRES" | sort | uniq -d diff --git a/mono.attr b/mono.attr index 6ef5541..1302bf6 100644 --- a/mono.attr +++ b/mono.attr @@ -1,3 +1,3 @@ -%__mono_provides %{_bindir}/mono-find-provides %{_builddir}/%{?buildsubdir} %{buildroot} %{_libdir} -%__mono_requires %{_bindir}/mono-find-requires %{_builddir}/%{?buildsubdir} %{buildroot} %{_libdir} +%__mono_provides %{_rpmconfigdir}/mono-find-provides %{_builddir}/%{?buildsubdir} %{buildroot} %{_libdir} +%__mono_requires %{_rpmconfigdir}/mono-find-requires %{_builddir}/%{?buildsubdir} %{buildroot} %{_libdir} %__mono_magic Mono/.Net assembly