From 2344a60d0e2cd7e5b81f04156288742a9fc19f02 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 21 Feb 2023 23:48:17 -0500 Subject: [PATCH] user/dotnet6-build: new aport --- user/dotnet6-build/APKBUILD | 553 ++++++++++++++++++ user/dotnet6-build/README.md | 131 +++++ ...tcore_46735-set-known-good-runtimeid.patch | 34 ++ .../dotnet6-build/build_13378-arm-build.patch | 71 +++ .../build_14816-non-portable-build.patch | 208 +++++++ ...6-stop-overriding-aspnetcore-version.patch | 69 +++ ...uild_14816-update-portable-rid-logic.patch | 38 ++ user/dotnet6-build/build_disable-apphost.diff | 79 +++ .../check_rid-alpine-generation.diff | 42 ++ .../installer_13378-arm-build.patch | 43 ++ .../installer_14816-crossgen2-rid.patch | 53 ++ ...ller_14816-update-portable-rid-logic.patch | 51 ++ ...msbuild_optional-systemconfiguration.patch | 69 +++ .../msbuild_optional-systemsecurity.patch | 32 + .../roslyn_57003-mono-namedmutex.patch | 470 +++++++++++++++ ...ng-runtime-with-non-portable-runtime.patch | 48 ++ .../runtime_76500-mono-musl-support.patch | 189 ++++++ ...-thread-coop-undefine-fortify-source.patch | 25 + .../runtime_enable-system-libunwind.diff | 22 + user/dotnet6-build/runtime_lld-fix.patch | 31 + ...39-add-zsh-compdef-completion-script.patch | 35 ++ user/dotnet6-build/sdk_telemetry-optout.patch | 32 + 22 files changed, 2325 insertions(+) create mode 100644 user/dotnet6-build/APKBUILD create mode 100644 user/dotnet6-build/README.md create mode 100644 user/dotnet6-build/aspnetcore_46735-set-known-good-runtimeid.patch create mode 100644 user/dotnet6-build/build_13378-arm-build.patch create mode 100644 user/dotnet6-build/build_14816-non-portable-build.patch create mode 100644 user/dotnet6-build/build_14816-stop-overriding-aspnetcore-version.patch create mode 100644 user/dotnet6-build/build_14816-update-portable-rid-logic.patch create mode 100644 user/dotnet6-build/build_disable-apphost.diff create mode 100644 user/dotnet6-build/check_rid-alpine-generation.diff create mode 100644 user/dotnet6-build/installer_13378-arm-build.patch create mode 100644 user/dotnet6-build/installer_14816-crossgen2-rid.patch create mode 100644 user/dotnet6-build/installer_14816-update-portable-rid-logic.patch create mode 100644 user/dotnet6-build/msbuild_optional-systemconfiguration.patch create mode 100644 user/dotnet6-build/msbuild_optional-systemsecurity.patch create mode 100644 user/dotnet6-build/roslyn_57003-mono-namedmutex.patch create mode 100644 user/dotnet6-build/runtime_75597-support-building-runtime-with-non-portable-runtime.patch create mode 100644 user/dotnet6-build/runtime_76500-mono-musl-support.patch create mode 100644 user/dotnet6-build/runtime_82269-mono-thread-coop-undefine-fortify-source.patch create mode 100644 user/dotnet6-build/runtime_enable-system-libunwind.diff create mode 100644 user/dotnet6-build/runtime_lld-fix.patch create mode 100644 user/dotnet6-build/sdk_14239-add-zsh-compdef-completion-script.patch create mode 100644 user/dotnet6-build/sdk_telemetry-optout.patch diff --git a/user/dotnet6-build/APKBUILD b/user/dotnet6-build/APKBUILD new file mode 100644 index 0000000..533ca4b --- /dev/null +++ b/user/dotnet6-build/APKBUILD @@ -0,0 +1,553 @@ +# Maintainer: Antoine Martin (ayakael) +# Contributor: Antoine Martin (ayakael) + +# secfixes: +# 6.0.106-r0: +# - CVE-2022-30184 +# 6.0.108-r0: +# - CVE-2022-34716 +# 6.0.109-r0: +# - CVE-2022-38013 +# 6.0.110-r0: +# - CVE-2022-41032 +# 6.0.112-r0: +# - CVE-2022-41089 +# 6.0.113-r0: +# - CVE-2023-21538 +# 6.0.114-r0: +# - CVE-2023-21808 + +pkgname=dotnet6-build +pkgver=6.0.114 +pkgrel=0 +_gittag=v$pkgver +_giturl="https://github.com/dotnet/installer" +_testtag=4832cef147bac35fdd5c57275a795e683bba0bb8 +_bunnytag=71880bd94711519f7b786248a88a827a401207a2 +_patches=" + aspnetcore_46735-set-known-good-runtimeid.patch + build_13378-arm-build.patch + build_14816-non-portable-build.patch + build_14816-stop-overriding-aspnetcore-version.patch + build_14816-update-portable-rid-logic.patch + build_disable-apphost.diff + check_rid-alpine-generation.diff + installer_13378-arm-build.patch + installer_14816-crossgen2-rid.patch + installer_14816-update-portable-rid-logic.patch + msbuild_optional-systemconfiguration.patch + msbuild_optional-systemsecurity.patch + roslyn_57003-mono-namedmutex.patch + runtime_76500-mono-musl-support.patch + runtime_82269-mono-thread-coop-undefine-fortify-source.patch + runtime_enable-system-libunwind.diff + runtime_lld-fix.patch + sdk_14239-add-zsh-compdef-completion-script.patch + sdk_telemetry-optout.patch + " + +_pkgver_macro=${pkgver%.*} +_pkgver_prior=${pkgver%.*.*} +_pkgver_name=${_pkgver_macro//[.0]} +pkgdesc="The .NET $_pkgver_macro bootstrap" +arch="x86_64 aarch64 armv7 s390x" +url=https://dotnet.microsoft.com +license="MIT" +# hack for dotnetx-build to be able to pull itself for bootstrapping +provides="dotnet$_pkgver_name-bootstrap" +provider_priority=$_pkgver_prior +checkdepends=" + babeltrace + binutils + coreutils + file + gawk + jq + lttng-tools + npm + procps + sed + strace + util-linux-misc + which + " +makedepends=" + bash + clang + cmake + dotnet$_pkgver_name-bootstrap + dotnet$_pkgver_name-bootstrap-artifacts + dotnet$_pkgver_name-stage0 + findutils + git + grep + icu-data-full + icu-dev + inetutils-syslogd + krb5-dev + libgit2-dev + libintl + libucontext-dev + libunwind-dev + libxml2-dev + libxml2-utils + linux-headers + lldb-dev + llvm-dev + lttng-ust-dev + nodejs + numactl-dev + openssl-dev + pigz + rsync + tar + xz + zlib-dev + " +case $CARCH in + s390x|x86) ;; + *) makedepends="$makedepends lld-dev";; +esac + +subpackages=" + dotnet$_pkgver_name-artifacts:artifacts:noarch + dotnet$_pkgver_name-sdk + dotnet$_pkgver_name-templates:templates:noarch + dotnet-zsh-completion:zshcomp:noarch + dotnet-bash-completion:bashcomp:noarch + dotnet-doc + netstandard21-targeting-pack:netstandard_targeting_pack:noarch + " +source=" + https://lab.ilot.io/dotnet/installer/-/releases/$_gittag/downloads/tarball/dotnet-$_gittag.tar.xz + dotnet-testsuite-$_testtag.tar.gz::https://github.com/redhat-developer/dotnet-regular-tests/archive/$_testtag.tar.gz + dotnet-bunny-$_bunnytag.tar.gz::https://github.com/redhat-developer/dotnet-bunny/archive/$_bunnytag.tar.gz + $_patches + " +builddir="$srcdir"/dotnet-v$pkgver +_checkdir="$srcdir"/dotnet-bunny-${_bunnytag/v} +_testdir="$srcdir"/dotnet-regular-tests-$_testtag +_cli_root="$srcdir"/bootstrap +_nugetdir="$srcdir"/nuget-cache +_artifactsdir="$_cli_root"/artifacts +_libdir="/usr/lib" +# if true, then within pipeline environment, in which case send logs there +# to be scooped +if [ -d "$APORTSDIR/logs" ]; then + _logdir="$APORTSDIR"/logs/$pkgname +else + _logdir="$srcdir"/logs +fi + +case $CARCH in + x86_64) _dotnet_arch="x64";; + aarch64) _dotnet_arch="arm64";; + armv7) _dotnet_arch="arm";; + armhf) _dotnet_arch="armv6";; + *) _dotnet_arch="$CARCH";; +esac + +# Build doesn't set all the right executable bits for the right file types +_fix_executable() { + # add executable bit + find "$1" -type f \( \ + -name 'apphost' -o \ + -name 'singlefilehost' -o \ + -name 'lib*so' \ + \) \ + -exec chmod +x '{}' \; + + # remove executable bit + find "$1" -type f \( \ + -name '*.a' -o \ + -name '*.dll' -o \ + -name '*.h' -o \ + -name '*.json' -o \ + -name '*.pdb' -o \ + -name '*.props' -o \ + -name '*.pubxml' -o \ + -name '*.targets' -o \ + -name '*.txt' -o \ + -name '*.xml' \ + \) \ + -exec chmod -x '{}' \; +} + +# generates tarball containing all components built by dotnet +snapshot() { + local _pkg="$srcdir"/${builddir##*/}.tar + + ulimit -n 4096 + export NUGET_PACKAGES=$_nugetdir + + if [ -d "$srcdir" ]; then + cd "$srcdir" + else + mkdir -p "$srcdir" && cd "$srcdir" + fi + if [ -d "installer" ]; then + cd "$srcdir"/installer + else + git clone $_giturl --branch $_gittag && cd "$srcdir"/installer + fi + + sed 's||' -i src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball.targets + + if [ -d "$_libdir/dotnet/bootstrap" ]; then + local _cli_root="$(find /usr/lib/dotnet/bootstrap/6.0* -maxdepth 0 -type d | sort -r | head -n 1)" + else + local _cli_root="" + fi + + _InitializeDotNetCli="$_cli_root" DOTNET_INSTALL_DIR="$_cli_root" DotNetBuildFromSource=true ./build.sh \ + /p:ArcadeBuildTarball=true \ + /p:TarballDir=$builddir \ + /p:TarballFilePath=$_pkg + + msg "Compressing ${builddir##*/}.tar to $SRCDEST" + xz -T0 -9 -vv -e -c > "$SRCDEST"/${builddir##*/}.tar.xz < "$_pkg" + + cd "$startdir" + abuild checksum +} + +prepare() { + default_prepare + ulimit -n 4096 + + # check patches + msg "check_rid-alpine-generation.diff" + patch -p1 -d "$_testdir" -i "$srcdir"/check_rid-alpine-generation.diff + + # Using system libunwind is broken on aarch64 and mono-based builds + # see https://github.com/dotnet/source-build/issues/2408, + case $CARCH in + x86_64) + msg "Using system libunwind" + patch -p1 -i "$srcdir"/runtime_enable-system-libunwind.diff + ;; + esac + + # For some reason, new s390x apphost isn't pulled, this disable it's use on s390x + case $CARCH in + s390x) + msg "Disabing use of apphost" + patch -p1 -i "$srcdir"/build_disable-apphost.diff + ;; + esac + + # links logfiles to pipeline logs for easy pickup in pipelines + mkdir -p "$_logdir" "$builddir"/artifacts + ln -s "$_logdir" "$builddir"/artifacts/logs + ln -s "$_logdir" "$builddir"/artifacts/log + for i in "$builddir"/src/*; do + if [ -f "$i" ]; then + continue + fi + mkdir -p "$_logdir"/${i##*\/} "$builddir"/src/${i##*\/}/artifacts + ln -s "$_logdir"/${i##*\/} "$builddir"/src/${i##*\/}/artifacts/log + done + + # dotnet requires its bootstrap to be in a writable dir + msg "Setting up bootstrap" + local _bootstrapdir=$(find $_libdir/dotnet/bootstrap/$_pkgver_macro* -maxdepth 0 | sort -r | head -n 1) + if [ ! -d "$_cli_root" ]; then + cp -r "$_bootstrapdir" "$_cli_root" + fi + # ensure that dotnet does not download artifacts provided by dotnet-artifacts + rm -rf "$builddir"/packages/archive +} + +build() { + msg "Building $pkgname-$pkgver" + ulimit -n 4096 + + # Disable use of LTTng as tracing on lttng <=2,13,0 is broken + # See https://github.com/dotnet/runtime/issues/57784. + if [ -f "/usr/lib/liblttng-ust.so.1 " ]; then + export DOTNET_LTTng=0 + fi + + # looks for most recent recent version of _artifactsdir + local _artifactsdir=$(find $_libdir/dotnet/artifacts/$_pkgver_macro* -maxdepth 0 | sort -r | head -n 1) + + # ci args, else the output is forwarded to log files which isn't ideal in a + # pipeline environment, and build by defaults uses lots of space + local args=" + /v:minimal + /p:LogVerbosity=minimal + /p:MinimalConsoleLogOutput=true + /p:CleanWhileBuilding=true + " + # disable use of crossgen on arches platforms where its unsupported (mono) + # or broken (armv7, aarch64) + case $CARCH in + x86|aarch64|armv7|armhf|s390x) local args="$args /p:CrossgenOutput=false /p:DISABLE_CROSSGEN=True";; + esac + + # Sets TargetRid manually as dotnet cannot be trusted to reliably compute + # the machine's runtime ID between releases. + # shellcheck disable=SC2034 + . /etc/os-release + local VERSION_ID_DOT="${VERSION_ID//[^.]}" + while [ ${#VERSION_ID_DOT} -gt 1 ]; do + local VERSION_ID="${VERSION_ID%.*}" + local VERSION_ID_DOT="${VERSION_ID//[^.]}" + done + local VERSION_ID_DASH="${VERSION_ID//[^_]}" + while [ ${#VERSION_ID_DASH} -ge 1 ]; do + local VERSION_ID="${VERSION_ID%_*}" + local VERSION_ID_DASH="${VERSION_ID//[^_]}" + done + local args="$args /p:TargetRid=$ID.$VERSION_ID-$_dotnet_arch" + + ./build.sh \ + --with-sdk "$_cli_root" \ + --with-packages "$_artifactsdir" \ + -- $args +} + +check() { + + ulimit -n 4096 + export NUGET_PACKAGES=$_nugetdir + + # Tests timeout (in seconds) + local _tests_timeout=600 + # Test suite disable flags + # following tests can only work after packaging step + local _disabled_tests="man-pages distribution-package bash-completion install-local release-version-sane" + # test broken on all but x86_64 and aarch64: no musl release for omnisharp + if [ "$CARCH" != "x86_64" ] && [ "$CARCH" != "aarch64" ]; then + local _disabled_tests="$_disabled_tests omnisharp" + fi + # test broken: permission issue on lxc / pipelines + local _disabled_tests="$_disabled_tests createdump-aspnet workload" + # liblttng-ust_sys-sdt.h: no 'NT_STAPSDT' on Alpine's lttng-ust package + # lttng: known issue, see https://github.com/dotnet/runtime/issues/57784 + local _disabled_tests="$_disabled_tests liblttng-ust_sys-sdt.h lttng" + # {bundled,system}-libunwind: use system version on all but aarch64/armv7, as broken + # see https://github.com/redhat-developer/dotnet-regular-tests/issues/113 + case $CARCH in + x86_64) local _disabled_tests="$_disabled_tests bundled-libunwind";; + *) local _disabled_tests="$_disabled_tests system-libunwind";; + esac + # publish-ready-to-run: broken due to crossgen2 nupkg on musl-arm64 / musl-arm platform being broken + # should be fixed with https://github.com/dotnet/runtime/pull/66814 + case $CARCH in + aarch64|armv7) local _disabled_tests="$_disabled_tests publish-ready-to-run publish-ready-to-run-linux";; + esac + + msg "Unpacking produced dotnet" + export DOTNET_ROOT="$_checkdir/release" + if [ ! -d "$DOTNET_ROOT" ]; then + mkdir -p "$DOTNET_ROOT" + tar --use-compress-program="pigz" \ + -xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \ + -C "$DOTNET_ROOT" \ + --no-same-owner + fi + export PATH="$DOTNET_ROOT:$PATH" + # some files either should or should not have executable bits + # (done again during packaging - this is for tests) + _fix_executable "$DOTNET_ROOT" + + msg "Building turkey test suite" + mkdir "$_logdir"/check + if [ ! -d "$_checkdir"/turkey ]; then + cd "$_checkdir"/Turkey + dotnet publish -bl:$_logdir/check/turkey.binlog -f netcoreapp3.1 -c Release -p:VersionPrefix=1 -p:VersionSuffix="$(git rev-parse --short HEAD)" -o "$_checkdir"/turkey + fi + + msg "Running test suite" + cd "$_testdir" + for i in $_disabled_tests; do + if [ -d "$i" ]; then + sed -i 's|"enabled": true|"enabled": false|' $i/test.json + fi + done + dotnet "$_checkdir"/turkey/Turkey.dll -t $_tests_timeout -l "$_logdir"/check || local ERROR=true + if [ $ERROR ]; then + msg "Check error reported" + fi +} + +package() { + # directory creation + install -dm 755 \ + "$pkgdir"/$_libdir/dotnet/bootstrap/$pkgver \ + "$pkgdir"/usr/share/man/man1 \ + "$pkgdir"/$_libdir/dotnet/artifacts/$pkgver + + # unpack sdk to bootstrap + tar --use-compress-program="pigz" \ + -xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \ + -C "$pkgdir"/$_libdir/dotnet/bootstrap/$pkgver/ \ + --no-same-owner + + # extract arch-specific artifacts to artifacts dir for use by future dotnet builds + tar --use-compress-program="pigz" \ + -xf "$builddir"/artifacts/$_dotnet_arch/Release/Private.SourceBuilt.Artifacts.*.tar.gz \ + -C "$pkgdir"/$_libdir/dotnet/artifacts/$pkgver/ \ + --no-same-owner \ + --wildcards \ + '*alpine*' + + # assemble docs + find "$builddir" -iname 'dotnet*.1' -type f -exec cp '{}' "$pkgdir"/usr/share/man/man1/. \; + + # some files either should or should not have executable bits + _fix_executable "$pkgdir" + + # Disable use of LTTng as tracing on lttng <=2,13,0 is broken + # See https://github.com/dotnet/runtime/issues/57784. + if [ -f "/usr/lib/liblttng-ust.so.1 " ]; then + rm "$pkgdir"/$_libdir/dotnet/bootstrap/*/shared/Microsoft.NETCore.App/*/libcoreclrtraceptprovider.so + fi +} + +sdk() { + pkgdesc="The .NET $_pkgver_macro SDK" + depends=" + aspnetcore$_pkgver_name-runtime + aspnetcore$_pkgver_name-targeting-pack + dotnet$_pkgver_name-apphost-pack + dotnet$_pkgver_name-targeting-pack + dotnet$_pkgver_name-templates + netstandard21-targeting-pack + " + provides=" + dotnet-sdk-$_pkgver_macro=$pkgver-r$pkgrel + dotnet$_pkgver_name-dev=$pkgver-r$pkgrel + " + + install -dm 755 "$subpkgdir"/$_libdir/dotnet + + # sdk + tar --use-compress-program="pigz" \ + -xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \ + -C "$subpkgdir"/$_libdir/dotnet/ \ + --no-same-owner \ + ./sdk ./sdk-manifests + + # some files either should or should not have executable bits + _fix_executable "$subpkgdir" + + # See https://github.com/dotnet/source-build/issues/2579 + find "$subpkgdir" -type f -name 'testhost.x86' -delete + find "$subpkgdir" -type f -name 'vstest.console' -delete +} + +netstandard_targeting_pack() { + pkgdesc="The .NET 2.1 Standard targeting pack" + depends="dotnet-host" + provides="netstandard-targeting-pack-2.1=$pkgver-r$pkgrel" + + install -dm 755 "$subpkgdir"/$_libdir/dotnet/packs + tar --use-compress-program="pigz" \ + -xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \ + -C "$subpkgdir"/$_libdir/dotnet/ \ + --no-same-owner \ + ./packs/NETStandard.Library.Ref + + # some files either should or should not have executable bits + _fix_executable "$subpkgdir" +} + +templates() { + pkgdesc="The .NET $_pkgver_macro templates" + depends="dotnet-host" + provides="dotnet-templates-$_pkgver_macro=$pkgver-r$pkgrel" + + install -dm 755 "$subpkgdir"/$_libdir/dotnet + tar --use-compress-program="pigz" \ + -xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \ + -C "$subpkgdir"/$_libdir/dotnet/ \ + --no-same-owner \ + ./templates + + # some files either should or should not have executable bits + _fix_executable "$subpkgdir" +} + +artifacts() { + pkgdesc="Internal package for building .NET $_pkgver_macro Software Development Kit" + # hack to allow artifacts to pull itself + provides="dotnet$_pkgver_name-bootstrap-artifacts" + provider_priority=$_pkgver_prior + + # directory creation + install -dm 755 \ + "$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver \ + "$subpkgdir"/usr/share/licenses + + # extract arch-agnostic artifacts to artifacts dir for use by future dotnet builds + tar --use-compress-program="pigz" \ + -xf "$builddir"/artifacts/$_dotnet_arch/Release/Private.SourceBuilt.Artifacts.*.tar.gz \ + -C "$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver/ \ + --no-same-owner \ + --exclude '*Intermediate*' \ + --exclude '*alpine*' +} + +zshcomp() { + depends="" + pkgdesc="zsh completion for .NET" + # netstandard21-targeting-pack will always be pulled by any dotnetx-sdk + # thus pulling this with it for sdk + install_if="netstandard21-targeting-pack zsh" + depends="dotnet-host" + + install -dm 755 "$subpkgdir"/usr/share/zsh/site-functions + install -m 755 "$builddir"/src/sdk/scripts/register-completions.zsh "$subpkgdir"/usr/share/zsh/site-functions/_dotnet +} + +bashcomp() { + depends="" + pkgdesc="bash completion for .NET" + # netstandard21-targeting-pack will always be pulled by any dotnetx-sdk + # thus pulling this with it for sdk + install_if="netstandard21-targeting-pack bash-completion" + depends="dotnet-host" + + install -dm 755 "$subpkgdir"/usr/share/bash-completion/completions + install -m 755 "$builddir"/src/sdk/scripts/register-completions.bash "$subpkgdir"/usr/share/bash-completion/completions/_dotnet +} + +doc() { + default_doc + pkgdesc="Docs for .NET" + + # licenses + install -dm 755 "$subpkgdir"/usr/share/licenses/dotnet + tar --use-compress-program="pigz" \ + -xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \ + -C "$subpkgdir"/usr/share/licenses/dotnet/ \ + --no-same-owner \ + ./LICENSE.txt ./ThirdPartyNotices.txt +} + +sha512sums=" +2c01c7b2de4d47d4125717e1240b4822af8b07336d48d87cbc0521fc1b7245672ded01021ad9cdba476b8aa519c4376f40ee1654254e687bef07df9872a3476d dotnet-v6.0.114.tar.xz +994e5145653698551408a87e34d19368e85a2531af9e2bfe61b903af0f016bfd5e4a7691795bdf09ba74bf6f41fc666973ee8cfde9088738f9a2f83f4bafa5e4 dotnet-testsuite-4832cef147bac35fdd5c57275a795e683bba0bb8.tar.gz +fc281df5fcf0d31dc9ff7f5b0e870960cfbe3c4fa0f6a6bb50b22c4ee18d2c608c827205bc79bd7f686d77ac917582fc26f68432cdd86c4a33b910c0c7416d09 dotnet-bunny-71880bd94711519f7b786248a88a827a401207a2.tar.gz +5a46a1ac9f70c378c7193275de399d7c7c235c5c7da7e76d0b44ff380ae1df3f3724cebc9c430157606c545bb3aa6d321d0e7d6702f9c4d8e74c901d394a6c51 aspnetcore_46735-set-known-good-runtimeid.patch +6e9663f466007fc5fa7010e6859f054b6a4e59affa7aae7fd4d9ab4ba8410d4855b680f58f938ad21d0b3d2a7c7b097c7e9494a4dde2c43478ddddbf37539545 build_13378-arm-build.patch +bdbe798add3ded0c2cf361c9f5aa18fb3540e348e68a5695cbdb797be917f06d1bda69855cae2f36950e9506119e81165927787e13b80a17a1b647ef2c221916 build_14816-non-portable-build.patch +3e04fff2d9d9b39ac4dce0b80f4b566fff8819313a5bf1df791e8f1a63a26ef882bd8aa1524344f63fbb4a3728077179b7f1d7ebefc003c236d39a48beaa0073 build_14816-stop-overriding-aspnetcore-version.patch +70d402d0bcaa98c8b09652365404238b67ed26eb9c3d510c7d6309fb61937d98c9144f1096e521c11b00e946d29585a9d474498ccc5223de32bd6471ab5a431f build_14816-update-portable-rid-logic.patch +a5a359af816595fbf19482e5dccf874c78d2fc4b59f38223118aac603b33e00c9fed22580eee3112519477205c2c8ed16177d100f09f45275e3da3c20b0ed7f7 build_disable-apphost.diff +941b430b55e323f723bbc5160447f060f40d18ce32e5803ab7dda16bfc60a0f5ec1dccd246e68475d7115ee265a9433824d8a5d997c302531311194a90deeca9 check_rid-alpine-generation.diff +23b712d7a088e780cd0994c5577b4c015cc1478e3a6bbca9b6e97ff2f2711562ef3a01ed483582a6861b31989b949972e2159caa4a34e0b18b6e8c062bb82c9e installer_13378-arm-build.patch +7ffda90d766217e7c3756ebd423b557218c24f5337668b319421514945d3f961d82037c997b7254de088b1853102d7de15e0d824cf2cc02a6c455efc2b0107a2 installer_14816-crossgen2-rid.patch +e71f91d14873755bc2f227807d909e5260bd1f166a262eda0bf05d4a3975a7bce7fde457c1eba476a83b317aebdaaba25f1893d3385182428c08bba6243f21c8 installer_14816-update-portable-rid-logic.patch +86e14ecc0269c8b2c2a2a679790de4fa4e15ac06b2a831e1129c4a7de1499d60583fcdc79b3705652c3c4ced73afac2e0ee3edce2cfa3b00fddf94180fb26e10 msbuild_optional-systemconfiguration.patch +f4d27624f735ce77e0030fa791594fc12fb325a3ce8620791a7856bd5c0067a042df2196ec97ed4d0309db64bd51e6a48cafaad316d9ea45e34134214a7f3ca4 msbuild_optional-systemsecurity.patch +42779a7bf1004fe0f7054cfa4f09f49d7f2a57c0543ec994ffbd54fb349abb508295476098ed35d60e9676be8bcc15aa8a9ec5c814cd1e058357530b5cdfb2b6 roslyn_57003-mono-namedmutex.patch +e67e0114bd324dae65eb19f6fa8c74414bee77cd30e299931b0d82b4ca1b6b6f88358a0c47ffb180f46c5cb28f61f79bb4a59d43c1ae3011bfe491e757de293a runtime_76500-mono-musl-support.patch +827e899a83103f666dc3d57c1ec695bebc659a574f4a1d754da0cafe8c18d7db79c3950267e905fa078f94612ee1101fbddd0ea62b3c08947d8bcd7d9c8de41c runtime_82269-mono-thread-coop-undefine-fortify-source.patch +91f237afe642d0170dbf0e9a2706a4145c937d9d869d22959acaf092f1fd11941144b2b1d041102abe7b70349dd5869d558896e9d13d01f176cace39b21ef1ef runtime_enable-system-libunwind.diff +5f465f6e3bfbff66551a5690eb41be46735f8e0b1e6e6503038521a8cc60cd66b7839426319ec304f785c9f074ef588b1f189ad6dbb6ced53257af28b09388f2 runtime_lld-fix.patch +d1b4ebcbb1a6815fc0ce4c471485c232618e60968a879309fb8336821a9351d2e0028d9f7726c0c041c750b497a0baa47400c78c9ceff550b91b4a6c2816fc41 sdk_14239-add-zsh-compdef-completion-script.patch +815de1dad37412579b16d763debe2ecceffb44f5c46bd3f4ac00b3e431b20c677db435794eac41cea5601030b4e0f03f19e2d53c7a1ead896de2ffbca787eb84 sdk_telemetry-optout.patch +" diff --git a/user/dotnet6-build/README.md b/user/dotnet6-build/README.md new file mode 100644 index 0000000..cc09eb4 --- /dev/null +++ b/user/dotnet6-build/README.md @@ -0,0 +1,131 @@ +# dotnet6-build + +This is the .NET 6.0 package for Alpine Linux. + +Please report any issues [using Gitlab](https://gitlab.alpinelinux.org/alpine/aports/-/issues/new) and tag @ayakael + +# Building info + +## Generated packages +* dotnet6-build (aimed for internal use as bootstrap) +* dotnet6-build-artifacts (aimed for internal use as bootstrap) +* dotnet6-sdk +* dotnet6-templates (required by sdk) +* dotnet-zsh-completion +* dotnet-bash-completion +* dotnet-doc +* netstandard21-targeting-pack + +## How to build dotnet6 on Alpine +As dotnet is a self-hosting compiler (thus it compiles using itself), it requires a bootstrap +for the initial build. To solve this problem, this package follows the `stage0` proposal +outlined [here](https://lists.alpinelinux.org/~alpine/devel/%3C33KG0XO61I4IL.2Z7RTAZ5J3SY6%408pit.net%3E) + +The goal of `stage0` is to bootstrap dotnet with as little intervention as possible, thus allowing +seamless Alpine upgrades. Unfortunately, upstream only builds bootstraps for Alpine on `x86_64`, +`aarch64`, and `armv7`. Thus, `dotnet6-cross`, a non-standard (read: never to be included in aports) aport, was created to +faciliate cross-compiling bootstraps from `x86_64` to other dotnet supported platforms. +It is [available here](https://gitlab.alpinelinux.org/ayakael/dotnet6-cross) + +In summary, dotnet6 is built using four different aports, three of which are in aports proper: + +* `dotnet6-cross` [available here](https://gitlab.alpinelinux.org/ayakael/dotnet6-cross) +Builds minimum components for dotnet6, and packages these in a tar.gz that `dotnet6-stage0` then uses to build full bootstrap. +* `community/dotnet6-stage0` +Builds full bootstrap for dotnet6, and packages these in an initial `dotnet6-stage0-bootstrap` package that `dotnet6-build` +pulls if `dotnet6-build` has not been built before. +* `community/dotnet6-build +Builds full and packages dotnet6 fully using either stage0 or previoulsy built dotnet6 build. +* `community/dotnet6-runtime +As abuild does not allow different versions for subpackages, a different aport is required to +package runtime bits from dotnet6-build. + +# Specification + +This package follows [package naming and contents suggested by upstream](https://docs.microsoft.com/en-us/dotnet/core/build/distribution-packaging), +with two exceptions. It installs dotnet to `/usr/lib/dotnet` (aka `$_libdir`). +In addition, the package is named `dotnet6` as opposed to `dotnet-6.0` +to match Alpine Linux naming conventions for packages with many installable versions + +# Contributing + +The steps below are for the final package. Please only contribute to a +pre-release version if you know what you are doing. Original instructions +follow. + +## General Changes + +1. Fork the main aports repo. + +2. Checkout the forked repository. + + - `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports + - `cd community/dotnet6-build` + +3. Make your changes. Don't forget to add a changelog. + +4. Do local builds. + + - `abuild -r` + +5. Fix any errors that come up and rebuild until it works locally. + +6. Commit the changes to the git repo in a git branch + + - `git checkout -b dotnet6/` + - `git add` any new patches + - `git remove` any now-unnecessary patches + - `git commit -m 'community/dotnet6-build: descriptive description'` + - `git push` + +7. Create a merge request with your changes, tagging @ayakael for review. + +8. Once the tests in the pull-request pass, and reviewers are happy, your changes + will be merged. + +## Updating to an new upstream release + +1. Fork the main aports repo. + +2. Checkout the forked repository. + + - `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports + - `cd community/dotnet6-build` + + +3. Build the new upstream source tarball. Update the versions in the + APKBUILD file, and then create a snapshot. After build, update checksum. + + - `abuild snapshot` + - `abuild checksum` + +4. Do local builds. + + - `abuild -r` + +5. Fix any errors that come up and rebuild until it works locally. Any + patches that are needed at this point should be added to the APKBUILD file + in `_patches` variable. + +6. Upload the source archive to a remote location, and update `source` variable. + +7. Commit the changes to the git repo in a git branch. + + - `git checkout -b dotnet6/` + - `git add` any new patches + - `git remove` any now-unnecessary patches + - `git commit -m 'community/dotnet6-build: upgrade to ` + - `git push` + +8. Create a merge request with your changes, tagging @ayakael for review. + +9. Once the tests in the pull-request pass, and reviewers are happy, your changes + will be merged. + +# Testing + +This package uses CI tests as defined in `check()` function. Creating a +merge-request or running a build will fire off tests and flag any issues. + +The tests themselves are contained in this external repository: +https://github.com/redhat-developer/dotnet-regular-tests/ diff --git a/user/dotnet6-build/aspnetcore_46735-set-known-good-runtimeid.patch b/user/dotnet6-build/aspnetcore_46735-set-known-good-runtimeid.patch new file mode 100644 index 0000000..528bfce --- /dev/null +++ b/user/dotnet6-build/aspnetcore_46735-set-known-good-runtimeid.patch @@ -0,0 +1,34 @@ +From 4f21dd6d62c740e2cc2557bbc5d6c2f2653a5612 Mon Sep 17 00:00:00 2001 +Patch-Source: https://github.com/dotnet/aspnetcore/pull/46735 +From: Antoine Martin +Date: Wed, 9 Mar 2022 08:17:41 +0000 +Subject: [PATCH 1/1] arm build + +Forgotten backport from https://github.com/dotnet/aspnetcore/pull/43937. +Without this, aspnetcore does not properly ingest new RIDs generated by runtime + +--- +diff --git a/src/aspnetcore/eng/tools/GenerateFiles/Directory.Build.targets.in b/src/aspnetcore/eng/tools/GenerateFiles/Directory.Build.targets.in +index 5e693b6d7c..500113ea46 100644 +--- a/src/aspnetcore/eng/tools/GenerateFiles/Directory.Build.targets.in ++++ b/src/aspnetcore/eng/tools/GenerateFiles/Directory.Build.targets.in +@@ -42,6 +42,18 @@ + $(TargetRuntimeIdentifier) + + ++ ++ ${MicrosoftNETCoreAppRuntimeVersion} ++ $(TargetRuntimeIdentifier) ++ ++ ++ ++ ${MicrosoftNETCoreAppRuntimeVersion} ++ $(TargetRuntimeIdentifier) ++ ++ + + ${MicrosoftNETCoreAppRuntimeVersion} + diff --git a/user/dotnet6-build/build_13378-arm-build.patch b/user/dotnet6-build/build_13378-arm-build.patch new file mode 100644 index 0000000..5c23c42 --- /dev/null +++ b/user/dotnet6-build/build_13378-arm-build.patch @@ -0,0 +1,71 @@ +From 75c3e74ea35219f257c80daf9a236e0f518a7875 Mon Sep 17 00:00:00 2001 +Patch-Source: https://github.com/dotnet/installer/pull/13378 +From: Antoine Martin +Date: Wed, 9 Mar 2022 20:16:03 +0000 +Subject: [PATCH 1/1] arm support + +By default, build does not support arm. This patch introduces all the logics +to parse platform information. + +--- + Directory.Build.props | 2 +- + repos/known-good.proj | 2 +- + repos/runtime.common.props | 2 +- + tools-local/init-build.proj | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/Directory.Build.props b/Directory.Build.props +index 61cc6ff67..d921eda93 100644 +--- a/Directory.Build.props ++++ b/Directory.Build.props +@@ -17,7 +17,7 @@ + + + $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()) +- $(BuildArchitecture) ++ $(BuildArchitecture) + $(BuildArchitecture) + x64 + +diff --git a/repos/known-good.proj b/repos/known-good.proj +index eab516290..c04cdac70 100644 +--- a/repos/known-good.proj ++++ b/repos/known-good.proj +@@ -18,7 +18,7 @@ + + + +- ++ + + + +diff --git a/repos/runtime.common.props b/repos/runtime.common.props +index b1e9e6adb..037c3d94a 100644 +--- a/repos/runtime.common.props ++++ b/repos/runtime.common.props +@@ -13,7 +13,7 @@ + $(StandardSourceBuildArgs.Replace('-bl', '-nobl')) + + $(StandardSourceBuildCommand) $(BuildCommandArgs) +- $(ArmEnvironmentVariables) $(StandardSourceBuildCommand) $(BuildCommandArgs) ++ $(ArmEnvironmentVariables) $(StandardSourceBuildCommand) $(BuildCommandArgs) + + $(ProjectDirectory)/clean$(ShellExtension) + +diff --git a/tools-local/init-build.proj b/tools-local/init-build.proj +index 701f76c0c..b2c3beed1 100644 +--- a/tools-local/init-build.proj ++++ b/tools-local/init-build.proj +@@ -138,7 +138,7 @@ + + + +- ++ + + + +-- +2.35.1 + diff --git a/user/dotnet6-build/build_14816-non-portable-build.patch b/user/dotnet6-build/build_14816-non-portable-build.patch new file mode 100644 index 0000000..3116495 --- /dev/null +++ b/user/dotnet6-build/build_14816-non-portable-build.patch @@ -0,0 +1,208 @@ +From 3008f7ef29e0a5593f6f0afbdc9343f573f1a375 Mon Sep 17 00:00:00 2001 +Patch-Source: https://github.com/dotnet/installer/pull/14816 +From: Antoine Martin +Date: Tue, 15 Nov 2022 01:04:07 -0500 +Subject: [PATCH 1/3] Eliminate runtime portable build (backport dotnet#14549) + +--- + .../tarball/content/Directory.Build.props | 8 -- + .../tarball/content/repos/aspnetcore.proj | 1 + + .../tarball/content/repos/installer.proj | 2 +- + .../tarball/content/repos/known-good.proj | 1 - + .../content/repos/runtime-portable.proj | 47 ----------- + .../content/repos/runtime.common.props | 43 ---------- + .../content/repos/runtime.common.targets | 46 ----------- + .../tarball/content/repos/runtime.proj | 82 ++++++++++++++++++- + .../source-build-reference-packages.proj | 4 +- + src/redist/targets/Crossgen.targets | 2 +- + src/redist/targets/GenerateLayout.targets | 3 + + 11 files changed, 88 insertions(+), 151 deletions(-) + delete mode 100644 repos/runtime-portable.proj + delete mode 100644 repos/runtime.common.props + delete mode 100644 repos/runtime.common.targets + +diff --git a/Directory.Build.props b/Directory.Build.props +index 61cc6ff67..2e2d7e8bc 100644 +--- a/Directory.Build.props ++++ b/Directory.Build.props +@@ -22,14 +22,6 @@ + x64 + + false +- +- +- false +- false +- true +- false + + + +diff --git a/repos/aspnetcore.proj b/repos/aspnetcore.proj +index 480f3c713..52243024a 100644 +--- a/repos/aspnetcore.proj ++++ b/repos/aspnetcore.proj +@@ -9,6 +9,7 @@ + $(BuildCommandArgs) --no-build-repo-tasks + $(BuildCommandArgs) /p:BuildNodeJs=false + $(BuildCommandArgs) /p:PublishCompressedFilesPathPrefix=$(SourceBuiltAspNetCoreRuntime) ++ $(BuildCommandArgs) /p:PortableBuild=false /p:TargetRuntimeIdentifier=$(TargetRid) + + $(BuildCommandArgs) /p:MicrosoftNetFrameworkReferenceAssembliesVersion=1.0.0 +diff --git a/repos/installer.proj b/repos/installer.proj +index e34337b85..6c08a1f67 100644 +--- a/repos/installer.proj ++++ b/repos/installer.proj +@@ -25,7 +25,7 @@ + $(BuildCommandArgs) /p:Rid=$(TargetRid) + $(BuildCommandArgs) /p:DOTNET_INSTALL_DIR=$(DotNetCliToolDir) + +- $(BuildCommandArgs) /p:AspNetCoreInstallerRid=linux-$(Platform) ++ $(BuildCommandArgs) /p:AspNetCoreInstallerRid=$(TargetRid) + + $(BuildCommandArgs) /p:CoreSetupRid=freebsd-x64 /p:PortableBuild=true + $(BuildCommandArgs) /p:CoreSetupRid=osx-x64 +diff --git a/repos/known-good.proj b/repos/known-good.proj +index eab516290..12d9943da 100644 +--- a/repos/known-good.proj ++++ b/repos/known-good.proj +@@ -44,7 +44,6 @@ + + + +- + + + +diff --git a/repos/runtime.proj b/repos/runtime.proj +index f3ed143f8..efd8b66fa 100644 +--- a/repos/runtime.proj ++++ b/repos/runtime.proj +@@ -1,18 +1,53 @@ + +- ++ + ++ + ++ true ++ ++ $(ProjectDirectory)/clean$(ShellExtension) ++ + $(TargetRid) + osx-x64 + freebsd-x64 + win-x64 + ++ <_platformIndex>$(NETCoreSdkRuntimeIdentifier.LastIndexOf('-')) ++ $(NETCoreSdkRuntimeIdentifier.Substring(0, $(_platformIndex))) ++ ++ <_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-')) ++ $(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex))) ++ + $(StandardSourceBuildArgs) + $(BuildCommandArgs) /p:TargetRid=$(OverrideTargetRid) ++ $(BuildCommandArgs) /p:RuntimeOS=$(RuntimeOS) ++ $(BuildCommandArgs) /p:BaseOS=$(BaseOS) + $(BuildCommandArgs) /p:SourceBuildNonPortable=true + $(StandardSourceBuildCommand) $(BuildCommandArgs) + + ++ ++ ++ $(ProjectDirectory)global.json ++ $(ProjectDirectory)NuGet.config ++ false ++ true ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -20,8 +55,49 @@ + + + +- + + +- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ $(ProjectDirectory)pkg/Microsoft.NETCore.Platforms/runtime.json ++ ++ ++ ++ ++ ++ ++ ++ ++ <_builtRuntimePackages Include="$(SourceBuiltAssetsDir)*.symbols.nupkg" /> ++ <_builtRuntimePackages> ++ $([System.String]::Copy('%(FileName)').Replace('symbols', 'nupkg')) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + +diff --git a/repos/source-build-reference-packages.proj b/repos/source-build-reference-packages.proj +index 69ab564a2..9545b50e4 100644 +--- a/repos/source-build-reference-packages.proj ++++ b/repos/source-build-reference-packages.proj +@@ -2,7 +2,9 @@ + + + +- $(StandardSourceBuildCommand) $(StandardSourceBuildArgs) ++ $(StandardSourceBuildArgs) ++ $(BuildCommandArgs) /p:MicrosoftNetCoreIlasmPackageRuntimeId=$(NETCoreSdkRuntimeIdentifier) ++ $(StandardSourceBuildCommand) $(BuildCommandArgs) + + $(ProjectDirectory)NuGet.config + $(ProjectDirectory)global.json +-- +2.38.2 + diff --git a/user/dotnet6-build/build_14816-stop-overriding-aspnetcore-version.patch b/user/dotnet6-build/build_14816-stop-overriding-aspnetcore-version.patch new file mode 100644 index 0000000..e42f25f --- /dev/null +++ b/user/dotnet6-build/build_14816-stop-overriding-aspnetcore-version.patch @@ -0,0 +1,69 @@ +From 94463478bd6aaec208bc5e3dd1d120e0a49aeaaa Mon Sep 17 00:00:00 2001 +Patch-Source: https://github.com/dotnet/installer/pull/14816 +From: Antoine Martin +Date: Tue, 15 Nov 2022 01:08:29 -0500 +Subject: [PATCH 3/3] source-build: stop overriding aspnetcore version + (backport of #14938) + +--- + .../tarball/content/Directory.Build.props | 4 ---- + .../tarball/content/tools-local/init-build.proj | 12 ++++++++++++ + 2 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/Directory.Build.props b/Directory.Build.props +index 2e2d7e8bc..6b08fa71b 100644 +--- a/Directory.Build.props ++++ b/Directory.Build.props +@@ -222,12 +222,8 @@ + + + +- + + +- +- +- + + + +diff --git a/tools-local/init-build.proj b/tools-local/init-build.proj +index 701f76c0c..ac4508947 100644 +--- a/tools-local/init-build.proj ++++ b/tools-local/init-build.proj +@@ -9,6 +9,7 @@ + + + ++ + + + +@@ -22,6 +23,7 @@ + + + ++ ++ ++ ++ ++ ++ + +-- +2.38.2 + diff --git a/user/dotnet6-build/build_14816-update-portable-rid-logic.patch b/user/dotnet6-build/build_14816-update-portable-rid-logic.patch new file mode 100644 index 0000000..3c411e3 --- /dev/null +++ b/user/dotnet6-build/build_14816-update-portable-rid-logic.patch @@ -0,0 +1,38 @@ +From 5ee269eef8bd02d066151deaa4d8c0fe6b6cbce4 Mon Sep 17 00:00:00 2001 +Patch-Source: https://github.com/dotnet/installer/pull/14816 +From: Antoine Martin +Date: Tue, 15 Nov 2022 01:04:46 -0500 +Subject: [PATCH 2/3] BundledVersions: update portable rid logic (backport + dotnet#14647) + +--- + .../tarball/content/repos/installer.proj | 5 +++++ + src/redist/targets/GetRuntimeInformation.targets | 16 ++++++++++------ + 2 files changed, 15 insertions(+), 6 deletions(-) + +diff --git a/repos/installer.proj b/repos/installer.proj +index 6c08a1f67..95d47c941 100644 +--- a/repos/installer.proj ++++ b/repos/installer.proj +@@ -10,6 +10,10 @@ + osx-x64 + $(OverrideTargetRid.Substring(0, $(OverrideTargetRid.IndexOf("-")))) + ++ ++ <_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-')) ++ $(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex))) ++ + --runtime-id $(OverrideTargetRid) + --runtime-id $(TargetRid) + +@@ -22,6 +26,7 @@ + --> + $(BuildCommandArgs) /p:NETCoreAppMaximumVersion=99.9 + $(BuildCommandArgs) /p:OSName=$(OSNameOverride) ++ $(BuildCommandArgs) /p:PortableOSName=$(PortableOS) + $(BuildCommandArgs) /p:Rid=$(TargetRid) + $(BuildCommandArgs) /p:DOTNET_INSTALL_DIR=$(DotNetCliToolDir) + +-- +2.38.2 + diff --git a/user/dotnet6-build/build_disable-apphost.diff b/user/dotnet6-build/build_disable-apphost.diff new file mode 100644 index 0000000..317a915 --- /dev/null +++ b/user/dotnet6-build/build_disable-apphost.diff @@ -0,0 +1,79 @@ +From 75c3e74ea35219f257c80daf9a236e0f518a7875 Mon Sep 17 00:00:00 2001 +From: Antoine Martin +Date: Wed, 9 Mar 2022 20:16:03 +0000 +Subject: [PATCH 1/1] Disable apphost + +Disables use of apphost + +--- + +--- a/src/fsharp/tests/benchmarks/MicroPerf/MicroPerf.fsproj ++++ b/src/fsharp/tests/benchmarks/MicroPerf/MicroPerf.fsproj +@@ -9,6 +9,7 @@ + $(OtherFlags) --nowarn:57 + $(OtherFlags) --langversion:preview + $(OtherFlags) --define:PREVIEW ++ false + + + + $(OtherFlags) --nowarn:1204 + +--- a/src/arcade/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj ++++ b/src/arcade/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj +@@ -5,6 +5,7 @@ + netcoreapp3.1 + latest + true ++ false + + + +--- a/src/arcade/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj ++++ b/src/arcade/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj +@@ -9,6 +9,7 @@ + dotnet-swaggergen + false + true ++ false + + + +--- a/src/arcade/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj ++++ b/src/arcade/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj +@@ -11,6 +11,7 @@ + 2.5.1 + true + Major ++ false + + + +--- a/src/roslyn-analyzers/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj ++++ b/src/roslyn-analyzers/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj +@@ -4,6 +4,7 @@ + netcoreapp3.1 + true + true ++ false + + + +--- a/src/roslyn/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj ++++ b/src/roslyn/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj +@@ -5,6 +5,7 @@ + Exe + netcoreapp3.1 + ++ false + false + + diff --git a/user/dotnet6-build/check_rid-alpine-generation.diff b/user/dotnet6-build/check_rid-alpine-generation.diff new file mode 100644 index 0000000..ee389e9 --- /dev/null +++ b/user/dotnet6-build/check_rid-alpine-generation.diff @@ -0,0 +1,42 @@ +From 5bbd0366f3caa6281fbafb49882a226453371b6a Mon Sep 17 00:00:00 2001 +From: Antoine Martin (ayakael) +Date: Wed, 10 Aug 2022 00:57:30 +0000 +Subject: [PATCH 1/1] fix-runtme-id + +General fix for RID normalisation in testing suite + +--- + runtime-id | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +diff --git a/runtime-id b/runtime-id +index 5673bba..7369776 100755 +--- a/runtime-id ++++ b/runtime-id +@@ -44,12 +44,15 @@ if [[ ${portable_rid} == 1 ]]; then + echo "linux-${arch}" + fi + else +- case "${ID}" in +- # Remove the minor version +- alpine|ol|rhel|rocky) rid_version=${VERSION_ID%.*} ;; +- +- *) rid_version=${VERSION_ID} ;; +- esac +- +- echo "${ID}.${rid_version}-${arch}" ++ VERSION_ID_DOT="${VERSION_ID//[^.]}" ++ while [[ ${#VERSION_ID_DOT} -gt 1 ]]; do ++ VERSION_ID="${VERSION_ID%.*}" ++ VERSION_ID_DOT="${VERSION_ID//[^.]}" ++ done ++ VERSION_ID_DASH="${VERSION_ID//[^_]}" ++ while [[ ${#VERSION_ID_DASH} -ge 1 ]]; do ++ VERSION_ID="${VERSION_ID%_*}" ++ VERSION_ID_DASH="${VERSION_ID//[^_]}" ++ done ++ echo "${ID}.${VERSION_ID}-${arch}" + fi +-- +2.37.1 + diff --git a/user/dotnet6-build/installer_13378-arm-build.patch b/user/dotnet6-build/installer_13378-arm-build.patch new file mode 100644 index 0000000..9f534d3 --- /dev/null +++ b/user/dotnet6-build/installer_13378-arm-build.patch @@ -0,0 +1,43 @@ +From 4f21dd6d62c740e2cc2557bbc5d6c2f2653a5612 Mon Sep 17 00:00:00 2001 +Patch-Source: https://github.com/dotnet/installer/pull/13378 +From: Antoine Martin +Date: Wed, 9 Mar 2022 08:17:41 +0000 +Subject: [PATCH 1/1] arm build + +By default, installer does not support arm. This patch introduces all the logics +to parse platform information. + +--- + Directory.Build.props | 2 +- + eng/Build.props | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/installer/Directory.Build.props b/src/installer/Directory.Build.props +index c373c9beb..af0f16f88 100644 +--- a/src/installer/Directory.Build.props ++++ b/src/installer/Directory.Build.props +@@ -9,7 +9,7 @@ + + + $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()) +- $(BuildArchitecture) ++ $(BuildArchitecture) + $(BuildArchitecture) + x64 + +diff --git a/src/installer/eng/Build.props b/src/installer/eng/Build.props +index 4df683bab..0aa640051 100644 +--- a/src/installer/eng/Build.props ++++ b/src/installer/eng/Build.props +@@ -1,7 +1,7 @@ + + + +- + +-- +2.35.1 + diff --git a/user/dotnet6-build/installer_14816-crossgen2-rid.patch b/user/dotnet6-build/installer_14816-crossgen2-rid.patch new file mode 100644 index 0000000..4a2c6fe --- /dev/null +++ b/user/dotnet6-build/installer_14816-crossgen2-rid.patch @@ -0,0 +1,53 @@ +From 3008f7ef29e0a5593f6f0afbdc9343f573f1a375 Mon Sep 17 00:00:00 2001 +Patch-Source: https://github.com/dotnet/installer/pull/14816 +From: Antoine Martin +Date: Tue, 15 Nov 2022 01:04:07 -0500 +Subject: [PATCH 1/3] Eliminate runtime portable build (backport dotnet#14549) + +--- + .../tarball/content/Directory.Build.props | 8 -- + .../tarball/content/repos/aspnetcore.proj | 1 + + .../tarball/content/repos/installer.proj | 2 +- + .../tarball/content/repos/known-good.proj | 1 - + .../content/repos/runtime-portable.proj | 47 ----------- + .../content/repos/runtime.common.props | 43 ---------- + .../content/repos/runtime.common.targets | 46 ----------- + .../tarball/content/repos/runtime.proj | 82 ++++++++++++++++++- + .../source-build-reference-packages.proj | 4 +- + src/redist/targets/Crossgen.targets | 2 +- + src/redist/targets/GenerateLayout.targets | 3 + + 11 files changed, 88 insertions(+), 151 deletions(-) + delete mode 100644 src/SourceBuild/tarball/content/repos/runtime-portable.proj + delete mode 100644 src/SourceBuild/tarball/content/repos/runtime.common.props + delete mode 100644 src/SourceBuild/tarball/content/repos/runtime.common.targets + +diff --git a/src/installer/src/redist/targets/Crossgen.targets b/src/installer/src/redist/targets/Crossgen.targets +index 8949af132..a59ed388f 100644 +--- a/src/installer/src/redist/targets/Crossgen.targets ++++ b/src/installer/src/redist/targets/Crossgen.targets +@@ -6,7 +6,7 @@ + + + microsoft.netcore.app.runtime.$(SharedFrameworkRid) +- microsoft.netcore.app.crossgen2.$(HostOSName)-$(BuildArchitecture) ++ microsoft.netcore.app.crossgen2.$(Crossgen2Rid) + $(NuGetPackageRoot)/$(RuntimeNETCrossgenPackageName)/$(MicrosoftNETCoreAppRuntimePackageVersion)/tools/crossgen2$(ExeExtension) + +diff --git a/src/installer/src/redist/targets/GenerateLayout.targets b/src/installer/src/redist/targets/GenerateLayout.targets +index 88a053b61..ce5e09b69 100644 +--- a/src/installer/src/redist/targets/GenerateLayout.targets ++++ b/src/installer/src/redist/targets/GenerateLayout.targets +@@ -84,6 +84,9 @@ + dotnet-runtime$(PgoTerm)-$(VSRedistCommonNetCoreSharedFrameworkx6460PackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension) + windowsdesktop-runtime-$(MicrosoftWindowsDesktopAppRuntimePackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension) + ++ $(HostOSName)-$(BuildArchitecture) ++ $(SharedFrameworkRid) ++ + $(SharedFrameworkRid) + linux-x64 + $(AspNetCoreInstallerRid) +-- +2.38.2 + diff --git a/user/dotnet6-build/installer_14816-update-portable-rid-logic.patch b/user/dotnet6-build/installer_14816-update-portable-rid-logic.patch new file mode 100644 index 0000000..53f2335 --- /dev/null +++ b/user/dotnet6-build/installer_14816-update-portable-rid-logic.patch @@ -0,0 +1,51 @@ +From 5ee269eef8bd02d066151deaa4d8c0fe6b6cbce4 Mon Sep 17 00:00:00 2001 +Patch-Source: https://github.com/dotnet/installer/pull/14816 +From: Antoine Martin +Date: Tue, 15 Nov 2022 01:04:46 -0500 +Subject: [PATCH 2/3] BundledVersions: update portable rid logic (backport + dotnet#14647) + +--- + .../tarball/content/repos/installer.proj | 5 +++++ + src/redist/targets/GetRuntimeInformation.targets | 16 ++++++++++------ + 2 files changed, 15 insertions(+), 6 deletions(-) + +diff --git a/src/installer/src/redist/targets/GetRuntimeInformation.targets b/src/installer/src/redist/targets/GetRuntimeInformation.targets +index a99a7e9da..89f000119 100644 +--- a/src/installer/src/redist/targets/GetRuntimeInformation.targets ++++ b/src/installer/src/redist/targets/GetRuntimeInformation.targets +@@ -9,10 +9,15 @@ + osx + freebsd + linux +- ++ ++ $(Rid.Substring(0, $(Rid.LastIndexOf('-')))) + $(HostOSName) + +- $(OSName)-$(Architecture) ++ $(OSName) ++ ++ $(OSName)-$(Architecture) ++ ++ $(PortableOSName)-$(Architecture) + + + +@@ -23,10 +28,9 @@ + + + +- $(Rid) +- $(OSName)-$(Architecture) ++ $(Rid) ++ ++ $(PortableRid) + + $(HostOSName)-$(Architecture) + +-- +2.38.2 + diff --git a/user/dotnet6-build/msbuild_optional-systemconfiguration.patch b/user/dotnet6-build/msbuild_optional-systemconfiguration.patch new file mode 100644 index 0000000..b28c8be --- /dev/null +++ b/user/dotnet6-build/msbuild_optional-systemconfiguration.patch @@ -0,0 +1,69 @@ +From 26a12cb531161e1fc3d6ec1f2a241e1c516ca775 Mon Sep 17 00:00:00 2001 +Patch-Source: https://src.fedoraproject.org/rpms/dotnet6.0/blob/src/msbuild/rawhide/f/msbuild-no-systemconfiguration.patch +From: Antoine Martin +Date: Fri, 21 Oct 2022 14:13:04 -0400 +Subject: [PATCH 1/2] optional-systemconfiguration + +Fix mono-specific runtime crashes running msbuild. CoreCLR does not +load types that are not actually used/invoked at runtime, while mono +does. System.Configuration and System.Security are missing in +source-build builds, which breaks msbuild. + +--- + src/Build/Definition/ProjectCollection.cs | 4 ++++ + src/Build/Definition/ToolsetReader.cs | 8 ++++++++ + 2 files changed, 12 insertions(+) + +diff --git a/src/msbuild/src/Build/Definition/ProjectCollection.cs b/src/msbuild/src/Build/Definition/ProjectCollection.cs +index 8629bd943..6a550e32d 100644 +--- a/src/msbuild/src/Build/Definition/ProjectCollection.cs ++++ b/src/msbuild/src/Build/Definition/ProjectCollection.cs +@@ -1754,7 +1754,11 @@ namespace Microsoft.Build.Evaluation + #if FEATURE_WIN32_REGISTRY + ToolsetRegistryReader registryReader = null, + #endif ++#if FEATURE_SYSTEM_CONFIGURATION + ToolsetConfigurationReader configReader = null ++#else ++ object configReader = null ++#endif + ) + { + _toolsets = new Dictionary(StringComparer.OrdinalIgnoreCase); +diff --git a/src/msbuild/src/Build/Definition/ToolsetReader.cs b/src/msbuild/src/Build/Definition/ToolsetReader.cs +index 869b3318e..c6b95d3cf 100644 +--- a/src/msbuild/src/Build/Definition/ToolsetReader.cs ++++ b/src/msbuild/src/Build/Definition/ToolsetReader.cs +@@ -101,7 +101,11 @@ namespace Microsoft.Build.Evaluation + #if FEATURE_WIN32_REGISTRY + ToolsetRegistryReader registryReader, + #endif ++#if FEATURE_SYSTEM_CONFIGURATION + ToolsetConfigurationReader configurationReader, ++#else ++ object _configurationReader, ++#endif + PropertyDictionary environmentProperties, + PropertyDictionary globalProperties, + ToolsetDefinitionLocations locations +@@ -120,6 +124,7 @@ namespace Microsoft.Build.Evaluation + + if ((locations & ToolsetDefinitionLocations.ConfigurationFile) == ToolsetDefinitionLocations.ConfigurationFile) + { ++#if FEATURE_SYSTEM_CONFIGURATION + if (configurationReader == null) + { + configurationReader = new ToolsetConfigurationReader(environmentProperties, globalProperties); +@@ -129,6 +134,9 @@ namespace Microsoft.Build.Evaluation + defaultToolsVersionFromConfiguration = configurationReader.ReadToolsets(toolsets, globalProperties, + initialProperties, true /* accumulate properties */, out overrideTasksPathFromConfiguration, + out defaultOverrideToolsVersionFromConfiguration); ++#else ++ throw new InvalidOperationException("ToolsetDefinitionLocations.ConfigurationFile not supported"); ++#endif + } + + string defaultToolsVersionFromRegistry = null; +-- +2.36.3 + diff --git a/user/dotnet6-build/msbuild_optional-systemsecurity.patch b/user/dotnet6-build/msbuild_optional-systemsecurity.patch new file mode 100644 index 0000000..02429f9 --- /dev/null +++ b/user/dotnet6-build/msbuild_optional-systemsecurity.patch @@ -0,0 +1,32 @@ +From 06707ec777769f1756230caf54391302e4378777 Mon Sep 17 00:00:00 2001 +Patch-Source: https://src.fedoraproject.org/rpms/dotnet6.0/blob/src/msbuild/rawhide/f/msbuild-no-systemsecurity.patch +From: Antoine Martin +Date: Fri, 21 Oct 2022 14:13:29 -0400 +Subject: [PATCH 2/2] optional-systemsecurity + +Fix mono-specific runtime crashes running msbuild. CoreCLR does not +load types that are not actually used/invoked at runtime, while mono +does. System.Configuration and System.Security are missing in +source-build builds, which breaks msbuild. + +--- + src/Shared/ExceptionHandling.cs | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/msbuild/src/Shared/ExceptionHandling.cs b/src/msbuild/src/Shared/ExceptionHandling.cs +index 16a0576b5..1c7cd5967 100644 +--- a/src/msbuild/src/Shared/ExceptionHandling.cs ++++ b/src/msbuild/src/Shared/ExceptionHandling.cs +@@ -153,7 +153,9 @@ namespace Microsoft.Build.Shared + internal static bool IsXmlException(Exception e) + { + return e is XmlException ++#if FEATURE_SECURITY_PERMISSIONS + || e is XmlSyntaxException ++#endif + || e is XmlSchemaException + || e is UriFormatException; // XmlTextReader for example uses this under the covers + } +-- +2.36.3 + diff --git a/user/dotnet6-build/roslyn_57003-mono-namedmutex.patch b/user/dotnet6-build/roslyn_57003-mono-namedmutex.patch new file mode 100644 index 0000000..74a19ce --- /dev/null +++ b/user/dotnet6-build/roslyn_57003-mono-namedmutex.patch @@ -0,0 +1,470 @@ +From 210c17ea60f525837a7525df73e7332598ad4089 Mon Sep 17 00:00:00 2001 +Patch-Source: https://github.com/dotnet/roslyn/pull/57003 +From: Antoine Martin +Date: Sat, 27 Aug 2022 21:26:01 -0800 +Subject: [PATCH 1/1] mono-named-mutex + +--- + .../InternalUtilities/PlatformInformation.cs | 19 ++ + .../VBCSCompilerTests/BuildClientTests.cs | 2 +- + .../CompilerServerApiTest.cs | 4 +- + .../VBCSCompilerTests/CompilerServerTests.cs | 4 +- + .../VBCSCompilerServerTests.cs | 7 +- + src/Compilers/Shared/BuildServerConnection.cs | 251 +++++++++++------- + 6 files changed, 182 insertions(+), 105 deletions(-) + +diff --git a/src/roslyn/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs b/src/roslyn/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs +index 033e66cd2f2..d4fa56413fb 100644 +--- a/src/roslyn/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs ++++ b/src/roslyn/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs +@@ -31,5 +31,24 @@ public static bool IsRunningOnMono + } + } + } ++ /// ++ /// Are we running on .NET 5 or later using the Mono runtime? ++ /// Will also return true when running on Mono itself; if necessary ++ /// we can use IsRunningOnMono to distinguish. ++ /// ++ public static bool IsUsingMonoRuntime ++ { ++ get ++ { ++ try ++ { ++ return !(Type.GetType("Mono.RuntimeStructs", throwOnError: false) is null); ++ } ++ catch ++ { ++ return false; ++ } ++ } ++ } + } + } +diff --git a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs +index 669d1bfb676..7f1d0468823 100644 +--- a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs ++++ b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs +@@ -79,7 +79,7 @@ public void ConnectToServerFails() + // to connect. When it fails it should fall back to in-proc + // compilation. + bool holdsMutex; +- using (var serverMutex = new Mutex(initiallyOwned: true, ++ using (var serverMutex = BuildServerConnection.OpenOrCreateMutex( + name: BuildServerConnection.GetServerMutexName(_pipeName), + createdNew: out holdsMutex)) + { +diff --git a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs +index 0dbd1b2e143..c00b72e8434 100644 +--- a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs ++++ b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs +@@ -103,7 +103,7 @@ public void MutexStopsServerStarting() + var mutexName = BuildServerConnection.GetServerMutexName(pipeName); + + bool holdsMutex; +- using (var mutex = new Mutex(initiallyOwned: true, ++ using (var mutex = BuildServerConnection.OpenOrCreateMutex( + name: mutexName, + createdNew: out holdsMutex)) + { +@@ -119,7 +119,7 @@ public void MutexStopsServerStarting() + } + finally + { +- mutex.ReleaseMutex(); ++ mutex.Dispose(); + } + } + } +diff --git a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs +index 3b6f4f291ff..e97a6bf923f 100644 +--- a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs ++++ b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs +@@ -304,7 +304,7 @@ public async Task ServerFailsWithLongTempPathUnix() + var newTempDir = _tempDirectory.CreateDirectory(new string('a', 100 - _tempDirectory.Path.Length)); + await ApplyEnvironmentVariables( + new[] { new KeyValuePair("TMPDIR", newTempDir.Path) }, +- async () => ++ async () => await Task.Run(async () => + { + using var serverData = await ServerUtil.CreateServer(_logger); + var result = RunCommandLineCompiler( +@@ -317,7 +317,7 @@ public async Task ServerFailsWithLongTempPathUnix() + + var listener = await serverData.Complete(); + Assert.Equal(CompletionData.RequestCompleted, listener.CompletionDataList.Single()); +- }); ++ })); + } + + [Fact] +diff --git a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs +index d5f493fed8a..73941972e48 100644 +--- a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs ++++ b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs +@@ -101,7 +101,7 @@ public async Task NoServerConnection() + + var thread = new Thread(() => + { +- using (var mutex = new Mutex(initiallyOwned: true, name: mutexName, createdNew: out created)) ++ using (var mutex = BuildServerConnection.OpenOrCreateMutex(name: mutexName, createdNew: out created)) + using (var stream = NamedPipeUtil.CreateServer(pipeName)) + { + readyMre.Set(); +@@ -112,7 +112,7 @@ public async Task NoServerConnection() + stream.Close(); + + doneMre.WaitOne(); +- mutex.ReleaseMutex(); ++ mutex.Dispose(); + } + }); + +@@ -153,7 +153,7 @@ public async Task ServerShutdownsDuringProcessing() + { + using (var stream = NamedPipeUtil.CreateServer(pipeName)) + { +- var mutex = new Mutex(initiallyOwned: true, name: mutexName, createdNew: out created); ++ var mutex = BuildServerConnection.OpenOrCreateMutex(name: mutexName, createdNew: out created); + readyMre.Set(); + + stream.WaitForConnection(); +@@ -161,7 +161,6 @@ public async Task ServerShutdownsDuringProcessing() + + // Client is waiting for a response. Close the mutex now. Then close the connection + // so the client gets an error. +- mutex.ReleaseMutex(); + mutex.Dispose(); + stream.Close(); + +diff --git a/src/roslyn/src/Compilers/Shared/BuildServerConnection.cs b/src/roslyn/src/Compilers/Shared/BuildServerConnection.cs +index f67c2d83957..1fe609061ee 100644 +--- a/src/roslyn/src/Compilers/Shared/BuildServerConnection.cs ++++ b/src/roslyn/src/Compilers/Shared/BuildServerConnection.cs +@@ -543,19 +543,10 @@ internal static bool WasServerMutexOpen(string mutexName) + { + try + { +- if (PlatformInformation.IsRunningOnMono) ++ if (PlatformInformation.IsUsingMonoRuntime) + { +- IServerMutex? mutex = null; +- bool createdNew = false; +- try +- { +- mutex = new ServerFileMutexPair(mutexName, false, out createdNew); +- return !createdNew; +- } +- finally +- { +- mutex?.Dispose(); +- } ++ using var mutex = new ServerFileMutex(mutexName); ++ return !mutex.CouldLock(); + } + else + { +@@ -572,9 +563,11 @@ internal static bool WasServerMutexOpen(string mutexName) + + internal static IServerMutex OpenOrCreateMutex(string name, out bool createdNew) + { +- if (PlatformInformation.IsRunningOnMono) ++ if (PlatformInformation.IsUsingMonoRuntime) + { +- return new ServerFileMutexPair(name, initiallyOwned: true, out createdNew); ++ var mutex = new ServerFileMutex(name); ++ createdNew = mutex.TryLock(0); ++ return mutex; + } + else + { +@@ -648,19 +641,22 @@ internal interface IServerMutex : IDisposable + } + + /// +- /// An interprocess mutex abstraction based on OS advisory locking (FileStream.Lock/Unlock). ++ /// An interprocess mutex abstraction based on file sharing permission (FileShare.None). + /// If multiple processes running as the same user create FileMutex instances with the same name, + /// those instances will all point to the same file somewhere in a selected temporary directory. +- /// The TryLock method can be used to attempt to acquire the mutex, with Unlock or Dispose used to release. ++ /// The TryLock method can be used to attempt to acquire the mutex, with Dispose used to release. ++ /// The CouldLock method can be used to check whether an attempt to acquire the mutex would have ++ /// succeeded at the current time, without actually acquiring it. + /// Unlike Win32 named mutexes, there is no mechanism for detecting an abandoned mutex. The file + /// will simply revert to being unlocked but remain where it is. + /// +- internal sealed class FileMutex : IDisposable ++ internal sealed class ServerFileMutex : IServerMutex + { +- public readonly FileStream Stream; ++ public FileStream? Stream; + public readonly string FilePath; ++ public readonly string GuardPath; + +- public bool IsLocked { get; private set; } ++ public bool IsDisposed { get; private set; } + + internal static string GetMutexDirectory() + { +@@ -670,61 +666,176 @@ internal static string GetMutexDirectory() + return result; + } + +- public FileMutex(string name) ++ public ServerFileMutex(string name) + { +- FilePath = Path.Combine(GetMutexDirectory(), name); +- Stream = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); ++ var mutexDirectory = GetMutexDirectory(); ++ FilePath = Path.Combine(mutexDirectory, name); ++ GuardPath = Path.Combine(mutexDirectory, ".guard"); + } + +- public bool TryLock(int timeoutMs) ++ /// ++ /// Acquire the guard by opening the guard file with FileShare.None. The guard must only ever ++ /// be held for very brief amounts of time, so we can simply spin until it is acquired. The ++ /// guard must be released by disposing the FileStream returned from this routine. Note the ++ /// guard file is never deleted; this is a leak, but only of a single file. ++ /// ++ internal FileStream LockGuard() + { +- if (IsLocked) +- throw new InvalidOperationException("Lock already held"); +- +- var sw = Stopwatch.StartNew(); +- do ++ // We should be able to acquire the guard quickly. Limit the number of retries anyway ++ // by some arbitrary bound to avoid getting hung up in a possibly infinite loop. ++ for (var i = 0; i < 100; i++) + { + try + { +- Stream.Lock(0, 0); +- IsLocked = true; +- return true; ++ return new FileStream(GuardPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); + } + catch (IOException) + { +- // Lock currently held by someone else. ++ // Guard currently held by someone else. + // We want to sleep for a short period of time to ensure that other processes + // have an opportunity to finish their work and relinquish the lock. + // Spinning here (via Yield) would work but risks creating a priority + // inversion if the lock is held by a lower-priority process. + Thread.Sleep(1); + } ++ } ++ // Handle unexpected failure to acquire guard as error. ++ throw new InvalidOperationException("Unable to acquire guard"); ++ } ++ ++ /// ++ /// Attempt to acquire the lock by opening the lock file with FileShare.None. Sets "Stream" ++ /// and returns true if successful, returns false if the lock is already held by another ++ /// thread or process. Guard must be held when calling this routine. ++ /// ++ internal bool TryLockFile() ++ { ++ Debug.Assert(Stream is null); ++ FileStream? stream = null; ++ try ++ { ++ stream = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); ++ // On some targets, the file locking used to implement FileShare.None may not be ++ // atomic with opening/creating the file. This creates a race window when another ++ // thread holds the lock and is just about to unlock: we may be able to open the ++ // file here, then the other thread unlocks and deletes the file, and then we ++ // acquire the lock on our file handle - but the actual file is already deleted. ++ // To close this race, we verify that the file does in fact still exist now that ++ // we have successfull acquired the locked FileStream. (Note that this check is ++ // safe because we cannot race with an other attempt to create the file since we ++ // hold the guard, and after the FileStream constructor returned we can no race ++ // with file deletion because we hold the lock.) ++ if (!File.Exists(FilePath)) ++ { ++ // To simplify the logic, we treat this case as "unable to acquire the lock" ++ // because it we caught another process while it owned the lock and was just ++ // giving it up. If the caller retries, we'll likely acquire the lock then. ++ stream.Dispose(); ++ return false; ++ } ++ } ++ catch (Exception) ++ { ++ stream?.Dispose(); ++ return false; ++ } ++ Stream = stream; ++ return true; ++ } ++ ++ /// ++ /// Release the lock by deleting the lock file and disposing "Stream". ++ /// ++ internal void UnlockFile() ++ { ++ Debug.Assert(Stream is not null); ++ try ++ { ++ // Delete the lock file while the stream is not yet disposed ++ // and we therefore still hold the FileShare.None exclusion. ++ // There may still be a race with another thread attempting a ++ // TryLockFile in parallel, but that is safely handled there. ++ File.Delete(FilePath); ++ } ++ finally ++ { ++ Stream.Dispose(); ++ Stream = null; ++ } ++ } ++ ++ public bool TryLock(int timeoutMs) ++ { ++ if (IsDisposed) ++ throw new ObjectDisposedException("Mutex"); ++ if (Stream is not null) ++ throw new InvalidOperationException("Lock already held"); ++ ++ var sw = Stopwatch.StartNew(); ++ do ++ { ++ try ++ { ++ // Attempt to acquire lock while holding guard. ++ using var guard = LockGuard(); ++ if (TryLockFile()) ++ return true; ++ } + catch (Exception) + { +- // Something else went wrong. + return false; + } ++ ++ // See comment in LockGuard. ++ Thread.Sleep(1); + } while (sw.ElapsedMilliseconds < timeoutMs); + + return false; + } + +- public void Unlock() ++ public bool CouldLock() + { +- if (!IsLocked) +- return; +- Stream.Unlock(0, 0); +- IsLocked = false; ++ if (IsDisposed) ++ return false; ++ if (Stream is not null) ++ return false; ++ ++ try ++ { ++ // Attempt to acquire lock while holding guard, and if successful ++ // immediately unlock again while still holding guard. This ensures ++ // no other thread will spuriously observe the lock as held due to ++ // the lock attempt here. ++ using var guard = LockGuard(); ++ if (TryLockFile()) ++ { ++ UnlockFile(); ++ return true; ++ } ++ } ++ catch (Exception) ++ { ++ return false; ++ } ++ ++ return false; + } + + public void Dispose() + { +- var wasLocked = IsLocked; +- if (wasLocked) +- Unlock(); +- Stream.Dispose(); +- // We do not delete the lock file here because there is no reliable way to perform a +- // 'delete if no one has the file open' operation atomically on *nix. This is a leak. ++ if (IsDisposed) ++ return; ++ IsDisposed = true; ++ if (Stream is not null) ++ { ++ try ++ { ++ UnlockFile(); ++ } ++ catch (Exception) ++ { ++ } ++ } + } + } + +@@ -792,56 +903,4 @@ public void Dispose() + } + } + } +- +- /// +- /// Approximates a named mutex with 'locked', 'unlocked' and 'abandoned' states. +- /// There is no reliable way to detect whether a mutex has been abandoned on some target platforms, +- /// so we use the AliveMutex to manually track whether the creator of a mutex is still running, +- /// while the HeldMutex represents the actual lock state of the mutex. +- /// +- internal sealed class ServerFileMutexPair : IServerMutex +- { +- public readonly FileMutex AliveMutex; +- public readonly FileMutex HeldMutex; +- +- public bool IsDisposed { get; private set; } +- +- public ServerFileMutexPair(string mutexName, bool initiallyOwned, out bool createdNew) +- { +- AliveMutex = new FileMutex(mutexName + "-alive"); +- HeldMutex = new FileMutex(mutexName + "-held"); +- createdNew = AliveMutex.TryLock(0); +- if (initiallyOwned && createdNew) +- { +- if (!TryLock(0)) +- throw new Exception("Failed to lock mutex after creating it"); +- } +- } +- +- public bool TryLock(int timeoutMs) +- { +- if (IsDisposed) +- throw new ObjectDisposedException("Mutex"); +- return HeldMutex.TryLock(timeoutMs); +- } +- +- public void Dispose() +- { +- if (IsDisposed) +- return; +- IsDisposed = true; +- +- try +- { +- HeldMutex.Unlock(); +- AliveMutex.Unlock(); +- } +- finally +- { +- AliveMutex.Dispose(); +- HeldMutex.Dispose(); +- } +- } +- } +- + } +-- +2.36.2 diff --git a/user/dotnet6-build/runtime_75597-support-building-runtime-with-non-portable-runtime.patch b/user/dotnet6-build/runtime_75597-support-building-runtime-with-non-portable-runtime.patch new file mode 100644 index 0000000..64717d1 --- /dev/null +++ b/user/dotnet6-build/runtime_75597-support-building-runtime-with-non-portable-runtime.patch @@ -0,0 +1,48 @@ +From 9a05b184f74fc299ddd33bccb74d153e0692d8c8 Mon Sep 17 00:00:00 2001 +From: Tom Deseyn +Date: Wed, 14 Sep 2022 11:06:42 +0200 +Subject: [PATCH 1/8] source-build: support building runtime using non-portable + runtime packages. + +Currently source-build performs a 'runtime-portable' build that produces +'linux-{arch}' packages that are used when building target runtime (non-portable). + +With this change, we can use the non-portable packages that are produced by +a previous (non-portable) 'runtime' build. This helps eliminate the +'runtime-portable' build. + +--- + src/runtime/Directory.Build.targets | 15 ++++ + src/runtime/Directory.Build.targets.orig | 96 ++++++++++++++++++++++++ + 2 files changed, 111 insertions(+) + create mode 100644 src/runtime/Directory.Build.targets.orig + +diff --git a/src/runtime/Directory.Build.targets b/src/runtime/Directory.Build.targets +index d0c698797..4337207a4 100644 +--- a/src/runtime/Directory.Build.targets ++++ b/src/runtime/Directory.Build.targets +@@ -11,6 +11,21 @@ + + + ++ ++ ++ ++ $(PackageRID) ++ ++ ++ $(PackageRID) ++ ++ ++ ++ ++ + + + + <_MonoCFLAGS Include="-Wl,--build-id=sha1" /> ++ <_MonoCFLAGS Include="-Wno-strict-prototypes" /> + <_MonoCXXFLAGS Include="-Wl,--build-id=sha1" /> ++ <_MonoCXXFLAGS Include="-Wno-strict-prototypes" /> + + + <_MonoAOTCFLAGS Include="-Wl,--build-id=sha1" /> ++ <_MonoAOTCFLAGS Include="-Wno-strict-prototypes" /> + <_MonoAOTCXXFLAGS Include="-Wl,--build-id=sha1" /> ++ <_MonoAOTCXXFLAGS Include="-Wno-strict-prototypes" /> + + + +@@ -500,15 +504,15 @@ + darwin-x86_64 + windows-x86_64 + <_MonoRuntimeFilePath>$(MonoObjDir)out\lib\$(MonoFileName) +- <_LinuxAbi Condition="'$(TargetsAndroid)' != 'true'">gnu +- <_LinuxAbi Condition="'$(TargetsAndroid)' == 'true'">android ++ <_LinuxAbi Condition="'$(TargetsAndroid)' != 'true'">alpine-linux-musl ++ <_LinuxAbi Condition="'$(TargetsAndroid)' == 'true'">linux-android + <_LinuxFloatAbi Condition="'$(TargetsAndroid)' != 'true'">hf + <_Objcopy>objcopy +- <_Objcopy Condition="'$(Platform)' == 'arm'">arm-linux-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy) +- <_Objcopy Condition="'$(Platform)' == 'arm64'">aarch64-linux-$(_LinuxAbi)-$(_Objcopy) +- <_Objcopy Condition="'$(Platform)' == 's390x'">s390x-linux-$(_LinuxAbi)-$(_Objcopy) +- <_Objcopy Condition="'$(Platform)' == 'x64'">x86_64-linux-$(_LinuxAbi)-$(_Objcopy) +- <_Objcopy Condition="'$(Platform)' == 'x86'">i686-linux-$(_LinuxAbi)-$(_Objcopy) ++ <_Objcopy Condition="'$(Platform)' == 'arm' and '$(CrossBuild)' == 'true'">arm-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy) ++ <_Objcopy Condition="'$(Platform)' == 'arm64' and '$(CrossBuild)' == 'true'">aarch64-$(_LinuxAbi)-$(_Objcopy) ++ <_Objcopy Condition="'$(Platform)' == 's390x' and '$(CrossBuild)' == 'true'">s390x-$(_LinuxAbi)-$(_Objcopy) ++ <_Objcopy Condition="'$(Platform)' == 'x64' and '$(CrossBuild)' == 'true'">x86_64-$(_LinuxAbi)-$(_Objcopy) ++ <_Objcopy Condition="'$(Platform)' == 'x86' and '$(CrossBuild)' == 'true'">i686-$(_LinuxAbi)-$(_Objcopy) + <_Objcopy Condition="'$(TargetsAndroid)' == 'true'">$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/bin/$(_Objcopy) + + +diff --git a/src/runtime/src/mono/mono/metadata/domain.c b/src/runtime/src/mono/mono/metadata/domain.c +index 4a8e06d28ae..e9868bd1b2c 100644 +--- a/src/runtime/src/mono/mono/metadata/domain.c ++++ b/src/runtime/src/mono/mono/metadata/domain.c +@@ -138,6 +138,14 @@ create_root_domain (void) + return domain; + } + ++static MONO_NO_OPTIMIZATION MONO_NEVER_INLINE void ++ensure_stack_size (void) ++{ ++ const int default_size = 5 * 1024 * 1024; ++ volatile uint8_t *s = (uint8_t *)g_alloca(default_size); ++ *s = 0; ++} ++ + /** + * mono_init_internal: + * +@@ -181,6 +189,8 @@ mono_init_internal (const char *filename, const char *exe_filename, const char * + + mono_counters_register ("Max HashTable Chain Length", MONO_COUNTER_INT|MONO_COUNTER_METADATA, &mono_g_hash_table_max_chain_length); + ++ ensure_stack_size (); ++ + mono_gc_base_init (); + mono_thread_info_attach (); + +diff --git a/src/runtime/src/mono/mono/mini/CMakeLists.txt b/src/runtime/src/mono/mono/mini/CMakeLists.txt +index 128ed08f45b..17cbe696c4b 100644 +--- a/src/runtime/src/mono/mono/mini/CMakeLists.txt ++++ b/src/runtime/src/mono/mono/mini/CMakeLists.txt +@@ -364,6 +364,11 @@ if(NOT DISABLE_SHARED_LIBS) + set_target_properties(monosgen-shared PROPERTIES IMPORT_SUFFIX ".import.lib") + endif() + target_link_libraries(monosgen-shared PRIVATE ${OS_LIBS} ${ICONV_LIB} ${LLVM_LIBS} ${ICU_LIBS} ${Z_LIBS}) ++ # Alpine Linux implements ucontext in a different library ++ if(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X) ++ target_link_libraries(monosgen-shared PRIVATE ucontext) ++ endif(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X) ++ + if(ICU_LDFLAGS) + set_property(TARGET monosgen-shared APPEND_STRING PROPERTY LINK_FLAGS " ${ICU_LDFLAGS}") + endif() +@@ -488,6 +493,11 @@ if(NOT DISABLE_EXECUTABLES) + set_target_properties(mono-sgen PROPERTIES OUTPUT_NAME mono-aot-cross) + endif() + target_link_libraries(mono-sgen PRIVATE monosgen-static ${OS_LIBS} ${ICONV_LIB} ${LLVM_LIBS} ${ICU_LIBS} ${Z_LIBS}) ++ # Alpine Linux implements ucontext in a different library ++ if(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X) ++ target_link_libraries(mono-sgen PRIVATE ucontext) ++ endif(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X) ++ + if(NOT DISABLE_COMPONENTS AND STATIC_COMPONENTS AND NOT DISABLE_LINK_STATIC_COMPONENTS) + # if components are built statically, link them into runtime. + target_sources(mono-sgen PRIVATE "${mono-components-objects}") +diff --git a/src/runtime/src/mono/mono/utils/mono-context.h b/src/runtime/src/mono/mono/utils/mono-context.h +index bd1a3cd0104..db4ba452bcb 100644 +--- a/src/runtime/src/mono/mono/utils/mono-context.h ++++ b/src/runtime/src/mono/mono/utils/mono-context.h +@@ -11,6 +11,14 @@ + #ifndef __MONO_MONO_CONTEXT_H__ + #define __MONO_MONO_CONTEXT_H__ + ++/* ++ * Handle non-gnu libc versions with nothing in features.h ++ * We have no idea what they're compatible with, so always fail. ++ */ ++#ifndef __GLIBC_PREREQ ++# define __GLIBC_PREREQ(x,y) 0 ++#endif ++ + #include "mono-compiler.h" + #include "mono-sigcontext.h" + #include "mono-machine.h" +-- +2.36.3 + diff --git a/user/dotnet6-build/runtime_82269-mono-thread-coop-undefine-fortify-source.patch b/user/dotnet6-build/runtime_82269-mono-thread-coop-undefine-fortify-source.patch new file mode 100644 index 0000000..aa34ceb --- /dev/null +++ b/user/dotnet6-build/runtime_82269-mono-thread-coop-undefine-fortify-source.patch @@ -0,0 +1,25 @@ +From 98054ea87ce70247bb09ceafd2ad1a0b36d2fef4 Mon Sep 17 00:00:00 2001 +Patch-Source: https://github.com/dotnet/runtime/issues/82269 +From: Antoine Martin +Date: Sat, 1 Oct 2022 09:21:58 -0400 +Subject: [PATCH] Undefine fortify-source on mono-thread-coop + +When _FORTIFY_SOURCE=2, there is a bug relating to memcpy that expresses itself. +which makes mono-flavored runtime dump its core. This patch offers a workaround +by undefining _FORTIFY_SOURCE in the problematic file. + +See: https://github.com/dotnet/runtime/issues/82269 + +--- +diff --git a/src/runtime/src/mono/mono/utils/mono-threads-coop.c b/src/runtime/src/mono/mono/utils/mono-threads-coop.c +index 4ed659d6605..34bb5785fba 100644 +--- a/src/runtime/src/mono/mono/utils/mono-threads-coop.c ++++ b/src/runtime/src/mono/mono/utils/mono-threads-coop.c +@@ -15,6 +15,7 @@ + #ifdef TARGET_MACH + #define _DARWIN_C_SOURCE + #endif ++#undef _FORTIFY_SOURCE + + #include + #include diff --git a/user/dotnet6-build/runtime_enable-system-libunwind.diff b/user/dotnet6-build/runtime_enable-system-libunwind.diff new file mode 100644 index 0000000..45358a0 --- /dev/null +++ b/user/dotnet6-build/runtime_enable-system-libunwind.diff @@ -0,0 +1,22 @@ +From 75c3e74ea35219f257c80daf9a236e0f518a7875 Mon Sep 17 00:00:00 2001 +Patch-Source: https://github.com/dotnet/installer/pull/13378 +From: Antoine Martin +Date: Wed, 9 Mar 2022 20:16:03 +0000 +Subject: [PATCH 1/1] Enable system libunwind + +Forces use of system's libunwind + +--- + +diff --git a/src/runtime/eng/SourceBuild.props b/src/runtime/eng/SourceBuild.props +index f595e9b7d1..d90fd47dbd 100644 +--- a/src/runtime/eng/SourceBuild.props ++++ b/src/runtime/eng/SourceBuild.props +@@ -47,6 +47,7 @@ + $(InnerBuildArgs) /p:BuildDebPackage=false + $(InnerBuildArgs) /p:RuntimeOS=$(RuntimeOS) + $(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseOS) ++ $(InnerBuildArgs) --cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE + + + diff --git a/user/dotnet6-build/runtime_lld-fix.patch b/user/dotnet6-build/runtime_lld-fix.patch new file mode 100644 index 0000000..57a7050 --- /dev/null +++ b/user/dotnet6-build/runtime_lld-fix.patch @@ -0,0 +1,31 @@ +From 91988b0241a77f1f6524c19e2ce55dda06de7242 Mon Sep 17 00:00:00 2001 +Patch-Source: https://src.fedoraproject.org/rpms/dotnet6.0/blob/src/runtime/rawhide/f/runtime-arm64-lld-fix.patch +From: Omair Majid +Date: Wed, 16 Feb 2022 18:08:22 +0000 +Subject: [PATCH 1/1] arm64 lld fix + +--- + eng/native/init-compiler.sh | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/src/runtime/eng/native/init-compiler.sh b/src/runtime/eng/native/init-compiler.sh +index 567d18da474..05245c7b9f8 100755 +--- a/src/runtime/eng/native/init-compiler.sh ++++ b/src/runtime/eng/native/init-compiler.sh +@@ -108,11 +108,8 @@ if [[ -z "$CC" ]]; then + fi + + if [[ "$compiler" == "clang" ]]; then +- if command -v "lld$desired_version" > /dev/null; then +- # Only lld version >= 9 can be considered stable +- if [[ "$majorVersion" -ge 9 ]]; then +- LDFLAGS="-fuse-ld=lld" +- fi ++ if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then ++ LDFLAGS="-fuse-ld=lld" + fi + fi + +-- +2.34.1 + diff --git a/user/dotnet6-build/sdk_14239-add-zsh-compdef-completion-script.patch b/user/dotnet6-build/sdk_14239-add-zsh-compdef-completion-script.patch new file mode 100644 index 0000000..bdb120b --- /dev/null +++ b/user/dotnet6-build/sdk_14239-add-zsh-compdef-completion-script.patch @@ -0,0 +1,35 @@ +From 4c74721e1f5da9642adab03075dda2f55719ac7b Mon Sep 17 00:00:00 2001 +Patch-Source: https://github.com/dotnet/sdk/pull/14239 +From: Esgariot +Date: Mon, 19 Oct 2020 23:42:37 +0200 +Subject: [PATCH 1/1] Add zsh compdef completion script. + +Continuing off of PR 13384 in upstream. +This commit is ready to be rebased to include appropriate co-authors +before merging PR. + +--- + scripts/register-completions.zsh | 13 +++---------- + 1 file changed, 3 insertions(+), 10 deletions(-) + +diff --git a/src/sdk/scripts/register-completions.zsh b/src/sdk/scripts/register-completions.zsh +index 8eebe9a867..faa32fef71 100644 +--- a/src/sdk/scripts/register-completions.zsh ++++ b/src/sdk/scripts/register-completions.zsh +@@ -1,10 +1,3 @@ +-# zsh parameter completion for the dotnet CLI +- +-_dotnet_zsh_complete() +-{ +- local completions=("$(dotnet complete "$words")") +- +- reply=( "${(ps:\n:)completions}" ) +-} +- +-compctl -K _dotnet_zsh_complete dotnet ++#compdef dotnet ++local completions=("$(dotnet complete "$words")") ++[[ -n "$completions" ]] && compadd -- "${(ps:\n:)completions}" +-- +2.34.1 + diff --git a/user/dotnet6-build/sdk_telemetry-optout.patch b/user/dotnet6-build/sdk_telemetry-optout.patch new file mode 100644 index 0000000..435a57f --- /dev/null +++ b/user/dotnet6-build/sdk_telemetry-optout.patch @@ -0,0 +1,32 @@ +From eb7141ec561b9a2551d16ee661343b87c5e5f1b1 Mon Sep 17 00:00:00 2001 +From: Antoine Martin +Date: Sun, 23 Jan 2022 15:47:27 +0000 +Subject: [PATCH 1/1] SDK telemetry optout + +Disables telemetry by default. + +--- + src/Cli/dotnet/Program.cs | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/sdk/src/Cli/dotnet/Program.cs b/src/sdk/src/Cli/dotnet/Program.cs +index c3be733b4a..2a157a75d5 100644 +--- a/src/sdk/src/Cli/dotnet/Program.cs ++++ b/src/sdk/src/Cli/dotnet/Program.cs +@@ -27,6 +27,13 @@ public class Program + + public static int Main(string[] args) + { ++ // opt out of telemetry by default if the env var is unset ++ string telemetryValue = Environment.GetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT"); ++ if (String.IsNullOrEmpty(telemetryValue)) ++ { ++ Environment.SetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1"); ++ } ++ + DebugHelper.HandleDebugSwitch(ref args); + + // Capture the current timestamp to calculate the host overhead. +-- +2.35.1 +