Update for bootstrapping 5.0

This commit is contained in:
Omair Majid 2021-01-18 10:26:45 -05:00
parent 1204433667
commit 12422fd0a6
3 changed files with 72 additions and 78 deletions

View File

@ -1,50 +0,0 @@
#!/bin/bash
set -euo pipefail
set -x
sdk_version=3.1.105
arch=$(uname -m)
if [[ $arch == "x86_64" ]]; then
arch=x64
elif [[ $arch == "aarch64" ]]; then
arch=arm64
fi
if rpm -qa | grep libunwind; then
echo "error: libunwind is installed. Not a good idea for bootstrapping."
exit 1
fi
if rpm -qa | grep dotnet ; then
echo "error: dotnet is installed. Not a good idea for bootstrapping."
exit 1
fi
if [ -d /usr/lib/dotnet ] || [ -d /usr/lib64/dotnet ] || [ -d /usr/share/dotnet ] ; then
echo "error: one of /usr/lib/dotnet /usr/lib64/dotnet or /usr/share/dotnet/ exists. Not a good idea for bootstrapping."
exit 1
fi
if command -v dotnet ; then
echo "error: dotnet is in $PATH. Not a good idea for bootstrapping."
exit 1
fi
if [ ! -d dotnet-source-build-tarball ]; then
if [ ! -d source-build ]; then
git clone https://github.com/dotnet/source-build
fi
pushd source-build
sed -i -e 's|cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE||' repos/coreclr.common.props
git clean -xdf
./build-source-tarball.sh ../dotnet-source-build-tarball/ -- -p:DownloadSourceBuildReferencePackagesTimeoutSeconds=100000
popd
fi
rm -rf dotnet-v${sdk_version}-SDK dotnet-v${sdk_version}-SDK.tar.gz
cp -a dotnet-source-build-tarball dotnet-v${sdk_version}-SDK
cp -a source-build/artifacts/$arch/Release/Private.SourceBuilt.Artifacts.*.tar.gz dotnet-v${sdk_version}-SDK/packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz
tar czf dotnet-v${sdk_version}-SDK-$arch.tar.gz dotnet-v${sdk_version}-SDK

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Usage: # Usage:
# build-dotnet-tarball <tag-from-source-build> # build-dotnet-tarball [--bootstrap] <tag-from-source-build>
# #
# Creates a source archive from a tag (or commit) at github.com/dotnet/source-build # Creates a source archive from a tag (or commit) at github.com/dotnet/source-build
@ -13,32 +13,41 @@
set -euo pipefail set -euo pipefail
IFS=$'\n\t' IFS=$'\n\t'
print_usage() { function print_usage {
echo "Usage:" echo "Usage:"
echo "$0 <tag-from-source-build>" echo "$0 [--bootstrap] <tag-from-source-build>"
echo echo
echo "Creates a source archive from a tag at https://github.com/dotnet/source-build" echo "Creates a source archive from a tag at https://github.com/dotnet/source-build"
echo ""
echo " --bootstrap build a source tarball usable for bootstrapping .NET"
} }
clean_dotnet_cache() { function clean_dotnet_cache {
rm -rf ~/.aspnet ~/.dotnet/ ~/.nuget/ ~/.local/share/NuGet ~/.templateengine rm -rf ~/.aspnet ~/.dotnet/ ~/.nuget/ ~/.local/share/NuGet ~/.templateengine
rm -rf /tmp/NuGet /tmp/NuGetScratch /tmp/.NETCore* /tmp/.NETStandard* /tmp/.dotnet /tmp/dotnet.* /tmp/clr-debug-pipe* /tmp/Razor-Server /tmp/CoreFxPipe* /tmp/VBCSCompiler /tmp/.NETFramework* rm -rf /tmp/NuGet /tmp/NuGetScratch /tmp/.NETCore* /tmp/.NETStandard* /tmp/.dotnet /tmp/dotnet.* /tmp/clr-debug-pipe* /tmp/Razor-Server /tmp/CoreFxPipe* /tmp/VBCSCompiler /tmp/.NETFramework*
} }
function check_bootstrap_environment {
if rpm -qa | grep libunwind-devel; then
echo "error: libunwind-devel is installed. Not a good idea for bootstrapping."
exit 1
fi
if rpm -qa | grep dotnet ; then
echo "error: dotnet is installed. Not a good idea for bootstrapping."
exit 1
fi
if [ -d /usr/lib/dotnet ] || [ -d /usr/lib64/dotnet ] || [ -d /usr/share/dotnet ] ; then
echo "error: one of /usr/lib/dotnet /usr/lib64/dotnet or /usr/share/dotnet/ exists. Not a good idea for bootstrapping."
exit 1
fi
if command -v dotnet ; then
echo "error: dotnet is in $PATH. Not a good idea for bootstrapping."
exit 1
fi
}
function runtime_id { function runtime_id {
declare -A archmap
archmap=(
["aarch64"]="arm64"
["amd64"]="x64"
["armv8l"]="arm"
["i686"]="x86"
["i386"]="x86"
["x86_64"]="x64"
)
arch=${archmap["$(uname -m)"]}
source /etc/os-release source /etc/os-release
case "${ID}" in case "${ID}" in
# Remove the RHEL minor version # Remove the RHEL minor version
@ -50,10 +59,29 @@ function runtime_id {
echo "${ID}.${rid_version}-${arch}" echo "${ID}.${rid_version}-${arch}"
} }
build_bootstrap=false
declare -A archmap
archmap=(
["aarch64"]="arm64"
["amd64"]="x64"
["armv8l"]="arm"
["i686"]="x86"
["i386"]="x86"
["x86_64"]="x64"
)
arch=${archmap["$(uname -m)"]}
positional_args=() positional_args=()
while [[ "$#" -gt 0 ]]; do while [[ "$#" -gt 0 ]]; do
arg="${1}" arg="${1}"
case "${arg}" in case "${arg}" in
--bootstrap)
build_bootstrap=true
shift
;;
-h|--help) -h|--help)
print_usage print_usage
exit 0 exit 0
@ -78,6 +106,11 @@ dir_name="dotnet-${tag}"
unmodified_tarball_name="${dir_name}-original" unmodified_tarball_name="${dir_name}-original"
tarball_name="${dir_name}" tarball_name="${dir_name}"
if [[ ${build_bootstrap} == true ]]; then
unmodified_tarball_name="${unmodified_tarball_name}-${arch}-bootstrap"
tarball_name="${tarball_name}-${arch}-bootstrap"
fi
if [ -f "${tarball_name}.tar.gz" ]; then if [ -f "${tarball_name}.tar.gz" ]; then
echo "error: ${tarball_name}.tar.gz already exists" echo "error: ${tarball_name}.tar.gz already exists"
exit 1 exit 1
@ -94,6 +127,10 @@ if [ ! -f "${unmodified_tarball_name}.tar.gz" ]; then
# FIXME remove contineuonprebuilterror # FIXME remove contineuonprebuilterror
./build.sh -p:SkipPrebuiltEnforcement=true -p:ContinueOnPrebuiltBaselineError=true -p:ArchiveDownloadedPackages=true -p:UseSystemLibraries=true ./build.sh -p:SkipPrebuiltEnforcement=true -p:ContinueOnPrebuiltBaselineError=true -p:ArchiveDownloadedPackages=true -p:UseSystemLibraries=true
./build-source-tarball.sh "${unmodified_tarball_name}" --skip-build -- -p:ContinueOnPrebuiltBaselineError=true -p:SkipPrebuiltEnforcement=true ./build-source-tarball.sh "${unmodified_tarball_name}" --skip-build -- -p:ContinueOnPrebuiltBaselineError=true -p:SkipPrebuiltEnforcement=true
if [[ ${build_bootstrap} == true ]]; then
cp -a artifacts/"${arch}"/Release/Private.SourceBuilt.Artifacts.*.tar.gz "${unmodified_tarball_name}"/packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz
fi
popd popd
popd popd
@ -107,12 +144,17 @@ tar xf "${unmodified_tarball_name}.tar.gz"
mv "${unmodified_tarball_name}" "${tarball_name}" mv "${unmodified_tarball_name}" "${tarball_name}"
pushd "${tarball_name}" pushd "${tarball_name}"
if [[ ${build_bootstrap} != true ]]; then
find . -type f -iname '*.tar.gz' -delete
rm -rf .dotnet
fi
# Remove files with funny licenses, crypto implementations and other # Remove files with funny licenses, crypto implementations and other
# not-very-useful artifacts to reduce tarball size # not-very-useful artifacts to reduce tarball size
rm -r src/aspnetcore.*/src/SignalR/clients/java/signalr/gradle* rm -r src/aspnetcore.*/src/SignalR/clients/java/signalr/gradle*
find src/aspnetcore.*/src -type d -name samples -print0 | xargs -0 rm -r find src/aspnetcore.*/src -type d -name samples -print0 | xargs -0 rm -r
rm -r src/NuGet.Client.*/test/EndToEnd rm -r src/NuGet.Client.*/test/EndToEnd
find src/runtime.*/ -depth -name tests -print0 | xargs -0 rm -r
rm -r src/runtime.*/src/mono/ rm -r src/runtime.*/src/mono/
rm -r src/Humanizer.*/samples/ rm -r src/Humanizer.*/samples/

