From f3ee4b7bc74e72da092b658f537e0cfc64c4aa26 Mon Sep 17 00:00:00 2001 From: "build@apk-groulx" Date: Sat, 4 Dec 2021 22:26:49 +0000 Subject: [PATCH] [main/dotnet-3.1] Updated to 3.1.20 --- apk/v3.15/main/dotnet-3.1/APKBUILD | 137 +++++++++++------- ...up_rid-plat-generation-on-alpine-fix.patch | 32 ++++ ...lr_non-portable-distrorid-fix-alpine.patch | 41 ++++++ .../corefx_added-alpine-315-rid.patch | 125 ++++++++++++++++ ...g-on-alpine-with-core-setup-rid-patc.patch | 26 ++++ 5 files changed, 307 insertions(+), 54 deletions(-) create mode 100644 apk/v3.15/main/dotnet-3.1/core-setup_rid-plat-generation-on-alpine-fix.patch create mode 100644 apk/v3.15/main/dotnet-3.1/coreclr_non-portable-distrorid-fix-alpine.patch create mode 100644 apk/v3.15/main/dotnet-3.1/corefx_added-alpine-315-rid.patch create mode 100644 apk/v3.15/main/dotnet-3.1/installer_hack-for-building-on-alpine-with-core-setup-rid-patc.patch diff --git a/apk/v3.15/main/dotnet-3.1/APKBUILD b/apk/v3.15/main/dotnet-3.1/APKBUILD index 5b436b9..190dd12 100644 --- a/apk/v3.15/main/dotnet-3.1/APKBUILD +++ b/apk/v3.15/main/dotnet-3.1/APKBUILD @@ -10,14 +10,18 @@ _bootstrap=true _bootstrap_sdk='3.1.115' _bootstrap_runtime='3.1.1' -_targetrid=linux-musl-x64 -_coreclrbld=21304.2 -_coreclrver=3.1.17-servicing _llvmver=12 +# Certain check and balances are mitigated when doing a portable build, thus making targetRID linux-musl-x64. TBD if we really want this. Maybe newer version are less capricious. +_targetrid=linux-musl-x64 + +# Part of the core-setup mitigation detailed below +_coreclrbld=21470.3 +_coreclrver=3.1.20-servicing + pkgname=dotnet-3.1 pkgdesc='The .NET Core SDK' -pkgver=3.1.17 +pkgver=3.1.20 pkgrel=0 arch='x86_64' url=https://www.microsoft.com/net/core @@ -51,16 +55,7 @@ if [ ${_bootstrap} != 'true' ]; then " fi -#depends=' -# icu-libs -# krb5-libs -# libgcc -# #libgdiplus -# libintl -# libssl1.1 -# libstdc++zlib -# -subpackages="dotnet-sdk-3.1:sdk dotnet-host-3.1:host dotnet-runtime-3.1:runtime aspnet-runtime-3.1:aspnet_runtime:noarch dotnet-targeting-pack-3.1:targeting_pack aspnet-targeting-pack-3.1:aspnet_targeting_pack:noarch" +subpackages="dotnet-sdk-3.1:sdk dotnet-host:host dotnet-runtime-3.1:runtime aspnet-runtime-3.1:aspnet_runtime:noarch dotnet-targeting-pack-3.1:targeting_pack aspnet-targeting-pack-3.1:aspnet_targeting_pack:noarch" _gittag=v${pkgver}-runtime _giturl=https://github.com/dotnet/source-build options="!check !archcheck" @@ -68,23 +63,73 @@ source=" $pkgname-$pkgver.git.zip dotnet.sh " +# +# Patches description +# +# coreclr_fix-build-on-Alpine-edge-45352.patch +# Fixes a build error for Alpine Linux. It has since been fixed in dotnet-5.0, see issue dotnet/runtime 45352. +# +# corefx_fix-build-clang10.patch +# Fixes a build error for clang 10 +# +# xliff-tasks_use_netcoreapp21.patch +# For some god awful reason, xliff looks for netcoreapp2.0 when building, when netcoreapp2.1 is provided. This patch gives it the correct path. +# +# coresetup_rid-plat-generation-on-alpine-fix.patch +# build.sh for corehost on coresetup seems to generate the wrong rid on alpine. Rather than building corehost for the expected alpine.3.xx-x64 platform, +# it compiles to linux-musl-x64. This patch adjusts the computed RID to match what's expected, implementing the rest of coreclr_non-portable-distrorid-fix-alpine.patch +# +# coreclr_non-portable-distrorid-fix-alpine.patch +# coreclr's DistroRid generation seems broken on alpine by leaving a trailing version ID. Thus, the distroRid for alpine 3.15 comes out as alpine-3.15.0-x64 instead of +# the expected alpine-3.15-x64. This patch fixes this by bring alpine's Rid generation under RHEL's algorithm. +# +# installer_hack-for-building-on-alpine-with-core-setup-rid-patc.patch +# Hack that adjusts where dotnet-runtime-3.1.20-alpine.3.15-x64.tar.gz is expected. +# Expectation: artifacts/obj/x64/Release/blobs/Runtime/3.1.20 +# Actual: artifacts/obj/x64/Release/blobs/Runtime/3.1.20-alpine.3.15 +# This is likely caused by core-setup_rid-plat-generation-on-alpine-fix.patch as part of the build system +# expected musl-linux-x64 while another part expects alpine-3.15-x64. +# What's weird is that, at worst, the blobs should be sent to 3.1.20-alpine.3.15-x64. +# Why ommit arch? Probably is worth another patch in core-setup +# +# applications-insights_fix-net40-location.patch +# Because Linux is sane, paths are case sensitive. Applications insights looks for Utils.cs in net40 while the repo has it in Net40. Patch makes it all okay. +# +# build_applicationinsights-alternative-source.patch +# Another act of the spaguetti monster: there is a difference between the official ApplicationInsights-dotnet repo and unofficial "original" versions for commit 53b8094 which breaks certain paths (again) +# This patch changes the repo URL to an "original" version that I host on github.com, which I forked from SergeyRazmyslov, who forked it originally from ApplicationInsights-dotnet before (presumably) +# Microsoft did a forced push. Not entirely sure what's up here. +# +# build_coreclr-tools-path.patch +# Coreclr looks for its ilasm and ildasm tools in the wrong path. +# Patch makes it all okay by adjusting the paths accordingly +# Ideal solution is to provide ilasm and ildasm in a seperate package. +# +# build_darc-fix-alpine.patch +# Darc has a segmentation fault on Alpine due to not chosing the correct binary architecture. +# This patch deletes all the wrong ones so that it is forced to chose the correct one. +# See dotnet/source-build issue #1868, and dotnet/source-build issue #297 (which would also fix all the other RID issues. +# -# patches source=" ${source} coreclr_fix-build-on-Alpine-edge-45352.patch + coreclr_non-portable-distrorid-fix-alpine.patch + core-setup_rid-plat-generation-on-alpine-fix.patch + installer_hack-for-building-on-alpine-with-core-setup-rid-patc.patch corefx_fix-build-clang10.patch - xliff-tasks_use-netcoreapp21.patch - applications-insights_fix-net40-location.patch - build_applicationinsights-alternative-source.patch - build_coreclr-tools-path.patch + corefx_added-alpine-315-rid.patch build_darc-fix-alpine.patch " -# core-setup_attempt-fix-transport-runtime.patch builddir="$srcdir/$pkgname" +# +# A custom version of snapshot is used because Darc expects the build directory to be a git repo, thus the auto-generated tar.gz on github is not sufficient. +# There's a way to trick Darc into thinking its in a git repo but it's hardly elegant. Thus make sure to 'abuild snapshot' before 'abuild -r' +# + snapshot() { mkdir -p "$srcdir" cd "${srcdir}" @@ -128,30 +173,6 @@ prepare() { # disable warnings sed -i 's|skiptests|skiptests ignorewarnings|' repos/coreclr.common.props - # TODO: core-setup src/pkg/packaging-tools/framework.dependency.targets ignored trailing version number for MicrosoftNETCoreRuntimeCoreCLRPackageVersion set by - # artifacts/obj/x64/Release/PackageVersions.props thus can't find transport.runtime.linux-x64.Microsoft.NETCore.Jit and transport.runtime.linux-x64.microsoft.netcore.runtime.coreclr - # - # Ideal solution: Make sure transport.runtime.$_targetrid.microsoft.netcore.runtime.coreclr is restored w/o buildid (like it is expected) - # No data - # - # Possible mitigation: Adjust PackageVersions.props to include build id - # Need to find where PackageVersions.props gets it versions. Probable artifacts/sources/coreclr/eng/Versions.props - # - # Possible hack: ln expected path to actual path (implemented) - # See below - # - for i in runtime.coreclr jit; do - [ -d "packages/restored/transport.runtime.$_targetrid.microsoft.netcore.$i" ] || mkdir -p "packages/restored/transport.runtime.$_targetrid.microsoft.netcore.$i" - ln -s ../transport.runtime.linux-musl-x64.microsoft.netcore.${i}/$_coreclrver.$_coreclrbld packages/restored/transport.runtime.$_targetrid.microsoft.netcore.$i/$_coreclrver - done - # - - # TODO: Figure out the whole ilasm / ildasm business. For now: - for i in ildasm ilasm; do - [ -f "Tools/source-built/coreclr-tools/x64/$i" ] || { mkdir -p "Tools/source-built/coreclr-tools/x64"; ln -s ../${i} Tools/source-built/coreclr-tools/x64/${i}; } - done - # - export SOURCE_BUILD_SKIP_SUBMODULE_CHECK=1 if ! have_patches; then @@ -198,12 +219,20 @@ build() { export SOURCE_BUILD_SKIP_SUBMODULE_CHECK=1 + # + # Notes + # + # Very important that --with-sdk stays at ../$pkgname. For some reason *anything else* makes "Building 'sdk' to produce tarball" step stalls after creating Microsoft.NET.Sdk nupkg. + # To be investigated further why this is so finicky. If all else fails, remove that line and make sure _bootstrap=true. + # + # Rid generation for alpine on dotnet-3.1 tend to be finicky. For simplicity's sake (and my sanity), TargetRid is set to linux-musl-x64. + # + ./build.sh \ --with-sdk ../$pkgname \ /p:ArchiveDownloadedPackages=true \ /p:ContinueOnPrebuiltBaselineError=true \ /p:SkipPortableRuntimeBuild=true \ - /p:TargetRid=$_targetrid \ /p:SkipPrebuiltEnforcement=true \ /p:UseSystemLibraries=true \ /p:UseSystemLibunwind=true @@ -212,12 +241,12 @@ build() { package() { depends=' dotnet-sdk-3.1 - dotnet-host-3.1 + dotnet-host dotnet-runtime-3.1 dotnet-targetting-pack-3.1 aspnet-runtime-3.1 aspnet-targeting-pack-3.1 - netstandard-targeting-pack-5.0 + netstandard-targeting-pack ' mkdir -p "${pkgdir}" } @@ -228,7 +257,7 @@ sdk() { dotnet-targeting-pack-3.1 musl libgcc - netstandard-targeting-pack-5.0 + netstandard-targeting-pack aspnet-targeting-pack-3.1 ' @@ -310,7 +339,7 @@ aspnet_runtime() { targeting_pack() { pkgdesc='The .NET Core targeting pack' - depends='netstandard-targeting-pack-5.0' + depends='netstandard-targeting-pack' cd "$builddir"/artifacts/x64/Release @@ -332,13 +361,13 @@ aspnet_targeting_pack() { # vim: ts=2 sw=2 et: sha512sums=" -e2e7059a30152757087c7dbdb0307a2f3762033dc154bbdda24161646c840b321b1e845489f8bee6b4d7984e0b072248b2ec4862174a2f0d8bc82c8aabdeeb09 dotnet-3.1-3.1.17.git.zip +9e5e2bccb4338a18996e53e80c45525b3ba332d11cd896d1ba72bd8406735281aae7b98f614212a99475621000ca3fa5daf2d639953b163196aa2884c8773f2e dotnet-3.1-3.1.20.git.zip e61b9e3e5a2305646a616d598378230c9755c5dd5363692cc363f8f4add3807563c324dd86f3a7ae9d358c82d730608e7b293935a2b6c81c0c0f62d752a0a1cf dotnet.sh b3475c0b727c5258c7bc6f4c53305f9ced991e57f9f46a2ad323bed40627662eb8bf57286bf6a22d9a22bfdea9282da4630dd094166f0805c783aece5df5dff3 coreclr_fix-build-on-Alpine-edge-45352.patch +6ac9bdbc47b24cafbb3386e21756c540313680fed6994791ff5a3c75b422742ecf102d7736ac79de6d7f1a0892464f83cbab181ed505e4d827dc7f113e3a4017 coreclr_non-portable-distrorid-fix-alpine.patch +983a81bbcef45fbcd9a44187c3e7565631c8e72fca8427958b23097e7b291148e6f8656fe5619b7f5270311f47379498aaaa82919845bac96d02c764f95ac1f5 core-setup_rid-plat-generation-on-alpine-fix.patch +ccdfd8e4e726bf626e7d922ecb79de70d2852875b6f1c66c5d72d9605aac5701e3ab45e546b8d266cc6b83ce3a88bf5d79e1675a06a7b41dc7cdce7e4cb79c71 installer_hack-for-building-on-alpine-with-core-setup-rid-patc.patch eb107ae9765d9eebe2f2ab4cebda4d3f76d683e21d88f806bb008e29051ad196ea637d410075b7ed61f4997a22085e4c36021860b82c4c0822c23ba9ded9656a corefx_fix-build-clang10.patch -8cdde0fee68e867aa859facfbb809099a317b371593e55f6c20a53c976b48b18a39a3c527ab13d534f6d7505813fdc47ebdf507c1e05c4dcd26c58c9f9e5cad1 xliff-tasks_use-netcoreapp21.patch -0469d571d0f7634d3794761f04e1cbff9d27d642d134a11a13560574280e5cab6f366eb8820e61a449eca99470fdea8d9f6a7d97b633059b2fe25257ed1579e6 applications-insights_fix-net40-location.patch -58a3e93e5fb6247569c291f86db127cbbc6cc6842eaf0973c2a211d4806f08dcabd9781b7da567088d820a337d58d6375230ade991dcc77e170266675c4a97e5 build_applicationinsights-alternative-source.patch -eda3e6453d2137d3b62635068583e7c91010cdaebf55da25f43081ecc135fae00aff41d65d99f15783ecc9087c8be4653687451e56a63ab98e09df0bec2b3b5c build_coreclr-tools-path.patch +72092a7323bb91e8d011ad09cefcc3fd0e4ebfc7c258895d454cc1d015eda36c7de97b09af76a492fa689f39b9216435faace77edd0ca75d8e39a34ed6641840 corefx_added-alpine-315-rid.patch 74767c34f15e0eaee3682516e093296621efaeeb6d84e62d826587db9b559fb7c00c42aafbf4fdfd34460d1cf16edad3fd5f720f2b37f8bf52b26d7f73f79d5e build_darc-fix-alpine.patch " diff --git a/apk/v3.15/main/dotnet-3.1/core-setup_rid-plat-generation-on-alpine-fix.patch b/apk/v3.15/main/dotnet-3.1/core-setup_rid-plat-generation-on-alpine-fix.patch new file mode 100644 index 0000000..afbed67 --- /dev/null +++ b/apk/v3.15/main/dotnet-3.1/core-setup_rid-plat-generation-on-alpine-fix.patch @@ -0,0 +1,32 @@ +From c65a25ff18fa16dd0f134897b93919eab6a57bb9 Mon Sep 17 00:00:00 2001 +From: "build@apk-groulx" +Date: Sat, 4 Dec 2021 06:12:30 +0000 +Subject: [PATCH 1/1] Fixed __rid_plat generation on alpine for core-setup + +--- + src/corehost/build.sh | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/src/corehost/build.sh b/src/corehost/build.sh +index fb503e74..854b7f8a 100755 +--- a/src/corehost/build.sh ++++ b/src/corehost/build.sh +@@ -21,14 +21,11 @@ init_rid_plat() + __rid_plat="" + if [ -e /etc/os-release ]; then + source /etc/os-release +- if [[ "$ID" == "rhel" ]]; then ++ if [ "$ID" == "rhel" ] || [ "$ID" == "alpine" ] ; then + # remove the last version number + VERSION_ID=${VERSION_ID%.*} + fi + __rid_plat="$ID.$VERSION_ID" +- if [[ "$ID" == "alpine" ]]; then +- __rid_plat="linux-musl" +- fi + elif [ -e /etc/redhat-release ]; then + local redhatRelease=$( +Date: Sat, 4 Dec 2021 05:03:48 +0000 +Subject: [PATCH 1/1] Fix non-portable distrorid alpine generation + +--- + init-distro-rid.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/init-distro-rid.sh b/init-distro-rid.sh +index 49d8981c4f..7cec3cf649 100755 +--- a/init-distro-rid.sh ++++ b/init-distro-rid.sh +@@ -51,7 +51,7 @@ initNonPortableDistroRid() + # We have forced __PortableBuild=0. This is because -portablebuld + # has been passed as false. + if (( ${isPortable} == 0 )); then +- if [ "${ID}" == "rhel" ]; then ++ if [ "${ID}" == "rhel" ] || [ "${ID}" = "alpine" ]; then + # remove the last version digit + VERSION_ID=${VERSION_ID%.*} + fi +@@ -73,7 +73,7 @@ initNonPortableDistroRid() + fi + elif [ -e "${rootfsDir}/android_platform" ]; then + source $rootfsDir/android_platform +- nonPortableBuildID="$RID" ++ HE nonPortableBuildID="$RID" + fi + fi + +@@ -185,4 +185,4 @@ initDistroRidGlobal() + + export __RuntimeId=${__DistroRid} + fi +-} +\ No newline at end of file ++} +-- +2.34.0 + diff --git a/apk/v3.15/main/dotnet-3.1/corefx_added-alpine-315-rid.patch b/apk/v3.15/main/dotnet-3.1/corefx_added-alpine-315-rid.patch new file mode 100644 index 0000000..dbbfe20 --- /dev/null +++ b/apk/v3.15/main/dotnet-3.1/corefx_added-alpine-315-rid.patch @@ -0,0 +1,125 @@ +From 4243324d64dda9fbcaa76c37cf1e5090205d0320 Mon Sep 17 00:00:00 2001 +From: "build@apk-groulx" +Date: Sat, 4 Dec 2021 04:59:26 +0000 +Subject: [PATCH 1/1] Added Alpine 3.15 rid + +--- + .../runtime.compatibility.json | 53 ++++++++++++++++++- + pkg/Microsoft.NETCore.Platforms/runtime.json | 13 ++++- + .../runtimeGroups.props | 2 +- + 3 files changed, 65 insertions(+), 3 deletions(-) + +diff --git a/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json b/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json +index f34e8dbb82..6b0678be9f 100644 +--- a/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json ++++ b/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json +@@ -224,6 +224,57 @@ + "any", + "base" + ], ++ "alpine.3.15": [ ++ "alpine.3.15", ++ "alpine.3.14", ++ "alpine.3.13", ++ "alpine.3.12", ++ "alpine.3.11", ++ "alpine.3.10", ++ "alpine.3.9", ++ "alpine.3.8", ++ "alpine.3.7", ++ "alpine.3.6", ++ "alpine", ++ "linux-musl", ++ "linux", ++ "unix", ++ "any", ++ "base" ++ ], ++ "alpine.3.15-x64": [ ++ "alpine.3.15-x64", ++ "alpine.3.15", ++ "alpine.3.14-x64", ++ "alpine.3.14", ++ "alpine.3.13-x64", ++ "alpine.3.13", ++ "alpine.3.12-x64", ++ "alpine.3.12", ++ "alpine.3.11-x64", ++ "alpine.3.11", ++ "alpine.3.10-x64", ++ "alpine.3.10", ++ "alpine.3.9-x64", ++ "alpine.3.9", ++ "alpine.3.8-x64", ++ "alpine.3.8", ++ "alpine.3.7-x64", ++ "alpine.3.7", ++ "alpine.3.6-x64", ++ "alpine.3.6", ++ "alpine-x64", ++ "alpine", ++ "linux-musl-x64", ++ "linux-musl", ++ "linux-x64", ++ "linux", ++ "unix-x64", ++ "unix", ++ "any", ++ "base" ++ ], ++ + "alpine.3.6": [ + "alpine.3.6", + "alpine", +@@ -5372,4 +5423,4 @@ + "any", + "base" + ] +-} +\ No newline at end of file ++} +diff --git a/pkg/Microsoft.NETCore.Platforms/runtime.json b/pkg/Microsoft.NETCore.Platforms/runtime.json +index 20082ac80f..20485cce4d 100644 +--- a/pkg/Microsoft.NETCore.Platforms/runtime.json ++++ b/pkg/Microsoft.NETCore.Platforms/runtime.json +@@ -66,6 +66,17 @@ + "alpine.3.13-x64" + ] + }, ++ "alpine.3.15": { ++ "#import": [ ++ "alpine.3.14" ++ ] ++ }, ++ "alpine.3.15-x64": { ++ "#import": [ ++ "alpine.3.15", ++ "alpine.3.14-x64" ++ ] ++ }, + "alpine.3.6": { + "#import": [ + "alpine" +@@ -2453,4 +2464,4 @@ + ] + } + } +-} +\ No newline at end of file ++} +diff --git a/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props b/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props +index 3434ed138a..c466a38915 100644 +--- a/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props ++++ b/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props +@@ -16,7 +16,7 @@ + + linux-musl + x64 +- 3.6;3.7;3.8;3.9;3.10;3.11;3.12;3.13;3.14 ++ 3.6;3.7;3.8;3.9;3.10;3.11;3.12;3.13;3.14;3.15 + + + +-- +2.34.0 + diff --git a/apk/v3.15/main/dotnet-3.1/installer_hack-for-building-on-alpine-with-core-setup-rid-patc.patch b/apk/v3.15/main/dotnet-3.1/installer_hack-for-building-on-alpine-with-core-setup-rid-patc.patch new file mode 100644 index 0000000..7678e43 --- /dev/null +++ b/apk/v3.15/main/dotnet-3.1/installer_hack-for-building-on-alpine-with-core-setup-rid-patc.patch @@ -0,0 +1,26 @@ +From 4f60524a67ef11744dfcf5b5a9bd098938b0ca3b Mon Sep 17 00:00:00 2001 +From: "build@apk-groulx" +Date: Sat, 4 Dec 2021 20:18:40 +0000 +Subject: [PATCH 1/1] Hack for building on alpine with core-setup rid patch + +--- + src/redist/targets/GenerateLayout.targets | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/redist/targets/GenerateLayout.targets b/src/redist/targets/GenerateLayout.targets +index 42277cf98..ae9ade23c 100644 +--- a/src/redist/targets/GenerateLayout.targets ++++ b/src/redist/targets/GenerateLayout.targets +@@ -12,7 +12,8 @@ + + + $(MicrosoftAspNetCoreDeveloperCertificatesXPlatPackageVersion) +- $(MicrosoftNETCoreAppInternalPackageVersion) ++ alpine.3.15 ++ $(MicrosoftNETCoreAppRuntimePackageVersion)-$(CoreSetupBlobRid) + + + 3.1.0-rtm.19565.2 +-- +2.34.0 +