From fba27de001aaa1ec4fb558f0c41e2447d3145d35 Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Tue, 30 Jul 2019 14:49:24 -0400 Subject: [PATCH] add rpm helper scripts (formerly in rpm-build) --- mono-find-provides | 42 ++++++++++++++++++++++ mono-find-requires | 86 ++++++++++++++++++++++++++++++++++++++++++++++ mono.attr | 3 ++ mono.spec | 17 ++++++++- 4 files changed, 147 insertions(+), 1 deletion(-) create mode 100755 mono-find-provides create mode 100755 mono-find-requires create mode 100644 mono.attr diff --git a/mono-find-provides b/mono-find-provides new file mode 100755 index 0000000..554bffe --- /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 100755 index 0000000..6f96761 --- /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 new file mode 100644 index 0000000..98dc8d9 --- /dev/null +++ b/mono.attr @@ -0,0 +1,3 @@ +%__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 diff --git a/mono.spec b/mono.spec index 6950bb7..74db620 100644 --- a/mono.spec +++ b/mono.spec @@ -23,7 +23,7 @@ %global xamarinrelease 28 Name: mono Version: 5.18.1 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Cross-platform, Open Source, .NET development framework License: MIT @@ -34,6 +34,11 @@ Source0: http://download.mono-project.com/sources/mono/mono-%{version}.%{ # sn -k mono.snk # You should not regenerate this unless you have a really, really, really good reason. Source1: mono.snk +# These scripts were taken from rpm-build in Fedora 30 +# They're significantly different from what is included in the mono sources. +Source2: mono-find-provides +Source3: mono-find-requires +Source4: mono.attr Patch0: mono-5.10.0-ignore-reference-assemblies.patch Patch1: mono-4.2.1-ppc.patch Patch2: mono-5.10.0-find-provides.patch @@ -453,6 +458,11 @@ cd %{buildroot}/usr/lib/mono && ln -s 4.7.1-api 4.5-api && cd - # as requested in bug 1704861; we have had that link in F29 with Mono 4.8 as well. cd %{buildroot}/usr/lib/mono && ln -s 4.7.1-api 4.0-api && cd - +# rpm helper scripts +mkdir -p %{buildroot}%{_prefix}/lib/rpm/fileattrs/ +install -p -m755 %{SOURCE2} %{SOURCE3} %{buildroot}%{_prefix}/lib/rpm/ +install -p -m644 %{SOURCE4} %{buildroot}%{_prefix}/lib/rpm/fileattrs/ + %find_lang mcs %post @@ -717,6 +727,8 @@ cert-sync /etc/pki/tls/certs/ca-bundle.crt %{_includedir}/mono-2.0/mono/metadata/*.h %{_includedir}/mono-2.0/mono/utils/*.h %{_includedir}/mono-2.0/mono/cil/opcode.def +%{_prefix}/lib/rpm/mono-find-* +%{_prefix}/lib/rpm/fileattrs/mono.attr %files locale-extras %gac_dll I18N.CJK @@ -889,6 +901,9 @@ cert-sync /etc/pki/tls/certs/ca-bundle.crt %files complete %changelog +* Tue Jul 30 2019 Tom Callaway - 5.18.1-10 +- add rpm helper scripts (formerly in rpm-build) + * Thu Jul 25 2019 Fedora Release Engineering - 5.18.1-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild