From 12422fd0a6ac964bde1cb1a90a611a343a1c914f Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Mon, 18 Jan 2021 10:26:45 -0500 Subject: [PATCH] Update for bootstrapping 5.0 --- build-bootstrap-tarball | 50 --------------------------- build-dotnet-tarball | 76 ++++++++++++++++++++++++++++++++--------- dotnet5.0.spec | 24 +++++++------ 3 files changed, 72 insertions(+), 78 deletions(-) delete mode 100755 build-bootstrap-tarball diff --git a/build-bootstrap-tarball b/build-bootstrap-tarball deleted file mode 100755 index d3f3547..0000000 --- a/build-bootstrap-tarball +++ /dev/null @@ -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 - diff --git a/build-dotnet-tarball b/build-dotnet-tarball index c250937..6eba1bf 100755 --- a/build-dotnet-tarball +++ b/build-dotnet-tarball @@ -1,7 +1,7 @@ #!/bin/bash # Usage: -# build-dotnet-tarball +# build-dotnet-tarball [--bootstrap] # # Creates a source archive from a tag (or commit) at github.com/dotnet/source-build @@ -13,32 +13,41 @@ set -euo pipefail IFS=$'\n\t' -print_usage() { +function print_usage { echo "Usage:" - echo "$0 " + echo "$0 [--bootstrap] " echo 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 /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 { - 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 case "${ID}" in # Remove the RHEL minor version @@ -50,10 +59,29 @@ function runtime_id { 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=() while [[ "$#" -gt 0 ]]; do arg="${1}" case "${arg}" in + --bootstrap) + build_bootstrap=true + shift + ;; -h|--help) print_usage exit 0 @@ -78,6 +106,11 @@ dir_name="dotnet-${tag}" unmodified_tarball_name="${dir_name}-original" 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 echo "error: ${tarball_name}.tar.gz already exists" exit 1 @@ -94,6 +127,10 @@ if [ ! -f "${unmodified_tarball_name}.tar.gz" ]; then # FIXME remove contineuonprebuilterror ./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 + + 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 @@ -107,12 +144,17 @@ tar xf "${unmodified_tarball_name}.tar.gz" mv "${unmodified_tarball_name}" "${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 # not-very-useful artifacts to reduce tarball size rm -r src/aspnetcore.*/src/SignalR/clients/java/signalr/gradle* find src/aspnetcore.*/src -type d -name samples -print0 | xargs -0 rm -r 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/Humanizer.*/samples/ diff --git a/dotnet5.0.spec b/dotnet5.0.spec index 9aad30e..5523053 100644 --- a/dotnet5.0.spec +++ b/dotnet5.0.spec @@ -63,7 +63,7 @@ URL: https://github.com/dotnet/ # The source is generated on a Fedora box via: # ./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 Source2: dotnet.sh.in @@ -87,7 +87,7 @@ BuildRequires: clang BuildRequires: cmake BuildRequires: coreutils %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-source-built-artifacts %endif @@ -310,7 +310,7 @@ These are not meant for general use. %prep -%setup -q -n dotnet-v%{src_version}-SDK-337413b +%setup -q -n dotnet-9c4e5de-x64-bootstrap %if %{without bootstrap} # Remove all prebuilts @@ -324,10 +324,9 @@ rm -rf packages/source-built %endif %if %{without bootstrap} -sed -i -e 's|5.0.100-preview1-014459|5.0.103|' global.json mkdir -p 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 # Fix bad hardcoded path in build @@ -467,8 +466,8 @@ echo "%{_libdir}/dotnet" >> install_location install -dm 0755 %{buildroot}%{_sysconfdir}/dotnet install install_location %{buildroot}%{_sysconfdir}/dotnet/ -#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 -dm 0755 %{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 # 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} %dir %{_libdir}/dotnet/packs -#%%files -n dotnet-sdk-5.0-source-built-artifacts -#%%dir %%{_libdir}/dotnet -#%%{_libdir}/dotnet/source-built-artifacts +%files -n dotnet-sdk-5.0-source-built-artifacts +%dir %{_libdir}/dotnet +%{_libdir}/dotnet/source-built-artifacts %changelog -* Fri Dec 04 13:22:13 EST 2020 Omair Majid - 5.0.100-1 +* Fri Dec 18 2020 Omair Majid - 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 - 5.0.100-1 - Update to .NET Core Runtime 5.0.0 and SDK 5.0.100 * Thu Dec 03 2020 Omair Majid - 5.0.100-0.4.20201202git337413b