diff --git a/.gitignore b/.gitignore index 3b55444..d3b3f2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ SOURCES/dotnet-v6.0.114.tar.gz /dotnet-v6.0.114.tar.gz /dotnet-v6.0.115.tar.gz +/dotnet-v6.0.119.tar.gz diff --git a/build-dotnet-tarball b/build-dotnet-tarball new file mode 100755 index 0000000..f5c1fb5 --- /dev/null +++ b/build-dotnet-tarball @@ -0,0 +1,211 @@ +#!/bin/bash + +# Usage: +# build-dotnet-tarball [--bootstrap] +# +# Creates a source archive from a tag (or commit) at github.com/dotnet/installer + +# installer is a little strange, we need to clone it, check out the +# tag, build it and then create a tarball from the archive directory +# it creates. Also, it is likely that the source archive is only +# buildable on the OS it was initially created in. + +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" + ["i686"]="x86" + ["i386"]="x86" + ["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}" + git clone https://github.com/dotnet/installer + pushd installer + git checkout "${tag}" + git submodule update --init --recursive + clean_dotnet_cache + mkdir -p "../${unmodified_tarball_name}" + ./build.sh /p:ArcadeBuildTarball=true + mv artifacts/packages/Debug/Shipping/dotnet-sdk-source-6.*.tar.gz \ + ../../"${unmodified_tarball_name}.tar.gz" + popd + popd + + rm -rf "${temp_dir}" +fi + +rm -rf "${tarball_name}" +mkdir -p "${tarball_name}" +pushd "${tarball_name}" +tar xf ../"${unmodified_tarball_name}.tar.gz" + +if [[ ${build_bootstrap} == true ]]; then + if [[ "$(wc -l < packages/archive/archiveArtifacts.txt)" != 1 ]]; then + echo "error: this is not going to work! update $0 to fix this issue." + exit 1 + fi + + pushd packages/archive/ + curl -O $(cat archiveArtifacts.txt) + popd + + mkdir foo + pushd foo + + tar xf ../packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz + sed -i -E 's|6.0.0-rtm.21521.16.0.0-rtm.21521.46.0.0-rtm.21521.16.0.0-rtm.21521.4 - 6.0.119-2 +- Update to .NET SDK 6.0.119 and Runtime 6.0.19 +- Resolves: RHBZ#2216218 + * Thu Feb 16 2023 Omair Majid - 6.0.114-2 - Update to .NET SDK 6.0.114 and Runtime 6.0.14 - Resolves: RHBZ#2166765 diff --git a/rpminspect.yaml b/rpminspect.yaml new file mode 100644 index 0000000..71b90ce --- /dev/null +++ b/rpminspect.yaml @@ -0,0 +1,18 @@ +--- +inspections: + # We patch upstream a lot, no need to reject patches + patches: off +badfuncs: + allowed: + # The Mono runtime (used on s390x, for example), uses inet_addr for + # debugging (such as sending the control flow graph to a remote process). + # See runtime/src/mono/mono/mini/cfgdump.c. This isn't part of any + # standard networking facility; networking APIs are implemented/used in + # libSystem*so. + /usr/lib64/dotnet/shared/Microsoft.NETCore.App/*/libcoreclr.so: + - inet_addr +runpath: + # Upstream explicitly sets $ORIGIN/netcoredeps as an RPATH + # See https://github.com/dotnet/core/blob/main/Documentation/self-contained-linux-apps.md + allowed_origin_paths: + - /netcoredeps diff --git a/sources b/sources index c93e89a..35cefb0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (dotnet-v6.0.114.tar.gz) = 1c33786f47fab965d8bd9017daa2718edf1ecd30a1ad1c13c36e8dedba205c335fedb6268d7b9ffe74a57ee277ab335707cae888b16a26d779bf4fb4d54a8992 +SHA512 (dotnet-v6.0.119.tar.gz) = b66e2cdb1689059ec4d2b8c93e525a4b334a25bdba3a39e9986c06f4677e141d8d4a9c347772320850ed2ddd0dff828b0be3969d45f614f39c43a7d8675831fb 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..c8d0a7a --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,44 @@ +--- +- 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 -l={{ remote_artifacts }} dotnet-regular-tests --timeout=1500 + required_packages: + - aspnetcore-runtime-6.0 + - bash-completion + - bc + - binutils + - dotnet-runtime-6.0 + - dotnet-sdk-6.0 + - expect + - file + - findutils + - git + - jq + - lldb + - npm + - postgresql-odbc + - postgresql-server + - procps-ng + - python3 + - strace + - util-linux + - wget + - which 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"