From a7c6c35b001c2498a5a3cba66964719949c962c8 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Thu, 6 Jul 2023 10:16:01 -0400 Subject: [PATCH] Update to .NET SDK 7.0.108 and Runtime 7.0.8 Also add missing files to git repo. Resolves: RHBZ#2216223 --- .gitignore | 1 + build-arm64-bootstrap-tarball | 68 +++++++++++++ build-dotnet-tarball | 183 ++++++++++++++++++++++++++++++++++ dotnet7.0.spec | 12 ++- rpminspect.yaml | 4 - sources | 2 +- tests/.fmf/version | 1 + tests/provision.fmf | 6 ++ tests/tests.yml | 47 +++++++++ update-release | 112 +++++++++++++++++++++ 10 files changed, 427 insertions(+), 9 deletions(-) create mode 100755 build-arm64-bootstrap-tarball create mode 100755 build-dotnet-tarball create mode 100644 tests/.fmf/version create mode 100644 tests/provision.fmf create mode 100644 tests/tests.yml create mode 100755 update-release diff --git a/.gitignore b/.gitignore index ed116b9..a561a4e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /dotnet-v7.0.102.tar.gz /dotnet-v7.0.103.tar.gz /dotnet-v7.0.104.tar.gz +/dotnet-v7.0.108.tar.gz diff --git a/build-arm64-bootstrap-tarball b/build-arm64-bootstrap-tarball new file mode 100755 index 0000000..d0a2eb3 --- /dev/null +++ b/build-arm64-bootstrap-tarball @@ -0,0 +1,68 @@ +#!/bin/bash + +set -euo pipefail + +set -x + +function parse-nuget-name-version-from-file() { + package=$1 + filename=${package##*/} + + version_suffix=$(echo "$filename" | grep -Eo '\.[[:digit:]]+.*\.nupkg') + version=$(echo "$version_suffix" | sed -Ee 's/^\.//' -e 's/\.nupkg$//') + name=${filename:0:(${#filename}-${#version_suffix})} + + echo "$name" "$version" +} + +bootstrap_dir=$(readlink -f "$1") + +version=${2:-$(jq -r '.tools.dotnet' "$bootstrap_dir"/global.json)} + +date=$(date +%F) + +mkdir -p "dotnet-arm64-prebuilts-$date" + +pushd "dotnet-arm64-prebuilts-$date" + +# Binaries can be at one of several different URLs: +wget https://dotnetcli.azureedge.net/dotnet/Sdk/$version/dotnet-sdk-$version-linux-arm64.tar.gz +#wget https://dotnetbuilds.azureedge.net/public/Sdk/$version/dotnet-sdk-$version-linux-arm64.tar.gz + +for archive in "$bootstrap_dir"/packages/archive/*.tar.gz; do + mapfile -t linux_x64_packages < <(tar tf "$archive" | grep linux-x64) + + for package in "${linux_x64_packages[@]}"; do + if [[ "$package" = *'.Intermediate.'* ]]; then + continue; + fi + + read -r name version < <(parse-nuget-name-version-from-file "$package") + + arm_name=${name/linux-x64/linux-arm64} + + # https://gist.github.com/omajid/c04b6025de49d0b7b18ab4a7e789484e + nappo download --verbose "$arm_name" "$version" + + done +done + +# For arm64, we have forced a newer 7.0 SDK, which needs newer bits +nappo download microsoft.windowsdesktop.app.ref 6.0.9 +nappo download microsoft.netcore.app.host.linux-arm64 6.0.9 +nappo download microsoft.netcore.app.ref 6.0.9 +nappo download microsoft.aspnetcore.app.ref 6.0.9 + +nappo download Microsoft.AspNetCore.App.Runtime.linux-arm64 7.0.0-rc.1.22427.2 +nappo download Microsoft.NETCore.App.Host.linux-arm64 7.0.0-rc.1.22426.10 +nappo download Microsoft.NETCore.App.Runtime.linux-arm64 7.0.0-rc.1.22426.10 +nappo download runtime.linux-arm64.Microsoft.NETCore.DotNetHost 7.0.0-rc.1.22426.10 +nappo download runtime.linux-arm64.Microsoft.NETCore.DotNetHostPolicy 7.0.0-rc.1.22426.10 +nappo download runtime.linux-arm64.Microsoft.NETCore.DotNetHostResolver 7.0.0-rc.1.22426.10 +nappo download runtime.linux-arm64.Microsoft.NETCore.ILAsm 7.0.0-rc.1.22426.10 +nappo download runtime.linux-arm64.Microsoft.NETCore.ILDAsm 7.0.0-rc.1.22426.10 +nappo download Microsoft.NETCore.App.Crossgen2.linux-arm64 7.0.0-rc.1.22426.10 + +popd + +tar czf "dotnet-arm64-prebuilts-$date.tar.gz" "dotnet-arm64-prebuilts-$date" diff --git a/build-dotnet-tarball b/build-dotnet-tarball new file mode 100755 index 0000000..0de6f51 --- /dev/null +++ b/build-dotnet-tarball @@ -0,0 +1,183 @@ +#!/bin/bash + +# Usage: +# build-dotnet-tarball [--bootstrap] +# +# Creates a source archive from a tag (or commit) at github.com/dotnet/installer +# +# Clone dotnet/installer, check out the tag (if any), and build the +# source-tarball. + +set -euo pipefail +IFS=$'\n\t' + +function print_usage { + echo "Usage:" + echo "$0 [--bootstrap] " + echo + echo "Creates a source archive from a tag at https://github.com/dotnet/installer" + echo "" + echo " --bootstrap build a source tarball usable for bootstrapping .NET" +} + +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 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 { + + source /etc/os-release + case "${ID}" in + # Remove the RHEL minor version + rhel) rid_version=${VERSION_ID%.*} ;; + + *) rid_version=${VERSION_ID} ;; + esac + + echo "${ID}.${rid_version}-${arch}" +} + +build_bootstrap=false + +declare -A archmap +archmap=( + ["aarch64"]="arm64" + ["amd64"]="x64" + ["armv8l"]="arm" + ["i386"]="x86" + ["i686"]="x86" + ["ppc64le"]="ppc64le" + ["s390x"]="s390x" + ["x86_64"]="x64" +) + +arch=${archmap["$(uname -m)"]} + + +positional_args=() +while [[ "$#" -gt 0 ]]; do + arg="${1}" + case "${arg}" in + --bootstrap) + check_bootstrap_environment + build_bootstrap=true + shift + ;; + -h|--help) + print_usage + exit 0 + ;; + *) + positional_args+=("$1") + shift + ;; + esac +done + + +tag=${positional_args[0]:-} +if [[ -z ${tag} ]]; then + echo "error: missing tag to build" + exit 1 +fi + +set -x + +dir_name="dotnet-${tag}" +unmodified_tarball_name="${dir_name}-original" +tarball_name="${dir_name}" +tarball_suffix=.tar.gz + +if [[ ${build_bootstrap} == true ]]; then + unmodified_tarball_name="${unmodified_tarball_name}-${arch}-bootstrap" + tarball_name="${tarball_name}-${arch}-bootstrap" + tarball_suffix=.tar.xz +fi + +if [ -f "${tarball_name}${tarball_suffix}" ]; then + echo "error: ${tarball_name}${tarball_suffix} already exists" + exit 1 +fi + +if [ ! -f "${unmodified_tarball_name}.tar.gz" ]; then + temp_dir=$(mktemp -d -p "$(pwd)") + pushd "${temp_dir}" + mkdir installer + pushd installer + git init + git remote add origin https://github.com/dotnet/installer + git fetch --depth 1 origin "${tag}" + git checkout FETCH_HEAD + git submodule update --init --recursive + clean_dotnet_cache + ./build.sh /p:ArcadeBuildTarball=true + popd + + popd + + mv "${temp_dir}"/installer/artifacts/packages/Debug/Shipping/dotnet-sdk-source-7*.tar.gz \ + "${unmodified_tarball_name}.tar.gz" + + rm -rf "${temp_dir}" +fi + +rm -rf "${tarball_name}" +mkdir "${tarball_name}" +pushd "${tarball_name}" +tar xf ../"${unmodified_tarball_name}.tar.gz" + +if [[ ${build_bootstrap} == true ]]; then + ./prep.sh --bootstrap +else + find . -type f -iname '*.tar.gz' -delete + rm -rf .dotnet +fi + +# Remove files with funny licenses and crypto implementations and +# other not-very-useful artifacts. We MUST NOT ship any files that +# have unapproved licenses and unexpected cryptographic +# implementations. +# +# We use rm -r (no -f) to make sure the operation fails if the files +# are not at the expected locations. If the files are not at the +# expected location, we need to find the new location of the files and +# delete them, or verify that upstream has already removed the files. + +# Binaries for gradle +rm -r src/aspnetcore/src/SignalR/clients/java/signalr/gradle* + +# https://github.com/dotnet/aspnetcore/issues/34785 +find src/aspnetcore/src -type d -name samples -print0 | xargs -0 rm -r + +# Unnecessary crypto implementation: IDEA +rm -r src/runtime/src/tests/JIT/Performance/CodeQuality/Bytemark/ + +# https://github.com/NuGet/Home/issues/11094 +rm -r src/nuget-client/test/EndToEnd + +# https://github.com/microsoft/ApplicationInsights-dotnet/issues/2670 +rm -r src/source-build-externals/src/application-insights/LOGGING/test/Shared/CustomTelemetryChannel.cs + +popd + +if [[ ${build_bootstrap} == true ]]; then + tar -I 'xz -9 -T 0' -cf "${tarball_name}${tarball_suffix}" "${tarball_name}" +else + tar -czf "${tarball_name}${tarball_suffix}" "${tarball_name}" +fi diff --git a/dotnet7.0.spec b/dotnet7.0.spec index f4d0b17..299d240 100644 --- a/dotnet7.0.spec +++ b/dotnet7.0.spec @@ -6,10 +6,10 @@ # until that's done, disable LTO. This has to happen before setting the flags below. %define _lto_cflags %{nil} -%global host_version 7.0.4 -%global runtime_version 7.0.4 +%global host_version 7.0.8 +%global runtime_version 7.0.8 %global aspnetcore_runtime_version %{runtime_version} -%global sdk_version 7.0.104 +%global sdk_version 7.0.108 %global sdk_feature_band_version %(echo %{sdk_version} | cut -d '-' -f 1 | sed -e 's|[[:digit:]][[:digit:]]$|00|') %global templates_version %{runtime_version} #%%global templates_version %%(echo %%{runtime_version} | awk 'BEGIN { FS="."; OFS="." } {print $1, $2, $3+1 }') @@ -51,7 +51,7 @@ Name: dotnet7.0 Version: %{sdk_rpm_version} -Release: 1%{?dist} +Release: 2%{?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/ @@ -619,6 +619,10 @@ export COMPlus_LTTng=0 %changelog +* Wed Jul 05 2023 Omair Majid - 7.0.108-2 +- Update to .NET SDK 7.0.108 and Runtime 7.0.8 +- Resolves: RHBZ#2216223 + * Thu Mar 02 2023 Omair Majid - 7.0.104-1 - Update to .NET SDK 7.0.104 and Runtime 7.0.4 - Resolves: RHBZ#2175026 diff --git a/rpminspect.yaml b/rpminspect.yaml index 8e4d228..e719510 100644 --- a/rpminspect.yaml +++ b/rpminspect.yaml @@ -19,7 +19,3 @@ runpath: # See https://github.com/dotnet/core/blob/main/Documentation/self-contained-linux-apps.md allowed_origin_paths: - /netcoredeps -unicode: - ignore: - - /usr/lib*/libexample.so* - - ??? FIXME TODO diff --git a/sources b/sources index b748cf3..8ad82e2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (dotnet-v7.0.104.tar.gz) = ab66222bfda192446f493d3618d7aa9f1da331feee0b7dddba4ea9cedf09d3b607aee6f1d1240840c52fbb39009a6354207722c9d06d972b005cfbe6081c79e7 +SHA512 (dotnet-v7.0.108.tar.gz) = d91c09068a9407302c00f18048069e3024be9215e0b2eb6641b6851c61acd060d139d31dd8c762427c14d16fea883aae0cb4446f7a954b493f1bcf24c18d0546 diff --git a/tests/.fmf/version b/tests/.fmf/version new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/tests/.fmf/version @@ -0,0 +1 @@ +2 diff --git a/tests/provision.fmf b/tests/provision.fmf new file mode 100644 index 0000000..87b3807 --- /dev/null +++ b/tests/provision.fmf @@ -0,0 +1,6 @@ +--- + +standard-inventory-qcow2: + qemu: + m: 5G + diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..175e53d --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,47 @@ +--- +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + - container + - atomic + repositories: + - repo: "https://github.com/redhat-developer/dotnet-regular-tests.git" + dest: "dotnet-regular-tests" + version: "main" + tests: + - download_test_runner: + dir: ./ + run: wget --no-verbose https://github.com/redhat-developer/dotnet-bunny/releases/latest/download/turkey.tar.gz && tar xf turkey.tar.gz + - print_test_runner_version: + dir: ./ + run: dotnet turkey/Turkey.dll --version + - regular: + dir: ./ + run: dotnet turkey/Turkey.dll -v -l={{ remote_artifacts }} dotnet-regular-tests --timeout=1500 + required_packages: + - aspnetcore-runtime-7.0 + - bash-completion + - bc + - binutils + - dotnet-runtime-7.0 + - dotnet-sdk-7.0 + - expect + - file + - findutils + - gcc-c++ + - git + - jq + - libstdc++-devel + - lldb + - npm + - postgresql-odbc + - postgresql-server + - procps-ng + - python3 + - strace + - util-linux + - wget + - which + - zlib-devel diff --git a/update-release b/update-release new file mode 100755 index 0000000..ef8091c --- /dev/null +++ b/update-release @@ -0,0 +1,112 @@ +#!/bin/bash + +# Usage: +# ./update-release sdk-version runtime-version [--bug bug-id] [--tarball tarball-name] [--larger-rpm-release] + +set -euo pipefail +IFS=$'\n\t' + +print_usage() { + echo " Usage:" + echo " ./update-release sdk-version runtime-version [--bug bug-id] [--tarball tarball-name] [--larger-rpm-release]" +} + +user_provided_tarball_name="" + +rpm_release=1 +positional_args=() +bug_ids=() +while [[ "$#" -gt 0 ]]; do + arg="$1" + case "${arg}" in + --bug) + bug_ids+=("$2") + shift; + shift; + ;; + -h|--help) + print_usage + exit 0 + ;; + --tarball) + user_provided_tarball_name="$2" + shift; + shift; + ;; + --larger-rpm-release) + rpm_release="2" + shift; + ;; + *) + positional_args+=("$1") + shift + ;; + esac +done + +spec_files=( ./*.spec ) +spec_file="${spec_files[0]}" + +sdk_version=${positional_args[0]:-} +if [[ -z ${sdk_version} ]]; then + echo "error: missing sdk version" + exit 1 +fi + +runtime_version=${positional_args[1]:-} +if [[ -z ${runtime_version} ]]; then + echo "error: missing runtime version" + exit 1 +fi + +host_version="$runtime_version" + +if [[ "$runtime_version" == "3.1"* ]]; then + tag=v${sdk_version}-SDK +else + tag=v${sdk_version} +fi + +if [[ -f "dotnet-${tag}-original.tar.gz" ]]; then + echo "dotnet-${tag}-original.tar.gz alredy exists, not rebuilding tarball" +else + if [[ -n "${user_provided_tarball_name}" ]]; then + cp -a "$user_provided_tarball_name" "dotnet-${tag}-original.tar.gz" + elif [[ -f "dotnet-${sdk_version}-SDK.tar.gz" ]]; then + cp -a "dotnet-${sdk_version}-SDK.tar.gz" "dotnet-${tag}-original.tar.gz" + elif [[ -f "dotnet-${sdk_version}.tar.gz" ]]; then + cp -a "dotnet-${sdk_version}.tar.gz" "dotnet-${tag}-original.tar.gz" + elif [[ -f "dotnet-${runtime_version}.tar.gz" ]]; then + cp -a "dotnet-${runtime_version}.tar.gz" "dotnet-${tag}-original.tar.gz" + fi +fi + +if [[ ! -f "dotnet-${tag}.tar.gz" ]]; then + ./build-dotnet-tarball "${tag}" +fi + +set -x + +sed -i -E "s|^%global host_version [[:digit:]]\.[[:digit:]]\.[[:digit:]]+|%global host_version ${host_version}|" "$spec_file" +sed -i -E "s|^%global runtime_version [[:digit:]]\.[[:digit:]]\.[[:digit:]]+|%global runtime_version ${runtime_version}|" "$spec_file" +sed -i -E "s|^%global sdk_version [[:digit:]]\.[[:digit:]]\.[[:digit:]][[:digit:]][[:digit:]]|%global sdk_version ${sdk_version}|" "$spec_file" + +comment="Update to .NET SDK ${sdk_version} and Runtime ${runtime_version}" +commit_message="$comment +" +for bug_id in "${bug_ids[@]}"; do + comment="$comment +- Resolves: RHBZ#$bug_id" + commit_message="$commit_message +Resolves: RHBZ#$bug_id" +done + +echo "$commit_message" > git-commit-message + +rpmdev-bumpspec --comment="$comment" "$spec_file" + +# Reset release in 'Release' tag +sed -i -E 's|^Release: [[:digit:]]+%|Release: '"$rpm_release"'%|' "$spec_file" +# Reset Release in changelog comment +# See https://stackoverflow.com/questions/18620153/find-matching-text-and-replace-next-line +sed -i -E '/^%changelog$/!b;n;s/-[[:digit:]]+$/-'"$rpm_release"'/' "$spec_file"