View File

@ -63,7 +63,7 @@ URL: https://github.com/dotnet/
# The source is generated on a Fedora box via: # The source is generated on a Fedora box via:
# ./build-dotnet-tarball v%%{src_version}-SDK # ./build-dotnet-tarball v%%{src_version}-SDK
Source0: dotnet-v%{src_version}-SDK-337413b.tar.gz Source0: dotnet-9c4e5de-x64-bootstrap.tar.gz
Source1: check-debug-symbols.py Source1: check-debug-symbols.py
Source2: dotnet.sh.in Source2: dotnet.sh.in
@ -87,7 +87,7 @@ BuildRequires: clang
BuildRequires: cmake BuildRequires: cmake
BuildRequires: coreutils BuildRequires: coreutils
%if %{without bootstrap} %if %{without bootstrap}
BuildRequires: dotnet-build-reference-packages BuildRequires: dotnet-5.0-build-reference-packages
BuildRequires: dotnet-sdk-5.0 BuildRequires: dotnet-sdk-5.0
BuildRequires: dotnet-sdk-5.0-source-built-artifacts BuildRequires: dotnet-sdk-5.0-source-built-artifacts
%endif %endif
@ -310,7 +310,7 @@ These are not meant for general use.
%prep %prep
%setup -q -n dotnet-v%{src_version}-SDK-337413b %setup -q -n dotnet-9c4e5de-x64-bootstrap
%if %{without bootstrap} %if %{without bootstrap}
# Remove all prebuilts # Remove all prebuilts
@ -324,10 +324,9 @@ rm -rf packages/source-built
%endif %endif
%if %{without bootstrap} %if %{without bootstrap}
sed -i -e 's|5.0.100-preview1-014459|5.0.103|' global.json
mkdir -p packages/archive mkdir -p packages/archive
ln -s %{_libdir}/dotnet/source-built-artifacts/*.tar.gz packages/archive/ ln -s %{_libdir}/dotnet/source-built-artifacts/*.tar.gz packages/archive/
ln -s %{_libdir}/dotnet/reference-packages/Private.SourceBuild.ReferencePackages*.tar.gz packages/archive ln -s %{_libdir}/dotnet/reference-packages/*.tar.gz packages/archive
%endif %endif
# Fix bad hardcoded path in build # Fix bad hardcoded path in build
@ -467,8 +466,8 @@ echo "%{_libdir}/dotnet" >> install_location
install -dm 0755 %{buildroot}%{_sysconfdir}/dotnet install -dm 0755 %{buildroot}%{_sysconfdir}/dotnet
install install_location %{buildroot}%{_sysconfdir}/dotnet/ install install_location %{buildroot}%{_sysconfdir}/dotnet/
#install -dm 0755 %%{buildroot}%%{_libdir}/dotnet/source-built-artifacts install -dm 0755 %{buildroot}%{_libdir}/dotnet/source-built-artifacts
#install artifacts/%%{runtime_arch}/Release/Private.SourceBuilt.Artifacts.*.tar.gz %%{buildroot}/%%{_libdir}/dotnet/source-built-artifacts/ install artifacts/%{runtime_arch}/Release/Private.SourceBuilt.Artifacts.*.tar.gz %{buildroot}/%{_libdir}/dotnet/source-built-artifacts/
# Check debug symbols in all elf objects. This is not in %%check # Check debug symbols in all elf objects. This is not in %%check
# because native binaries are stripped by rpm-build after %%install. # because native binaries are stripped by rpm-build after %%install.
@ -522,13 +521,16 @@ echo "Testing build results for debug symbols..."
%{_libdir}/dotnet/sdk/%{sdk_version} %{_libdir}/dotnet/sdk/%{sdk_version}
%dir %{_libdir}/dotnet/packs %dir %{_libdir}/dotnet/packs
#%%files -n dotnet-sdk-5.0-source-built-artifacts %files -n dotnet-sdk-5.0-source-built-artifacts
#%%dir %%{_libdir}/dotnet %dir %{_libdir}/dotnet
#%%{_libdir}/dotnet/source-built-artifacts %{_libdir}/dotnet/source-built-artifacts
%changelog %changelog
* Fri Dec 04 13:22:13 EST 2020 Omair Majid <omajid@redhat.com> - 5.0.100-1 * Fri Dec 18 2020 Omair Majid <omajid@redhat.com> - 5.0.100-2
- Update to .NET Core Runtime 5.0.0 and SDK 5.0.100 commit 9c4e5de
* Fri Dec 04 2020 Omair Majid <omajid@redhat.com> - 5.0.100-1
- Update to .NET Core Runtime 5.0.0 and SDK 5.0.100 - Update to .NET Core Runtime 5.0.0 and SDK 5.0.100
* Thu Dec 03 2020 Omair Majid <omajid@redhat.com> - 5.0.100-0.4.20201202git337413b * Thu Dec 03 2020 Omair Majid <omajid@redhat.com> - 5.0.100-0.4.20201202git337413b