add rpm helper scripts (formerly in rpm-build)

This commit is contained in:
Tom Callaway 2019-07-30 14:49:24 -04:00
parent 58ede9f7bc
commit fba27de001
4 changed files with 147 additions and 1 deletions

42
mono-find-provides Executable file
View File

@ -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

86
mono-find-requires Executable file
View File

@ -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

3
mono.attr Normal file
View File

@ -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

View File

@ -23,7 +23,7 @@
%global xamarinrelease 28 %global xamarinrelease 28
Name: mono Name: mono
Version: 5.18.1 Version: 5.18.1
Release: 9%{?dist} Release: 10%{?dist}
Summary: Cross-platform, Open Source, .NET development framework Summary: Cross-platform, Open Source, .NET development framework
License: MIT License: MIT
@ -34,6 +34,11 @@ Source0: http://download.mono-project.com/sources/mono/mono-%{version}.%{
# sn -k mono.snk # sn -k mono.snk
# You should not regenerate this unless you have a really, really, really good reason. # You should not regenerate this unless you have a really, really, really good reason.
Source1: mono.snk 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 Patch0: mono-5.10.0-ignore-reference-assemblies.patch
Patch1: mono-4.2.1-ppc.patch Patch1: mono-4.2.1-ppc.patch
Patch2: mono-5.10.0-find-provides.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. # 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 - 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 %find_lang mcs
%post %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/metadata/*.h
%{_includedir}/mono-2.0/mono/utils/*.h %{_includedir}/mono-2.0/mono/utils/*.h
%{_includedir}/mono-2.0/mono/cil/opcode.def %{_includedir}/mono-2.0/mono/cil/opcode.def
%{_prefix}/lib/rpm/mono-find-*
%{_prefix}/lib/rpm/fileattrs/mono.attr
%files locale-extras %files locale-extras
%gac_dll I18N.CJK %gac_dll I18N.CJK
@ -889,6 +901,9 @@ cert-sync /etc/pki/tls/certs/ca-bundle.crt
%files complete %files complete
%changelog %changelog
* Tue Jul 30 2019 Tom Callaway <spot@fedoraproject.org> - 5.18.1-10
- add rpm helper scripts (formerly in rpm-build)
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.18.1-9 * Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.18.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild