Rebootstrap

We want to build the package in CentOS Stream 8. Unfortunately, CentOS
Stream 8 doesn't have a recent version of .NET 6 in its buildroot. So we
need to re-bootstrap .NET using prebuilts binaries.

Related: RHBZ#2228566
This commit is contained in:
Omair Majid 2023-08-23 13:37:07 -04:00
parent d8521a3005
commit cb95358e1d
4 changed files with 43 additions and 13 deletions

3
.gitignore vendored
View File

@ -4,3 +4,6 @@ SOURCES/dotnet-v6.0.114.tar.gz
/dotnet-v6.0.119.tar.gz
/dotnet-v6.0.120.tar.gz
/dotnet-v6.0.121.tar.gz
/dotnet-v6.0.121-x64-bootstrap.tar.xz
/dotnet-prebuilts-6.0.120-arm64.tar.gz
/dotnet-prebuilts-6.0.120-s390x.tar.gz

View File

@ -166,7 +166,9 @@ if [[ ${build_bootstrap} == true ]]; then
mkdir -p fixup-previously-source-built-artifacts
pushd fixup-previously-source-built-artifacts
tar xf ../packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz
find . -iname '*fedora*nupkg' -delete
find . -iname '*fedora*nupkg' -print -delete
find . -iname '*centos.7*nupkg' -print -delete
find . -iname '*linux-musl-*nupkg' -print -delete
# We must keep the original file names in the archive, even prepending a ./ leads to issues
tar -I 'gzip -1' -cf ../packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz *
popd
@ -205,7 +207,7 @@ rm -r src/source-build/src/humanizer/samples/
popd
if [[ ${build_bootstrap} == true ]]; then
tar -I 'xz -T 0' -cf "${tarball_name}${tarball_suffix}" "${tarball_name}"
tar -I 'xz -9 -T 0' -cf "${tarball_name}${tarball_suffix}" "${tarball_name}"
else
tar -czf "${tarball_name}${tarball_suffix}" "${tarball_name}"
fi

View File

@ -1,4 +1,5 @@
%bcond_with bootstrap
# CentOS Koji doesn't understand %%bootstrap
%bcond_without bootstrap_dotnet
# Avoid provides/requires from private libraries
%global privlibs libhostfxr
@ -60,19 +61,20 @@
Name: dotnet6.0
Version: %{sdk_rpm_version}
Release: 2%{?dist}
Release: 3%{?dist}
Summary: .NET Runtime and SDK
License: MIT and ASL 2.0 and BSD and LGPLv2+ and CC-BY and CC0 and MS-PL and EPL-1.0 and GPL+ and GPLv2 and ISC and OFL and zlib
URL: https://github.com/dotnet/
%if %{with bootstrap}
%if %{with bootstrap_dotnet}
%global bootstrap_sdk_version 6.0.120
# The source is generated on a RHEL box via:
# ./build-dotnet-tarball --bootstrap %%{upstream_tag}
Source0: dotnet-%{upstream_tag}-x64-bootstrap.tar.xz
# Generated via ./build-arm64-bootstrap-tarball
Source1: dotnet-arm64-prebuilts-2021-10-29.tar.gz
Source1: dotnet-prebuilts-%{bootstrap_sdk_version}-arm64.tar.gz
# Generated manually, same pattern as the arm64 tarball
Source2: dotnet-s390x-prebuilts-2021-10-29.tar.gz
Source2: dotnet-prebuilts-%{bootstrap_sdk_version}-s390x.tar.gz
%else
# The source is generated on a RHEL box via:
# ./build-dotnet-tarball %%{upstream_tag}
@ -122,7 +124,7 @@ ExclusiveArch: x86_64
BuildRequires: clang
BuildRequires: cmake
BuildRequires: coreutils
%if %{without bootstrap}
%if %{without bootstrap_dotnet}
BuildRequires: dotnet-sdk-6.0
BuildRequires: dotnet-sdk-6.0-source-built-artifacts
%endif
@ -348,7 +350,7 @@ These are not meant for general use.
%prep
%if %{without bootstrap}
%if %{without bootstrap_dotnet}
%setup -q -n dotnet-%{upstream_tag}
%else
@ -368,11 +370,28 @@ tar xf packages/prebuilt/dotnet-sdk*.tar.gz -C .dotnet/
rm packages/prebuilt/dotnet-sdk*.tar.gz
boot_sdk_version=$(ls -1 .dotnet/sdk/)
sed -i -E 's|"dotnet": "[^"]+"|"dotnet" : "'$boot_sdk_version'"|' global.json
%ifarch ppc64le s390x
ilasm_version=$(ls packages/prebuilt| grep -i ilasm | tr 'A-Z' 'a-z' | sed -E 's|runtime.linux-'%{runtime_arch}'.microsoft.netcore.ilasm.||' | sed -E 's|.nupkg$||')
echo $ilasm_version
mkdir -p packages-customized-local
pushd packages-customized-local
tar xf ../packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz
sed -i -E 's|<MicrosoftNETCoreILAsmVersion>[^<]+</MicrosoftNETCoreILAsmVersion>|<MicrosoftNETCoreILAsmVersion>'$ilasm_version'</MicrosoftNETCoreILAsmVersion>|' PackageVersions.props
sed -i -E 's|<MicrosoftNETCoreILAsmPackageVersion>[^<]+</MicrosoftNETCoreILAsmPackageVersion>|<MicrosoftNETCoreILAsmPackageVersion>'$ilasm_version'</MicrosoftNETCoreILAsmPackageVersion>|' PackageVersions.props
sed -i -E 's|<MicrosoftNETCoreILDAsmVersion>[^<]+</MicrosoftNETCoreILDAsmVersion>|<MicrosoftNETCoreILDAsmVersion>'$ilasm_version'</MicrosoftNETCoreILDAsmVersion>|' PackageVersions.props
sed -i -E 's|<MicrosoftNETCoreILDAsmPackageVersion>[^<]+</MicrosoftNETCoreILDAsmPackageVersion>|<MicrosoftNETCoreILDAsmPackageVersion>'$ilasm_version'</MicrosoftNETCoreILDAsmPackageVersion>|' PackageVersions.props
tar czf ../packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz *
popd
%endif
%endif
%endif
%if %{without bootstrap}
%if %{without bootstrap_dotnet}
# Remove all prebuilts
find -iname '*.dll' -type f -delete
find -iname '*.so' -type f -delete
@ -438,7 +457,7 @@ sed -i -E 's|( /p:BuildDebPackage=false)|\1 --cmakeargs -DCLR_CMAKE_USE_SYSTEM_L
%build
cat /etc/os-release
%if %{without bootstrap}
%if %{without bootstrap_dotnet}
# We need to create a copy because we will mutate this
cp -a %{_libdir}/dotnet previously-built-dotnet
%endif
@ -480,7 +499,7 @@ export EXTRA_CXXFLAGS="$CXXFLAGS"
export EXTRA_LDFLAGS="$LDFLAGS"
VERBOSE=1 ./build.sh \
%if %{without bootstrap}
%if %{without bootstrap_dotnet}
--with-sdk previously-built-dotnet \
%endif
-- \
@ -612,6 +631,10 @@ rm -rf %{buildroot}%{_libdir}/dotnet/packs/NETStandard.Library.Ref/2.1.0
%changelog
* Wed Aug 23 2023 Omair Majid <omajid@redhat.com> - 6.0.121-3
- Rebootstrap
- Related: RHBZ#2228566
* Wed Aug 09 2023 Omair Majid <omajid@redhat.com> - 6.0.121-2
- Update to .NET SDK 6.0.121 and Runtime 6.0.21
- Resolves: RHBZ#2228566

View File

@ -1 +1,3 @@
SHA512 (dotnet-v6.0.121.tar.gz) = 98c6215451846a4463381b4a93e5b7ed91a8a30440e62859765e31da8d009591d629bbcd32927dc9efde837daf12b0e2bb0cd7d62c93d031e66553e1988325c8
SHA512 (dotnet-v6.0.121-x64-bootstrap.tar.xz) = 1276be22a32a63f6738e2283279540a5f2b5c122aefd21ee5b2971f9d51111d8174c5c48a85e25fc34013eb9ea6e2c4627ffb65c738fa48802ef976b5460d070
SHA512 (dotnet-prebuilts-6.0.120-arm64.tar.gz) = 4b6fe67029ec7c199479ca6feb283db59279b3d813d12bfba698346aebbd128674d374d1314dd7e38ab85fa6afbe8f6bab9c013e306b00c06e203c7c31e3c08f
SHA512 (dotnet-prebuilts-6.0.120-s390x.tar.gz) = 9e83f98456debec7cbe08f4aace84e0980483736be75babb87d6dff4d18a0da2cfd390d970935de014ef397158be1d8659ba6105667c23eba9a431bcda50713a