new project

This commit is contained in:
slava86 2022-07-05 09:42:07 +03:00
parent f333c449c1
commit 6d1d8ed1e5
43 changed files with 2213 additions and 2377 deletions

View file

@ -1,4 +1,3 @@
sources:
dotnet-v3.1.112-SDK.tar.gz: e4b887e6ae07247a64ce50689605c46f50a98da1
dotnet-v3.1.118-SDK-original.tar.gz: 2f4fac048fda5cf19f04947ef7b509271db2f3db
dotnet-v3.1.118-SDK.tar.gz: 1b3240e054b9d1872aa043216755fe29c34e748a
dotnet-v6.0.106-x64-bootstrap.tar.xz: 8c726934c554821d15a759614d402db0b9afeadc
dotnet-v6.0.106.tar.gz: 8245cffa114bb13d2dd3eed9b8b48e7e1dc444c5

View file

@ -1,17 +0,0 @@
--- a/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.XPlat/PublishCoreSetupBinaries.cs 2021-08-31 16:02:07.573333299 +0300
+++ b/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.XPlat/PublishCoreSetupBinaries.cs 2021-08-31 16:07:21.936666632 +0300
@@ -49,6 +49,14 @@
{
version = version.Substring(0, version.Length - "-osx".Length);
}
+ if (version.Contains("-rosa.2021.1"))
+ {
+ version = version.Substring(0, version.IndexOf("-rosa.2021.1"));
+ }
+ if (version.Contains("-rosa.2019.05"))
+ {
+ version = version.Substring(0, version.IndexOf("-rosa.2019.05"));
+ }
if (version.Contains("-ubuntu"))
{
version = version.Substring(0, version.IndexOf("-ubuntu"));

View file

@ -1,47 +0,0 @@
diff --git a/sdk/3.1.118/RuntimeIdentifierGraph.json b/sdk/3.1.118/RuntimeIdentifierGraph.json-diff
index 627a6a3..f834806 100644
--- a/sdk/3.1.118/RuntimeIdentifierGraph.json
+++ b/sdk/3.1.118/RuntimeIdentifierGraph.json-diff
@@ -1,5 +1,35 @@
{
"runtimes": {
+ "rosa.2021.1": {
+ "#import": [
+ "linux"
+ ]
+ },
+ "rosa.2021.1-arm64": {
+ "#import": [
+ "linux-arm64"
+ ]
+ },
+ "rosa.2021.1-x64": {
+ "#import": [
+ "linux-x64"
+ ]
+ },
+ "rosa.2019.05": {
+ "#import": [
+ "linux"
+ ]
+ },
+ "rosa.2019.05-arm64": {
+ "#import": [
+ "linux-arm64"
+ ]
+ },
+ "rosa.2019.05-x64": {
+ "#import": [
+ "linux-x64"
+ ]
+ },
"alpine": {
"#import": [
"linux-musl"
@@ -2368,4 +2398,4 @@
]
}
}
-}
\ No newline at end of file
+}

36
arcade-no-apphost.patch Normal file
View file

@ -0,0 +1,36 @@
Index: a/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj
===================================================================
--- a/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj
+++ b/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj
@@ -5,6 +5,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
Index: a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj
===================================================================
--- a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj
+++ b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj
@@ -9,6 +9,7 @@
<ToolCommandName>dotnet-swaggergen</ToolCommandName>
<SignAssembly>false</SignAssembly>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
Index: a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj
===================================================================
--- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj
+++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj
@@ -11,6 +11,7 @@
<VersionPrefix>2.5.1</VersionPrefix>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<RollForward>Major</RollForward>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>

43
build-arm64-bootstrap-tarball Executable file
View file

@ -0,0 +1,43 @@
#!/bin/bash
set -euo pipefail
set -x
bootstrap_dir=$(readlink -f "$1")
version=$(jq -r '.tools.dotnet' "$bootstrap_dir"/global.json)
date=$(date +%F)
mkdir -p "dotnet-arm64-prebuilts-$date"
pushd "dotnet-arm64-prebuilts-$date"
# Getting the exact matching rc2 version gets us an arm64 build without this
# fix https://github.com/dotnet/runtime/pull/58959. That causes a segfault on
# startup.
# wget "https://dotnetcli.azureedge.net/dotnet/Sdk/$version/dotnet-sdk-$version-linux-arm64.tar.gz"
wget https://aka.ms/dotnet/6.0.1XX-rc2/daily/dotnet-sdk-linux-arm64.tar.gz
mapfile -t linux_x64_packages < <(tar tf "$bootstrap_dir"/packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz | grep linux-x64)
for package in "${linux_x64_packages[@]}"; do
if [[ "$package" = *'.Intermediate.'* ]]; then
continue;
fi
filename=${package##*/}
name=${filename%.6.0*}
arm_name=${name/linux-x64/linux-arm64}
version="6.0${filename##*6.0}"
version=${version%.*}
nappo download --verbose "$arm_name" "$version"
done
popd
tar czf "dotnet-arm64-prebuilts-$date.tar.gz" "dotnet-arm64-prebuilts-$date"

View file

@ -1,50 +0,0 @@
#!/bin/bash
set -euo pipefail
set -x
sdk_version=3.1.105
arch=$(uname -m)
if [[ $arch == "x86_64" ]]; then
arch=x64
elif [[ $arch == "aarch64" ]]; then
arch=arm64
fi
if rpm -qa | grep libunwind; then
echo "error: libunwind is installed. Not a good idea for bootstrapping."
exit 1
fi
if rpm -qa | grep dotnet ; then
echo "error: dotnet is installed. Not a good idea for bootstrapping."
exit 1
fi
if [ -d /usr/lib/dotnet ] || [ -d /usr/lib64/dotnet ] || [ -d /usr/share/dotnet ] ; then
echo "error: one of /usr/lib/dotnet /usr/lib64/dotnet or /usr/share/dotnet/ exists. Not a good idea for bootstrapping."
exit 1
fi
if command -v dotnet ; then
echo "error: dotnet is in $PATH. Not a good idea for bootstrapping."
exit 1
fi
if [ ! -d dotnet-source-build-tarball ]; then
if [ ! -d source-build ]; then
git clone https://github.com/dotnet/source-build
fi
pushd source-build
sed -i -e 's|cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE||' repos/coreclr.common.props
git clean -xdf
./build-source-tarball.sh ../dotnet-source-build-tarball/ -- -p:DownloadSourceBuildReferencePackagesTimeoutSeconds=100000
popd
fi
rm -rf dotnet-v${sdk_version}-SDK dotnet-v${sdk_version}-SDK.tar.gz
cp -a dotnet-source-build-tarball dotnet-v${sdk_version}-SDK
cp -a source-build/artifacts/$arch/Release/Private.SourceBuilt.Artifacts.*.tar.gz dotnet-v${sdk_version}-SDK/packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz
tar czf dotnet-v${sdk_version}-SDK-$arch.tar.gz dotnet-v${sdk_version}-SDK

View file

@ -1,12 +0,0 @@
diff --git a/configurecompiler.cmake b/configurecompiler.cmake
index d769e82f57..4936c8b00d 100644
--- a/configurecompiler.cmake
+++ b/configurecompiler.cmake
@@ -474,6 +474,7 @@ if (CLR_CMAKE_PLATFORM_UNIX)
add_compile_options(-Wno-unused-variable)
add_compile_options(-Wno-unused-value)
add_compile_options(-Wno-unused-function)
+ add_compile_options(-Wno-error=misleading-indentation)
#These seem to indicate real issues
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-invalid-offsetof>)

View file

@ -1,11 +1,11 @@
#!/bin/bash
# Usage:
# build-dotnet-tarball <tag-from-source-build>
# build-dotnet-tarball [--bootstrap] <tag-from-installer>
#
# Creates a source archive from a tag (or commit) at github.com/dotnet/source-build
# Creates a source archive from a tag (or commit) at github.com/dotnet/installer
# Source-build is a little strange, we need to clone it, check out the
# installer is a little strange, we need to clone it, check out the
# tag, build it and then create a tarball from the archive directory
# it creates. Also, it is likely that the source archive is only
# buildable on the OS it was initially created in.
@ -13,32 +13,37 @@
set -euo pipefail
IFS=$'\n\t'
print_usage() {
function print_usage {
echo "Usage:"
echo "$0 <tag-from-source-build>"
echo "$0 [--bootstrap] <tag-from-installer>"
echo
echo "Creates a source archive from a tag at https://github.com/dotnet/source-build"
echo "Creates a source archive from a tag at https://github.com/dotnet/installer"
echo ""
echo " --bootstrap build a source tarball usable for bootstrapping .NET"
}
clean_dotnet_cache() {
function clean_dotnet_cache {
rm -rf ~/.aspnet ~/.dotnet/ ~/.nuget/ ~/.local/share/NuGet ~/.templateengine
rm -rf /tmp/NuGet /tmp/NuGetScratch /tmp/.NETCore* /tmp/.NETStandard* /tmp/.dotnet /tmp/dotnet.* /tmp/clr-debug-pipe* /tmp/Razor-Server /tmp/CoreFxPipe* /tmp/VBCSCompiler /tmp/.NETFramework*
}
function check_bootstrap_environment {
if rpm -qa | grep dotnet ; then
echo "error: dotnet is installed. Not a good idea for bootstrapping."
exit 1
fi
if [ -d /usr/lib/dotnet ] || [ -d /usr/lib64/dotnet ] || [ -d /usr/share/dotnet ] ; then
echo "error: one of /usr/lib/dotnet /usr/lib64/dotnet or /usr/share/dotnet/ exists. Not a good idea for bootstrapping."
exit 1
fi
if command -v dotnet ; then
echo "error: dotnet is in $PATH. Not a good idea for bootstrapping."
exit 1
fi
}
function runtime_id {
declare -A archmap
archmap=(
["aarch64"]="arm64"
["amd64"]="x64"
["armv8l"]="arm"
["i686"]="x86"
["i386"]="x86"
["x86_64"]="x64"
)
arch=${archmap["$(uname -m)"]}
source /etc/os-release
case "${ID}" in
# Remove the RHEL minor version
@ -50,10 +55,30 @@ function runtime_id {
echo "${ID}.${rid_version}-${arch}"
}
build_bootstrap=false
declare -A archmap
archmap=(
["aarch64"]="arm64"
["amd64"]="x64"
["armv8l"]="arm"
["i686"]="x86"
["i386"]="x86"
["x86_64"]="x64"
)
arch=${archmap["$(uname -m)"]}
positional_args=()
while [[ "$#" -gt 0 ]]; do
arg="${1}"
case "${arg}" in
--bootstrap)
check_bootstrap_environment
build_bootstrap=true
shift
;;
-h|--help)
print_usage
exit 0
@ -77,41 +102,33 @@ set -x
dir_name="dotnet-${tag}"
unmodified_tarball_name="${dir_name}-original"
tarball_name="${dir_name}"
tarball_suffix=.tar.gz
if [ -f "${tarball_name}.tar.gz" ]; then
echo "error: ${tarball_name}.tar.gz already exists"
if [[ ${build_bootstrap} == true ]]; then
unmodified_tarball_name="${unmodified_tarball_name}-${arch}-bootstrap"
tarball_name="${tarball_name}-${arch}-bootstrap"
tarball_suffix=.tar.xz
fi
if [ -f "${tarball_name}${tarball_suffix}" ]; then
echo "error: ${tarball_name}${tarball_suffix} already exists"
exit 1
fi
if [ ! -f "${unmodified_tarball_name}.tar.gz" ]; then
temp_dir=$(mktemp -d -p "$(pwd)")
pushd "${temp_dir}"
git clone https://github.com/dotnet/source-build
pushd source-build
git checkout "${tag}"
git clone https://github.com/dotnet/installer --branch "${tag}" --depth 1
pushd installer
git submodule update --init --recursive
clean_dotnet_cache
sed -i -e 's|cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE||' repos/coreclr.proj
patch -p1 < ../../RID-ROSA.patch
mkdir -p patches/cli
cp ../../dotnet-pull10652.patch patches/cli/
mkdir -p patches/coreclr/
cp ../../build-coreclr-clang10.patch patches/coreclr/
cp ../../coreclr-libunwind-fno-common.patch patches/coreclr/
mkdir -p patches/corefx/
cp ../../corefx-42900-clang-10.patch patches/corefx/
mkdir -p patches/aspnetcore/
cp ../../disable-aspnetcore-targetingpackoverride.patch patches/aspnetcore/
./build.sh \
/p:ArchiveDownloadedPackages=true \
/p:DownloadSourceBuildReferencePackagesTimeoutSeconds=100000 \
/p:DownloadSourceBuildReferencePackagesTimeoutSeconds=100000
./build-source-tarball.sh "${unmodified_tarball_name}" --skip-build
popd
mkdir -p "../${unmodified_tarball_name}"
./build.sh /p:ArcadeBuildTarball=true /p:TarballDir="$(readlink -f ../"${unmodified_tarball_name}")"
popd
tar czf "${unmodified_tarball_name}.tar.gz" -C "${temp_dir}/source-build" "${unmodified_tarball_name}"
popd
tar cf "${unmodified_tarball_name}.tar.gz" -C "${temp_dir}" "${unmodified_tarball_name}"
rm -rf "${temp_dir}"
fi
@ -121,14 +138,68 @@ tar xf "${unmodified_tarball_name}.tar.gz"
mv "${unmodified_tarball_name}" "${tarball_name}"
pushd "${tarball_name}"
Remove files with funny licenses, crypto implementations and other
not-very-useful artifacts to reduce tarball size
find -type f -iname '*.tar.gz' -delete
rm -rf .dotnet
rm -r src/aspnetcore.*/src/SignalR/clients/java/signalr/gradle*
find src/aspnetcore.*/src -type d -name samples -print0 | xargs -0 rm -r
rm -r src/NuGet.Client.*/test/EndToEnd/ProjectTemplates/NetCoreWebApplication1.0.zip
find src/coreclr.*/ -depth -name tests -print0 | xargs -0 rm -r
if [[ ${build_bootstrap} == true ]]; then
if [[ "$(wc -l < packages/archive/archiveArtifacts.txt)" != 1 ]]; then
echo "error: this is not going to work! update $0 to fix this issue."
exit 1
fi
pushd packages/archive/
curl -O $(cat archiveArtifacts.txt)
popd
mkdir foo
pushd foo
tar xf ../packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz
sed -i -E 's|<MicrosoftNETHostModelPackageVersion>6.0.0-rtm.21521.1</|<MicrosoftNETHostModelPackageVersion>6.0.0-rtm.21521.4</|' PackageVersions.props
sed -i -E 's|<MicrosoftNETHostModelVersion>6.0.0-rtm.21521.1</|<MicrosoftNETHostModelVersion>6.0.0-rtm.21521.4</|' PackageVersions.props
cat PackageVersions.props
tar czf ../packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz *
popd
rm -rf foo
./prep.sh --bootstrap
mkdir -p fixup-previously-source-built-artifacts
pushd fixup-previously-source-built-artifacts
tar xf ../packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz
find . -iname '*fedora*nupkg' -delete
# We must keep the original file names in the archive, even prepending a ./ leads to issues
tar -I 'gzip -1' -cf ../packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz *
popd
rm -rf fixup-previously-source-built-artifacts
else
find . -type f -iname '*.tar.gz' -delete
rm -rf .dotnet
fi
# Remove files with funny licenses, crypto implementations and other
# not-very-useful artifacts to reduce tarball size
# Binaries for gradle
rm -r src/aspnetcore/src/SignalR/clients/java/signalr/gradle*
# Unnecessary crypto implementation: IDEA
rm -r src/runtime/src/tests/JIT/Performance/CodeQuality/Bytemark/
# https://github.com/dotnet/aspnetcore/issues/34785
find src/aspnetcore/src -type d -name samples -print0 | xargs -0 rm -r
# https://github.com/NuGet/Home/issues/11094
rm -r src/nuget-client/test/EndToEnd
# https://github.com/Humanizr/sample-aspnetmvc/issues/1
rm -r src/source-build/src/humanizer/samples/
popd
tar czf "${tarball_name}.tar.gz" "${tarball_name}"
if [[ ${build_bootstrap} == true ]]; then
tar -I 'xz -T 0' -cf "${tarball_name}${tarball_suffix}" "${tarball_name}"
else
tar -czf "${tarball_name}${tarball_suffix}" "${tarball_name}"
fi

3
check-debug-symbols.py Normal file → Executable file
View file

@ -65,11 +65,10 @@ def scan_file(file):
def is_elf(file):
result = subprocess.run(['file', file], stdout=subprocess.PIPE, encoding='utf-8', check=True)
return re.search('ELF 64-bit LSB (?:executable|shared object)', result.stdout)
return re.search(r'ELF 64-bit [LM]SB (?:pie )?(?:executable|shared object)', result.stdout)
def scan_file_if_sensible(file):
if is_elf(file):
# print(file)
return scan_file(file)
return None

View file

@ -0,0 +1,27 @@
From 7a752928ed3588246c4b296feb6cf4946f1b29b7 Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Thu, 9 Sep 2021 12:11:39 -0400
Subject: [PATCH] [ArPow] Use --work-tree with git apply
This makes things work better in a source-tarball build, where there may
be a .git directory but it's for a different repo than command-line-api.
---
eng/SourceBuild.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props
index 6cc85018..5e223747 100644
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -15,7 +15,7 @@
</ItemGroup>
<Exec
- Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
+ Command="git --work-tree=&quot;$(RepoRoot)&quot; apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(RepoRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>
--
2.31.1

View file

@ -1,402 +0,0 @@
From 29e17d8d2ccbca07c423e3089a6d5ae8a1c9cb6e Mon Sep 17 00:00:00 2001
From: Yichao Yu <yyc1992@gmail.com>
Date: Tue, 31 Mar 2020 00:43:32 -0400
Subject: [PATCH] Fix compilation with -fno-common.
Making all other archs consistent with IA64 which should not have this problem.
Also move the FIXME to the correct place.
Also add some minimum comments about this...
---
src/aarch64/Ginit.c | 15 +++++++--------
src/arm/Ginit.c | 15 +++++++--------
src/coredump/_UPT_get_dyn_info_list_addr.c | 5 +++++
src/hppa/Ginit.c | 15 +++++++--------
src/ia64/Ginit.c | 1 +
src/mi/Gfind_dynamic_proc_info.c | 1 +
src/mips/Ginit.c | 15 +++++++--------
src/ppc32/Ginit.c | 11 +++++++----
src/ppc64/Ginit.c | 11 +++++++----
src/ptrace/_UPT_get_dyn_info_list_addr.c | 5 +++++
src/s390x/Ginit.c | 15 +++++++--------
src/sh/Ginit.c | 15 +++++++--------
src/tilegx/Ginit.c | 15 +++++++--------
src/x86/Ginit.c | 15 +++++++--------
src/x86_64/Ginit.c | 15 +++++++--------
15 files changed, 89 insertions(+), 80 deletions(-)
diff --git a/src/pal/src/libunwind/src/aarch64/Ginit.c b/src/pal/src/libunwind/src/aarch64/Ginit.c
index dec235c82..35389762f 100644
--- a/src/pal/src/libunwind/src/aarch64/Ginit.c
+++ b/src/pal/src/libunwind/src/aarch64/Ginit.c
@@ -61,13 +61,6 @@ tdep_uc_addr (unw_tdep_context_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -78,7 +71,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/arm/Ginit.c b/ssrc/pal/src/libunwind/src/arm/Ginit.c
index 2720d063a..0bac0d72d 100644
--- a/src/pal/src/libunwind/src/arm/Ginit.c
+++ b/src/pal/src/libunwind/src/arm/Ginit.c
@@ -57,18 +57,17 @@ tdep_uc_addr (unw_tdep_context_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c b/src/pal/src/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c
index 0d1190556..739ed0569 100644
--- a/src/pal/src/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c
+++ b/src/pal/src/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c
@@ -74,6 +74,11 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
#else
+/* XXX fix me: there is currently no way to locate the dyn-info list
+ by a remote unwinder. On ia64, this is done via a special
+ unwind-table entry. Perhaps something similar can be done with
+ DWARF2 unwind info. */
+
static inline int
get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
int *countp)
diff --git a/src/pal/src/libunwind/src/hppa/Ginit.c b/src/pal/src/libunwind/src/hppa/Ginit.c
index 461e4b93d..265455a68 100644
--- a/src/pal/src/libunwind/src/hppa/Ginit.c
+++ b/src/pal/src/libunwind/src/hppa/Ginit.c
@@ -64,13 +64,6 @@ _Uhppa_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -81,7 +74,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/ia64/Ginit.c b/src/pal/src/libunwind/src/ia64/Ginit.c
index b09a2ad57..8601bb3ca 100644
--- a/src/pal/src/libunwind/src/ia64/Ginit.c
+++ b/src/pal/src/libunwind/src/ia64/Ginit.c
@@ -68,6 +68,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
if (!_U_dyn_info_list_addr)
return -UNW_ENOINFO;
#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
*dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/mi/Gfind_dynamic_proc_info.c b/src/pal/src/libunwind/src/mi/Gfind_dynamic_proc_info.c
index 98d350128..2e7c62e5e 100644
--- a/src/pal/src/libunwind/src/mi/Gfind_dynamic_proc_info.c
+++ b/src/pal/src/libunwind/src/mi/Gfind_dynamic_proc_info.c
@@ -49,6 +49,7 @@ local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
return -UNW_ENOINFO;
#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
list = (unw_dyn_info_list_t *) (uintptr_t) _U_dyn_info_list_addr ();
for (di = list->first; di; di = di->next)
if (ip >= di->start_ip && ip < di->end_ip)
diff --git a/src/pal/src/libunwind/src/mips/Ginit.c b/src/pal/src/libunwind/src/mips/Ginit.c
index 3df170c75..bf7a8f5a8 100644
--- a/src/pal/src/libunwind/src/mips/Ginit.c
+++ b/src/pal/src/libunwind/src/mips/Ginit.c
@@ -69,13 +69,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -86,7 +79,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/ppc32/Ginit.c b/src/pal/src/libunwind/src/ppc32/Ginit.c
index ba302448a..7b4545580 100644
--- a/src/pal/src/libunwind/src/ppc32/Ginit.c
+++ b/src/pal/src/libunwind/src/ppc32/Ginit.c
@@ -91,9 +91,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -104,7 +101,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/ppc64/Ginit.c b/src/pal/src/libunwind/src/ppc64/Ginit.c
index 4c88cd6e7..7bfb395a7 100644
--- a/src/pal/src/libunwind/src/ppc64/Ginit.c
+++ b/src/pal/src/libunwind/src/ppc64/Ginit.c
@@ -95,9 +95,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -108,7 +105,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c b/src/pal/src/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c
index cc5ed0441..16671d453 100644
--- a/src/pal/src/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c
@@ -71,6 +71,11 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
#else
+/* XXX fix me: there is currently no way to locate the dyn-info list
+ by a remote unwinder. On ia64, this is done via a special
+ unwind-table entry. Perhaps something similar can be done with
+ DWARF2 unwind info. */
+
static inline int
get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
int *countp)
diff --git a/src/pal/src/libunwind/src/sh/Ginit.c b/src/pal/src/libunwind/src/sh/Ginit.c
index 52988a721..9fe96d2bd 100644
--- a/src/pal/src/libunwind/src/sh/Ginit.c
+++ b/src/pal/src/libunwind/src/sh/Ginit.c
@@ -58,13 +58,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -75,7 +68,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/tilegx/Ginit.c b/src/pal/src/libunwind/src/tilegx/Ginit.c
index 7564a558b..925e64132 100644
--- a/src/pal/src/libunwind/src/tilegx/Ginit.c
+++ b/src/pal/src/libunwind/src/tilegx/Ginit.c
@@ -64,13 +64,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -81,7 +74,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/x86/Ginit.c b/src/pal/src/libunwind/src/x86/Ginit.c
index f6b8dc27d..3cec74a21 100644
--- a/src/pal/src/libunwind/src/x86/Ginit.c
+++ b/src/pal/src/libunwind/src/x86/Ginit.c
@@ -54,13 +54,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -71,7 +64,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/x86_64/Ginit.c b/src/pal/src/libunwind/src/x86_64/Ginit.c
index a865d3385..fd8d418b1 100644
--- a/src/pal/src/libunwind/src/x86_64/Ginit.c
+++ b/src/pal/src/libunwind/src/x86_64/Ginit.c
@@ -49,13 +49,6 @@ static struct unw_addr_space local_addr_space;
unw_addr_space_t unw_local_addr_space = &local_addr_space;
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -66,7 +59,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}

View file

@ -1,46 +0,0 @@
From 1864630f762160e1cb439362cc0577471624192a Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Fri, 19 Jul 2019 19:18:51 -0400
Subject: [PATCH] Fix up cgroup2fs in Interop.MountPoints.FormatInfo
`stat -fc %T /sys/fs/cgroup` calls this file system `cgroup2fs`
Add the cgroup2fs file system magic number. Available from:
- https://www.kernel.org/doc/Documentation/cgroup-v2.txt
- man 2 statfs
Move cgroup2fs next to cgroupfs in the drive type list, since it is also
DriveType.Ram.
---
.../Unix/System.Native/Interop.MountPoints.FormatInfo.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs b/src/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs
index af38a2285ba2..4240bd4853ab 100644
--- a/src/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs
+++ b/src/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs
@@ -47,6 +47,7 @@ internal enum UnixFileSystemTypes : long
btrfs = 0x9123683E,
ceph = 0x00C36400,
cgroupfs = 0x0027E0EB,
+ cgroup2fs = 0x63677270,
cifs = 0xFF534D42,
coda = 0x73757245,
coherent = 0x012FF7B7,
@@ -231,7 +232,6 @@ private static DriveType GetDriveType(string fileSystemName)
case "bpf_fs":
case "btrfs":
case "btrfs_test":
- case "cgroup2fs":
case "coh":
case "daxfs":
case "drvfs":
@@ -384,6 +384,7 @@ private static DriveType GetDriveType(string fileSystemName)
case "binfmt_misc":
case "cgroup":
case "cgroupfs":
+ case "cgroup2fs":
case "configfs":
case "cramfs":
case "cramfs-wend":

View file

@ -1,391 +0,0 @@
From 2b2273ea4ea1c28472fa0d6ad2ffeb6374500550 Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Wed, 23 Oct 2019 17:45:59 -0400
Subject: [PATCH 1/2] Add cgroup v2 support to Interop.cgroups
Fix up code to adjust cgroup v1 assumptions and check cgroup v2 paths,
locations and values.
Continue using the older cgroup v1 terminology for APIs.
---
.../Interop/Linux/cgroups/Interop.cgroups.cs | 116 ++++++++++++++----
src/Common/tests/Common.Tests.csproj | 4 +
.../tests/Tests/Interop/cgroupsTests.cs | 107 ++++++++++++++++
.../tests/DescriptionNameTests.cs | 2 +-
4 files changed, 206 insertions(+), 23 deletions(-)
create mode 100644 src/Common/tests/Tests/Interop/cgroupsTests.cs
diff --git a/src/Common/src/Interop/Linux/cgroups/Interop.cgroups.cs b/src/Common/src/Interop/Linux/cgroups/Interop.cgroups.cs
index 0ffd4d7b7c03..186fe0516c5b 100644
--- a/src/Common/src/Interop/Linux/cgroups/Interop.cgroups.cs
+++ b/src/Common/src/Interop/Linux/cgroups/Interop.cgroups.cs
@@ -9,17 +9,22 @@
internal static partial class Interop
{
+ /// <summary>Provides access to some cgroup (v1 and v2) features</summary>
internal static partial class cgroups
{
+ // For cgroup v1, see https://www.kernel.org/doc/Documentation/cgroup-v1/
+ // For cgroup v2, see https://www.kernel.org/doc/Documentation/cgroup-v2.txt
+
+ /// <summary>The version of cgroup that's being used </summary>
+ internal enum CGroupVersion { None, CGroup1, CGroup2 };
+
/// <summary>Path to mountinfo file in procfs for the current process.</summary>
private const string ProcMountInfoFilePath = "/proc/self/mountinfo";
/// <summary>Path to cgroup directory in procfs for the current process.</summary>
private const string ProcCGroupFilePath = "/proc/self/cgroup";
- /// <summary>Path to the found cgroup location, or null if it couldn't be found.</summary>
- internal static readonly string s_cgroupMemoryPath = FindCGroupPath("memory");
- /// <summary>Path to the found cgroup memory limit_in_bytes path, or null if it couldn't be found.</summary>
- private static readonly string s_cgroupMemoryLimitPath = s_cgroupMemoryPath != null ? s_cgroupMemoryPath + "/memory.limit_in_bytes" : null;
+ /// <summary>Path to the found cgroup memory limit path, or null if it couldn't be found.</summary>
+ internal static readonly string s_cgroupMemoryLimitPath = FindCGroupMemoryLimitPath();
/// <summary>Tries to read the memory limit from the cgroup memory location.</summary>
/// <param name="limit">The read limit, or 0 if it couldn't be read.</param>
@@ -42,7 +47,7 @@ public static bool TryGetMemoryLimit(out ulong limit)
/// <param name="path">The path to the file to parse.</param>
/// <param name="result">The parsed result, or 0 if it couldn't be parsed.</param>
/// <returns>true if the value was read successfully; otherwise, false.</returns>
- private static bool TryReadMemoryValueFromFile(string path, out ulong result)
+ internal static bool TryReadMemoryValueFromFile(string path, out ulong result)
{
if (File.Exists(path))
{
@@ -79,6 +84,11 @@ private static bool TryReadMemoryValueFromFile(string path, out ulong result)
result = checked(ulongValue * multiplier);
return true;
}
+
+ // 'max' is also a possible valid value
+ //
+ // Treat this as 'no memory limit' and let the caller
+ // fallback to reading the real limit via other means
}
catch (Exception e)
{
@@ -90,12 +100,35 @@ private static bool TryReadMemoryValueFromFile(string path, out ulong result)
return false;
}
+ /// <summary>Find the cgroup memory limit path.</summary>
+ /// <returns>The limit path if found; otherwise, null.</returns>
+ private static string FindCGroupMemoryLimitPath()
+ {
+ string cgroupMemoryPath = FindCGroupPath("memory", out CGroupVersion version);
+ if (cgroupMemoryPath != null)
+ {
+ if (version == CGroupVersion.CGroup1)
+ {
+ return cgroupMemoryPath + "/memory.limit_in_bytes";
+ }
+
+ if (version == CGroupVersion.CGroup2)
+ {
+ // 'memory.high' is a soft limit; the process may get throttled
+ // 'memory.max' is where OOM killer kicks in
+ return cgroupMemoryPath + "/memory.max";
+ }
+ }
+
+ return null;
+ }
+
/// <summary>Find the cgroup path for the specified subsystem.</summary>
/// <param name="subsystem">The subsystem, e.g. "memory".</param>
/// <returns>The cgroup path if found; otherwise, null.</returns>
- private static string FindCGroupPath(string subsystem)
+ private static string FindCGroupPath(string subsystem, out CGroupVersion version)
{
- if (TryFindHierarchyMount(subsystem, out string hierarchyRoot, out string hierarchyMount) &&
+ if (TryFindHierarchyMount(subsystem, out version, out string hierarchyRoot, out string hierarchyMount) &&
TryFindCGroupPathForSubsystem(subsystem, out string cgroupPathRelativeToMount))
{
// For a host cgroup, we need to append the relative path.
@@ -113,19 +146,24 @@ private static string FindCGroupPath(string subsystem)
/// <param name="root">The path of the directory in the filesystem which forms the root of this mount; null if not found.</param>
/// <param name="path">The path of the mount point relative to the process's root directory; null if not found.</param>
/// <returns>true if the mount was found; otherwise, null.</returns>
- private static bool TryFindHierarchyMount(string subsystem, out string root, out string path)
+ private static bool TryFindHierarchyMount(string subsystem, out CGroupVersion version, out string root, out string path)
{
- if (File.Exists(ProcMountInfoFilePath))
+ return TryFindHierarchyMount(ProcMountInfoFilePath, subsystem, out version, out root, out path);
+ }
+
+ internal static bool TryFindHierarchyMount(string mountInfoFilePath, string subsystem, out CGroupVersion version, out string root, out string path)
+ {
+ if (File.Exists(mountInfoFilePath))
{
try
{
- using (var reader = new StreamReader(ProcMountInfoFilePath))
+ using (var reader = new StreamReader(mountInfoFilePath))
{
string line;
while ((line = reader.ReadLine()) != null)
{
// Look for an entry that has cgroup as the "filesystem type"
- // and that has options containing the specified subsystem.
+ // and, for cgroup1, that has options containing the specified subsystem
// See man page for /proc/[pid]/mountinfo for details, e.g.:
// (1)(2)(3) (4) (5) (6) (7) (8) (9) (10) (11)
// 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
@@ -148,17 +186,35 @@ private static bool TryFindHierarchyMount(string subsystem, out string root, out
continue;
}
- if (postSeparatorlineParts[0] != "cgroup" ||
- Array.IndexOf(postSeparatorlineParts[2].Split(','), subsystem) < 0)
+ bool validCGroup1Entry = ((postSeparatorlineParts[0] == "cgroup") &&
+ (Array.IndexOf(postSeparatorlineParts[2].Split(','), subsystem) >= 0));
+ bool validCGroup2Entry = postSeparatorlineParts[0] == "cgroup2";
+
+ if (!validCGroup1Entry && !validCGroup2Entry)
{
// Not the relevant entry.
continue;
}
- // Found the relevant entry. Extract the mount root and path.
+ // Found the relevant entry. Extract the cgroup version, mount root and path.
+ switch (postSeparatorlineParts[0])
+ {
+ case "cgroup":
+ version = CGroupVersion.CGroup1;
+ break;
+ case "cgroup2":
+ version = CGroupVersion.CGroup2;
+ break;
+ default:
+ version = CGroupVersion.None;
+ Debug.Fail($"invalid value for CGroupVersion \"{postSeparatorlineParts[0]}\"");
+ break;
+ }
+
string[] lineParts = line.Substring(0, endOfOptionalFields).Split(' ');
root = lineParts[3];
path = lineParts[4];
+
return true;
}
}
@@ -169,6 +225,7 @@ private static bool TryFindHierarchyMount(string subsystem, out string root, out
}
}
+ version = CGroupVersion.None;
root = null;
path = null;
return false;
@@ -180,27 +237,42 @@ private static bool TryFindHierarchyMount(string subsystem, out string root, out
/// <returns></returns>
private static bool TryFindCGroupPathForSubsystem(string subsystem, out string path)
{
- if (File.Exists(ProcCGroupFilePath))
+ return TryFindCGroupPathForSubsystem(ProcCGroupFilePath, subsystem, out path);
+ }
+
+ internal static bool TryFindCGroupPathForSubsystem(string procCGroupFilePath, string subsystem, out string path)
+ {
+ if (File.Exists(procCGroupFilePath))
{
try
{
- using (var reader = new StreamReader(ProcCGroupFilePath))
+ using (var reader = new StreamReader(procCGroupFilePath))
{
string line;
while ((line = reader.ReadLine()) != null)
{
- // Find the first entry that has the subsystem listed in its controller
- // list. See man page for cgroups for /proc/[pid]/cgroups format, e.g:
- // hierarchy-ID:controller-list:cgroup-path
- // 5:cpuacct,cpu,cpuset:/daemons
-
string[] lineParts = line.Split(':');
+
if (lineParts.Length != 3)
{
// Malformed line.
continue;
}
+ // cgroup v2: Find the first entry that matches the cgroup v2 hierarchy:
+ // 0::$PATH
+
+ if ((lineParts[0] == "0") && (string.Empty == lineParts[1]))
+ {
+ path = lineParts[2];
+ return true;
+ }
+
+ // cgroup v1: Find the first entry that has the subsystem listed in its controller
+ // list. See man page for cgroups for /proc/[pid]/cgroups format, e.g:
+ // hierarchy-ID:controller-list:cgroup-path
+ // 5:cpuacct,cpu,cpuset:/daemons
+
if (Array.IndexOf(lineParts[1].Split(','), subsystem) < 0)
{
// Not the relevant entry.
@@ -214,7 +286,7 @@ private static bool TryFindCGroupPathForSubsystem(string subsystem, out string p
}
catch (Exception e)
{
- Debug.Fail($"Failed to read or parse \"{ProcMountInfoFilePath}\": {e}");
+ Debug.Fail($"Failed to read or parse \"{procCGroupFilePath}\": {e}");
}
}
diff --git a/src/Common/tests/Common.Tests.csproj b/src/Common/tests/Common.Tests.csproj
index a189d856348b..979c8dd7fbe6 100644
--- a/src/Common/tests/Common.Tests.csproj
+++ b/src/Common/tests/Common.Tests.csproj
@@ -12,6 +12,9 @@
<Compile Include="$(CommonTestPath)\System\Security\Cryptography\ByteUtils.cs">
<Link>Common\System\Security\Cryptography\ByteUtils.cs</Link>
</Compile>
+ <Compile Include="$(CommonPath)\Interop\Linux\cgroups\Interop.cgroups.cs">
+ <Link>Common\Interop\Linux\cgroups\Interop.cgroups.cs</Link>
+ </Compile>
<Compile Include="$(CommonPath)\Interop\Linux\procfs\Interop.ProcFsStat.cs">
<Link>Common\Interop\Linux\procfs\Interop.ProcFsStat.cs</Link>
</Compile>
@@ -69,6 +72,7 @@
<Compile Include="$(CommonPath)\CoreLib\System\PasteArguments.cs">
<Link>Common\CoreLib\System\PasteArguments.cs</Link>
</Compile>
+ <Compile Include="Tests\Interop\cgroupsTests.cs" />
<Compile Include="Tests\Interop\procfsTests.cs" />
<Compile Include="Tests\System\CharArrayHelpersTests.cs" />
<Compile Include="Tests\System\IO\PathInternal.Tests.cs" />
diff --git a/src/Common/tests/Tests/Interop/cgroupsTests.cs b/src/Common/tests/Tests/Interop/cgroupsTests.cs
new file mode 100644
index 000000000000..f16d9242879c
--- /dev/null
+++ b/src/Common/tests/Tests/Interop/cgroupsTests.cs
@@ -0,0 +1,107 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.IO;
+using System.Text;
+using Xunit;
+
+namespace Common.Tests
+{
+ public class cgroupsTests
+ {
+ [Theory]
+ [InlineData(true, "0", 0)]
+ [InlineData(false, "max", 0)]
+ [InlineData(true, "1k", 1024)]
+ [InlineData(true, "1K", 1024)]
+ public static void ValidateTryReadMemoryValue(bool expectedResult, string valueText, ulong expectedValue)
+ {
+ string path = Path.GetTempFileName();
+ try
+ {
+ File.WriteAllText(path, valueText);
+
+ bool result = Interop.cgroups.TryReadMemoryValueFromFile(path, out ulong val);
+
+ Assert.Equal(expectedResult, result);
+ if (result)
+ {
+ Assert.Equal(expectedValue, val);
+ }
+ }
+ finally
+ {
+ File.Delete(path);
+ }
+ }
+
+ [Theory]
+ [InlineData(false, "0 0 0:0 / /foo ignore ignore - overlay overlay ignore", "ignore", 0, "/", "/")]
+ [InlineData(true, "0 0 0:0 / /foo ignore ignore - cgroup2 cgroup2 ignore", "ignore", 2, "/", "/foo")]
+ [InlineData(true, "0 0 0:0 / /foo ignore ignore - cgroup2 cgroup2 ignore", "memory", 2, "/", "/foo")]
+ [InlineData(true, "0 0 0:0 / /foo ignore ignore - cgroup2 cgroup2 ignore", "cpu", 2, "/", "/foo")]
+ [InlineData(true, "0 0 0:0 / /foo ignore - cgroup2 cgroup2 ignore", "cpu", 2, "/", "/foo")]
+ [InlineData(true, "0 0 0:0 / /foo ignore ignore ignore - cgroup2 cgroup2 ignore", "cpu", 2, "/", "/foo")]
+ [InlineData(true, "0 0 0:0 / /foo-with-dashes ignore ignore - cgroup2 cgroup2 ignore", "ignore", 2, "/", "/foo-with-dashes")]
+ [InlineData(true, "0 0 0:0 / /foo ignore ignore - cgroup cgroup memory", "memory", 1, "/", "/foo")]
+ [InlineData(true, "0 0 0:0 / /foo-with-dashes ignore ignore - cgroup cgroup memory", "memory", 1, "/", "/foo-with-dashes")]
+ [InlineData(true, "0 0 0:0 / /foo ignore ignore - cgroup cgroup cpu,memory", "memory", 1, "/", "/foo")]
+ [InlineData(true, "0 0 0:0 / /foo ignore ignore - cgroup cgroup memory,cpu", "memory", 1, "/", "/foo")]
+ [InlineData(false, "0 0 0:0 / /foo ignore ignore - cgroup cgroup cpu", "memory", 0, "/", "/foo")]
+ public static void ParseValidateMountInfo(bool found, string procSelfMountInfoText, string subsystem, int expectedVersion, string expectedRoot, string expectedMount)
+ {
+ string path = Path.GetTempFileName();
+ try
+ {
+ File.WriteAllText(path, procSelfMountInfoText);
+
+ bool result = Interop.cgroups.TryFindHierarchyMount(path, subsystem, out Interop.cgroups.CGroupVersion version, out string root, out string mount);
+
+ Assert.Equal(found, result);
+ if (found)
+ {
+ Assert.Equal(expectedVersion, (int)version);
+ Assert.Equal(expectedRoot, root);
+ Assert.Equal(expectedMount, mount);
+ }
+ }
+ finally
+ {
+ File.Delete(path);
+ }
+ }
+
+ [Theory]
+ [InlineData(true, "0::/foo", "ignore", "/foo")]
+ [InlineData(true, "0::/bar", "ignore", "/bar")]
+ [InlineData(true, "0::frob", "ignore", "frob")]
+ [InlineData(false, "1::frob", "ignore", "ignore")]
+ [InlineData(true, "1:foo:bar", "foo", "bar")]
+ [InlineData(true, "2:foo:bar", "foo", "bar")]
+ [InlineData(false, "2:foo:bar", "bar", "ignore")]
+ [InlineData(true, "1:foo:bar\n2:eggs:spam", "foo", "bar")]
+ [InlineData(true, "1:foo:bar\n2:eggs:spam", "eggs", "spam")]
+ public static void ParseValidateProcCGroup(bool found, string procSelfCgroupText, string subsystem, string expectedMountPath)
+ {
+ string path = Path.GetTempFileName();
+ try
+ {
+ File.WriteAllText(path, procSelfCgroupText);
+
+ bool result = Interop.cgroups.TryFindCGroupPathForSubsystem(path, subsystem, out string mountPath);
+
+ Assert.Equal(found, result);
+ if (found)
+ {
+ Assert.Equal(expectedMountPath, mountPath);
+ }
+ }
+ finally
+ {
+ File.Delete(path);
+ }
+ }
+ }
+}
diff --git a/src/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs b/src/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs
index 910af2fd82b4..73f692898dbc 100644
--- a/src/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs
+++ b/src/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs
@@ -40,7 +40,7 @@ public void DumpRuntimeInformationToConsole()
Console.WriteLine($"### CURRENT DIRECTORY: {Environment.CurrentDirectory}");
- string cgroupsLocation = Interop.cgroups.s_cgroupMemoryPath;
+ string cgroupsLocation = Interop.cgroups.s_cgroupMemoryLimitPath;
if (cgroupsLocation != null)
{
Console.WriteLine($"### CGROUPS MEMORY: {cgroupsLocation}");

View file

@ -1,129 +0,0 @@
From 9a8c5e4014ffca8aff70808cc0e50a403d38c292 Mon Sep 17 00:00:00 2001
From: Stephen Toub <stoub@microsoft.com>
Date: Wed, 23 Oct 2019 20:35:49 -0400
Subject: [PATCH 2/2] Clean up new tests
---
.../tests/Tests/Interop/cgroupsTests.cs | 79 ++++++-------------
1 file changed, 25 insertions(+), 54 deletions(-)
diff --git a/src/Common/tests/Tests/Interop/cgroupsTests.cs b/src/Common/tests/Tests/Interop/cgroupsTests.cs
index f16d9242879c..fc6ab5c9753c 100644
--- a/src/Common/tests/Tests/Interop/cgroupsTests.cs
+++ b/src/Common/tests/Tests/Interop/cgroupsTests.cs
@@ -2,38 +2,27 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
using System.IO;
-using System.Text;
using Xunit;
namespace Common.Tests
{
- public class cgroupsTests
+ public class cgroupsTests : FileCleanupTestBase
{
[Theory]
- [InlineData(true, "0", 0)]
- [InlineData(false, "max", 0)]
- [InlineData(true, "1k", 1024)]
- [InlineData(true, "1K", 1024)]
- public static void ValidateTryReadMemoryValue(bool expectedResult, string valueText, ulong expectedValue)
+ [InlineData(true, "0", 0)]
+ [InlineData(false, "max", 0)]
+ [InlineData(true, "1k", 1024)]
+ [InlineData(true, "1K", 1024)]
+ public void ValidateTryReadMemoryValue(bool expectedResult, string valueText, ulong expectedValue)
{
- string path = Path.GetTempFileName();
- try
- {
- File.WriteAllText(path, valueText);
-
- bool result = Interop.cgroups.TryReadMemoryValueFromFile(path, out ulong val);
+ string path = GetTestFilePath();
+ File.WriteAllText(path, valueText);
- Assert.Equal(expectedResult, result);
- if (result)
- {
- Assert.Equal(expectedValue, val);
- }
- }
- finally
+ Assert.Equal(expectedResult, Interop.cgroups.TryReadMemoryValueFromFile(path, out ulong val));
+ if (expectedResult)
{
- File.Delete(path);
+ Assert.Equal(expectedValue, val);
}
}
@@ -50,26 +39,17 @@ public static void ValidateTryReadMemoryValue(bool expectedResult, string valueT
[InlineData(true, "0 0 0:0 / /foo ignore ignore - cgroup cgroup cpu,memory", "memory", 1, "/", "/foo")]
[InlineData(true, "0 0 0:0 / /foo ignore ignore - cgroup cgroup memory,cpu", "memory", 1, "/", "/foo")]
[InlineData(false, "0 0 0:0 / /foo ignore ignore - cgroup cgroup cpu", "memory", 0, "/", "/foo")]
- public static void ParseValidateMountInfo(bool found, string procSelfMountInfoText, string subsystem, int expectedVersion, string expectedRoot, string expectedMount)
+ public void ParseValidateMountInfo(bool expectedFound, string procSelfMountInfoText, string subsystem, int expectedVersion, string expectedRoot, string expectedMount)
{
- string path = Path.GetTempFileName();
- try
- {
- File.WriteAllText(path, procSelfMountInfoText);
-
- bool result = Interop.cgroups.TryFindHierarchyMount(path, subsystem, out Interop.cgroups.CGroupVersion version, out string root, out string mount);
+ string path = GetTestFilePath();
+ File.WriteAllText(path, procSelfMountInfoText);
- Assert.Equal(found, result);
- if (found)
- {
- Assert.Equal(expectedVersion, (int)version);
- Assert.Equal(expectedRoot, root);
- Assert.Equal(expectedMount, mount);
- }
- }
- finally
+ Assert.Equal(expectedFound, Interop.cgroups.TryFindHierarchyMount(path, subsystem, out Interop.cgroups.CGroupVersion version, out string root, out string mount));
+ if (expectedFound)
{
- File.Delete(path);
+ Assert.Equal(expectedVersion, (int)version);
+ Assert.Equal(expectedRoot, root);
+ Assert.Equal(expectedMount, mount);
}
}
@@ -83,24 +63,15 @@ public static void ParseValidateMountInfo(bool found, string procSelfMountInfoTe
[InlineData(false, "2:foo:bar", "bar", "ignore")]
[InlineData(true, "1:foo:bar\n2:eggs:spam", "foo", "bar")]
[InlineData(true, "1:foo:bar\n2:eggs:spam", "eggs", "spam")]
- public static void ParseValidateProcCGroup(bool found, string procSelfCgroupText, string subsystem, string expectedMountPath)
+ public void ParseValidateProcCGroup(bool expectedFound, string procSelfCgroupText, string subsystem, string expectedMountPath)
{
- string path = Path.GetTempFileName();
- try
- {
- File.WriteAllText(path, procSelfCgroupText);
+ string path = GetTestFilePath();
+ File.WriteAllText(path, procSelfCgroupText);
- bool result = Interop.cgroups.TryFindCGroupPathForSubsystem(path, subsystem, out string mountPath);
-
- Assert.Equal(found, result);
- if (found)
- {
- Assert.Equal(expectedMountPath, mountPath);
- }
- }
- finally
+ Assert.Equal(expectedFound, Interop.cgroups.TryFindCGroupPathForSubsystem(path, subsystem, out string mountPath));
+ if (expectedFound)
{
- File.Delete(path);
+ Assert.Equal(expectedMountPath, mountPath);
}
}
}

View file

@ -1,70 +0,0 @@
From 58d6cd09bd2d5b1085c6572c1d97b8533cf8294b Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Fri, 3 Apr 2020 13:53:09 -0400
Subject: [PATCH] Fix corefx to build on clang 10
Clang 10 adds/enables new warnings, some of which is affecting
the corefx code.
Clang 10 has added -Walloca to warn about uses of alloca. This commit
replaces the only non-compliant use of that with a single fixed
stack-allocated buffer.
Clang 10 has also added -Wimplicit-int-float-conversion. This commit
uses explicit casts to double to avoid the warnings.
This is a backport of dotnet/runtime#33734 to corefx.
After this commit, I can build all of corefx with Clang 10.
---
src/Native/Unix/System.Native/pal_io.c | 20 +++++++++++---------
src/Native/Unix/System.Native/pal_time.c | 2 +-
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/Native/Unix/System.Native/pal_io.c b/src/Native/Unix/System.Native/pal_io.c
index 2d51edacf5ee..c7c42eb3e72b 100644
--- a/src/Native/Unix/System.Native/pal_io.c
+++ b/src/Native/Unix/System.Native/pal_io.c
@@ -906,18 +906,20 @@ int32_t SystemNative_Poll(PollEvent* pollEvents, uint32_t eventCount, int32_t mi
return Error_EINVAL;
}
- size_t bufferSize;
- if (!multiply_s(sizeof(struct pollfd), (size_t)eventCount, &bufferSize))
+ struct pollfd stackBuffer[(uint32_t)(2048/sizeof(struct pollfd))];
+ int useStackBuffer = eventCount <= (sizeof(stackBuffer)/sizeof(stackBuffer[0]));
+ struct pollfd* pollfds = NULL;
+ if (useStackBuffer)
{
- return SystemNative_ConvertErrorPlatformToPal(EOVERFLOW);
+ pollfds = (struct pollfd*)&stackBuffer[0];
}
-
-
- int useStackBuffer = bufferSize <= 2048;
- struct pollfd* pollfds = (struct pollfd*)(useStackBuffer ? alloca(bufferSize) : malloc(bufferSize));
- if (pollfds == NULL)
+ else
{
- return Error_ENOMEM;
+ pollfds = (struct pollfd*)calloc(eventCount, sizeof(*pollfds));
+ if (pollfds == NULL)
+ {
+ return Error_ENOMEM;
+ }
}
for (uint32_t i = 0; i < eventCount; i++)
diff --git a/src/Native/Unix/System.Native/pal_time.c b/src/Native/Unix/System.Native/pal_time.c
index 1a7c862749d1..54ebde60a83b 100644
--- a/src/Native/Unix/System.Native/pal_time.c
+++ b/src/Native/Unix/System.Native/pal_time.c
@@ -169,7 +169,7 @@ int32_t SystemNative_GetCpuUtilization(ProcessCpuInformation* previousCpuInfo)
uint64_t resolution = SystemNative_GetTimestampResolution();
uint64_t timestamp = SystemNative_GetTimestamp();
- uint64_t currentTime = (uint64_t)(timestamp * ((double)SecondsToNanoSeconds / resolution));
+ uint64_t currentTime = (uint64_t)((double)timestamp * ((double)SecondsToNanoSeconds / (double)resolution));
uint64_t lastRecordedCurrentTime = previousCpuInfo->lastRecordedCurrentTime;
uint64_t lastRecordedKernelTime = previousCpuInfo->lastRecordedKernelTime;

View file

@ -1,124 +0,0 @@
From 66d0116c74a33e43b171f3ef5323e8a3883ceb18 Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Fri, 12 Feb 2021 11:01:36 -0500
Subject: [PATCH] Add Fedora 35 RID
Fedora rawhide now uses the fedora.35-x64 RID:
$ podman run -it registry.fedoraproject.org/fedora:rawhide /bin/bash -c 'cat /etc/os-release'
NAME=Fedora
VERSION="35 (Container Image Prerelease)"
ID=fedora
VERSION_ID=35
VERSION_CODENAME=""
PLATFORM_ID="platform:f35"
PRETTY_NAME="Fedora 35 (Container Image Prerelease)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:35"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=rawhide
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=rawhide
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Container Image"
VARIANT_ID=container
This is a backport of https://github.com/dotnet/runtime/pull/48200.
---
eng/Packaging.props | 2 +-
.../runtime.compatibility.json | 32 +++++++++++++++++++
pkg/Microsoft.NETCore.Platforms/runtime.json | 17 ++++++++++
.../runtimeGroups.props | 2 +-
.../packageIndex.json | 5 +--
src/packages.builds | 3 ++
6 files changed, 57 insertions(+), 4 deletions(-)
diff --git a/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json b/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json
index 382ee4552177..bb045b0856f1 100644
--- a/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json
+++ b/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json
@@ -1102,6 +1102,38 @@
"any",
"base"
],
+ "fedora.35": [
+ "fedora.35",
+ "fedora",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "fedora.35-arm64": [
+ "fedora.35-arm64",
+ "fedora.35",
+ "fedora-arm64",
+ "fedora",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "fedora.35-x64": [
+ "fedora.35-x64",
+ "fedora.35",
+ "fedora-x64",
+ "fedora",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
"freebsd": [
"freebsd",
"unix",
diff --git a/pkg/Microsoft.NETCore.Platforms/runtime.json b/pkg/Microsoft.NETCore.Platforms/runtime.json
index a50be8567ce0..10b204def550 100644
--- a/pkg/Microsoft.NETCore.Platforms/runtime.json
+++ b/pkg/Microsoft.NETCore.Platforms/runtime.json
@@ -544,6 +544,23 @@
"fedora-x64"
]
},
+ "fedora.35": {
+ "#import": [
+ "fedora"
+ ]
+ },
+ "fedora.35-arm64": {
+ "#import": [
+ "fedora.35",
+ "fedora-arm64"
+ ]
+ },
+ "fedora.35-x64": {
+ "#import": [
+ "fedora.35",
+ "fedora-x64"
+ ]
+ },
"freebsd": {
"#import": [
"unix"
diff --git a/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props b/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props
index faa697f34e20..8b9c2e47ba2d 100644
--- a/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props
+++ b/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props
@@ -43,7 +43,7 @@
<RuntimeGroup Include="fedora">
<Parent>linux</Parent>
<Architectures>x64;arm64</Architectures>
- <Versions>23;24;25;26;27;28;29;30;31;32;33;34</Versions>
+ <Versions>23;24;25;26;27;28;29;30;31;32;33;34;35</Versions>
<TreatVersionsAsCompatible>false</TreatVersionsAsCompatible>
</RuntimeGroup>

View file

@ -1,389 +0,0 @@
diff --git a/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json b/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json
index da73456..428d9c9 100644
--- a/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json
+++ b/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json
@@ -177,6 +177,53 @@
"any",
"base"
],
+ "alpine.3.14": [
+ "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.14-x64": [
+ "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",
@@ -625,6 +672,74 @@
"any",
"base"
],
+ "debian.11": [
+ "debian.11",
+ "debian",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "debian.11-arm": [
+ "debian.11-arm",
+ "debian.11",
+ "debian-arm",
+ "debian",
+ "linux-arm",
+ "linux",
+ "unix-arm",
+ "unix",
+ "any",
+ "base"
+ ],
+ "debian.11-arm64": [
+ "debian.11-arm64",
+ "debian.11",
+ "debian-arm64",
+ "debian",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "debian.11-armel": [
+ "debian.11-armel",
+ "debian.11",
+ "debian-armel",
+ "debian",
+ "linux-armel",
+ "linux",
+ "unix-armel",
+ "unix",
+ "any",
+ "base"
+ ],
+ "debian.11-x64": [
+ "debian.11-x64",
+ "debian.11",
+ "debian-x64",
+ "debian",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "debian.11-x86": [
+ "debian.11-x86",
+ "debian.11",
+ "debian-x86",
+ "debian",
+ "linux-x86",
+ "linux",
+ "unix-x86",
+ "unix",
+ "any",
+ "base"
+ ],
"debian.8": [
"debian.8",
"debian",
@@ -3204,6 +3319,97 @@
"any",
"base"
],
+ "rosa": [
+ "rosa",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa-arm64": [
+ "rosa-arm64",
+ "rosa",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa-x64": [
+ "rosa-x64",
+ "rosa",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2019.05": [
+ "rosa.2019.05",
+ "rosa",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2019.05-arm64": [
+ "rosa.2019.05-arm64",
+ "rosa.2019.05",
+ "rosa-arm64",
+ "rosa",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2019.05-x64": [
+ "rosa.2019.05-x64",
+ "rosa.2019.05",
+ "rosa-x64",
+ "rosa",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2021.1": [
+ "rosa.2021.1",
+ "rosa",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2021.1-arm64": [
+ "rosa.2021.1-arm64",
+ "rosa.2021.1",
+ "rosa-arm64",
+ "rosa",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2021.1-x64": [
+ "rosa.2021.1-x64",
+ "rosa.2021.1",
+ "rosa-x64",
+ "rosa",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
"sles": [
"sles",
"linux",
diff --git a/pkg/Microsoft.NETCore.Platforms/runtime.json b/pkg/Microsoft.NETCore.Platforms/runtime.json
index 608a034..f832924 100644
--- a/pkg/Microsoft.NETCore.Platforms/runtime.json
+++ b/pkg/Microsoft.NETCore.Platforms/runtime.json
@@ -55,6 +55,17 @@
"alpine.3.12-x64"
]
},
+ "alpine.3.14": {
+ "#import": [
+ "alpine.3.13"
+ ]
+ },
+ "alpine.3.14-x64": {
+ "#import": [
+ "alpine.3.14",
+ "alpine.3.13-x64"
+ ]
+ },
"alpine.3.6": {
"#import": [
"alpine"
@@ -286,6 +297,41 @@
"debian-x86"
]
},
+ "debian.11": {
+ "#import": [
+ "debian"
+ ]
+ },
+ "debian.11-arm": {
+ "#import": [
+ "debian.11",
+ "debian-arm"
+ ]
+ },
+ "debian.11-arm64": {
+ "#import": [
+ "debian.11",
+ "debian-arm64"
+ ]
+ },
+ "debian.11-armel": {
+ "#import": [
+ "debian.11",
+ "debian-armel"
+ ]
+ },
+ "debian.11-x64": {
+ "#import": [
+ "debian.11",
+ "debian-x64"
+ ]
+ },
+ "debian.11-x86": {
+ "#import": [
+ "debian.11",
+ "debian-x86"
+ ]
+ },
"debian.8": {
"#import": [
"debian"
@@ -1428,6 +1474,57 @@
"rhel-x64"
]
},
+ "rosa": {
+ "#import": [
+ "linux"
+ ]
+ },
+ "rosa-arm64": {
+ "#import": [
+ "rosa",
+ "linux-arm64"
+ ]
+ },
+ "rosa-x64": {
+ "#import": [
+ "rosa",
+ "linux-x64"
+ ]
+ },
+ "rosa.2019.05": {
+ "#import": [
+ "rosa"
+ ]
+ },
+ "rosa.2019.05-arm64": {
+ "#import": [
+ "rosa.2019.05",
+ "rosa-arm64"
+ ]
+ },
+ "rosa.2019.05-x64": {
+ "#import": [
+ "rosa.2019.05",
+ "rosa-x64"
+ ]
+ },
+ "rosa.2021.1": {
+ "#import": [
+ "rosa"
+ ]
+ },
+ "rosa.2021.1-arm64": {
+ "#import": [
+ "rosa.2021.1",
+ "rosa-arm64"
+ ]
+ },
+ "rosa.2021.1-x64": {
+ "#import": [
+ "rosa.2021.1",
+ "rosa-x64"
+ ]
+ },
"sles": {
"#import": [
"linux"
diff --git a/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props b/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props
index 0e8d06d..846a80d 100644
--- a/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props
+++ b/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props
@@ -16,7 +16,7 @@
<RuntimeGroup Include="alpine">
<Parent>linux-musl</Parent>
<Architectures>x64</Architectures>
- <Versions>3.6;3.7;3.8;3.9;3.10;3.11;3.12;3.13</Versions>
+ <Versions>3.6;3.7;3.8;3.9;3.10;3.11;3.12;3.13;3.14</Versions>
</RuntimeGroup>
<RuntimeGroup Include="android">
@@ -43,7 +43,7 @@
<RuntimeGroup Include="debian">
<Parent>linux</Parent>
<Architectures>x64;x86;arm;armel;arm64</Architectures>
- <Versions>8;9;10</Versions>
+ <Versions>8;9;10;11</Versions>
<TreatVersionsAsCompatible>false</TreatVersionsAsCompatible>
</RuntimeGroup>
@@ -137,6 +137,13 @@
<Versions>9</Versions>
</RuntimeGroup>
+ <RuntimeGroup Include="rosa">
+ <Parent>linux</Parent>
+ <Architectures>x64;arm64</Architectures>
+ <Versions>2021.1;2019.05</Versions>
+ <TreatVersionsAsCompatible>false</TreatVersionsAsCompatible>
+ </RuntimeGroup>
+
<RuntimeGroup Include="sles">
<Parent>linux</Parent>
<Architectures>x64</Architectures>

View file

@ -1,40 +0,0 @@
diff --git a/src/Native/Unix/CMakeLists.txt b/src/Native/Unix/CMakeLists.txt
index 7d804a1e54..717c2718d7 100644
--- a/src/Native/Unix/CMakeLists.txt
+++ b/src/Native/Unix/CMakeLists.txt
@@ -25,7 +25,7 @@ add_compile_options(-fPIC)
add_compile_options(-Wthread-safety)
add_compile_options(-Wno-thread-safety-analysis)
+ add_compile_options(-Wno-alloca)
endif()
-add_compile_options(-Werror)
if(CMAKE_SYSTEM_NAME STREQUAL Emscripten)
set(CLR_CMAKE_PLATFORM_WASM 1)
diff --git a/src/Native/Unix/configure.cmake b/src/Native/Unix/configure.cmake
index f4a30ad6cb..f2db68402a 100644
--- a/src/Native/Unix/configure.cmake
+++ b/src/Native/Unix/configure.cmake
@@ -27,6 +27,12 @@ else ()
message(FATAL_ERROR "Unknown platform. Cannot define PAL_UNIX_NAME, used by RuntimeInformation.")
endif ()
+
+set (PREVIOUS_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+set (CMAKE_CXX_FLAGS "-D_GNU_SOURCE")
+set (PREVIOUS_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+set (CMAKE_C_FLAGS "-D_GNU_SOURCE")
+
# We compile with -Werror, so we need to make sure these code fragments compile without warnings.
# Older CMake versions (3.8) do not assign the result of their tests, causing unused-value errors
# which are not distinguished from the test failing. So no error for that one.
@@ -698,6 +704,9 @@ endif()
set (CMAKE_REQUIRED_LIBRARIES)
+set (CMAKE_CXX_FLAGS "${PREVIOUS_CMAKE_CXX_FLAGS}")
+set (CMAKE_C_FLAGS "${PREVIOUS_CMAKE_C_FLAGS}")
+
check_c_source_compiles(
"
#include <sys/inotify.h>

View file

@ -1,11 +0,0 @@
--- Directory.Build.props 2020-06-04 17:54:26.587622453 -0500
+++ Directory.Build.props 2020-06-04 17:54:43.948536557 -0500
@@ -145,8 +145,6 @@
<!-- The location of the local installation of the .NET Core shared framework. -->
<PropertyGroup>
<LocalDotNetRoot>$(RepoRoot).dotnet\</LocalDotNetRoot>
- <!-- Override the SDK default and point to local .dotnet folder. -->
- <NetCoreTargetingPackRoot>$(LocalDotNetRoot)packs\</NetCoreTargetingPackRoot>
</PropertyGroup>
<Import Project="eng\tools\RepoTasks\RepoTasks.tasks" Condition="'$(MSBuildProjectName)' != 'RepoTasks' AND '$(DesignTimeBuild)' != 'true'" />

View file

@ -1,567 +0,0 @@
%bcond_with bootstrap
%define _build_pkgcheck_set %{nil}
%define _build_pkgcheck_srpm %{nil}
%if %{mdvver} == 201905
%define __python_3 %{__python38}
%else
%define __python_3 %{__python3}
%endif
# Avoid provides/requires from private libraries
%global privlibs libhostfxr
%global privlibs %{privlibs}|libclrjit
%global privlibs %{privlibs}|libcoreclr
%global privlibs %{privlibs}|libcoreclrtraceptprovider
%global privlibs %{privlibs}|libdbgshim
%global privlibs %{privlibs}|libhostpolicy
%global privlibs %{privlibs}|libmscordaccore
%global privlibs %{privlibs}|libmscordbi
%global privlibs %{privlibs}|libsos
%global privlibs %{privlibs}|libsosplugin
%global __provides_exclude ^(%{privlibs})\\.so
%global __requires_exclude ^(%{privlibs})\\.so
# LTO triggers a compilation error for a source level issue. Given that LTO should not
# change the validity of any given source and the nature of the error (undefined enum), I
# suspect a generator program is mis-behaving in some way. This needs further debugging,
# until that's done, disable LTO. This has to happen before setting the flags below.
%define _lto_cflags %{nil}
%global host_version 3.1.18
%global runtime_version 3.1.18
%global aspnetcore_runtime_version %{runtime_version}
%global sdk_version 3.1.118
# upstream can update releases without revving the SDK version so these don't always match
%global src_version %{sdk_version}
%global templates_version %(echo %{runtime_version} | awk 'BEGIN { FS="."; OFS="." } {print $1, $2, $3+1 }')
%global host_rpm_version %{host_version}
%global aspnetcore_runtime_rpm_version %{aspnetcore_runtime_version}
%global runtime_rpm_version %{runtime_version}
%global sdk_rpm_version %{sdk_version}
%if 0%{?fedora} || 0%{?rhel} < 8
%global use_bundled_libunwind 0
%else
%global use_bundled_libunwind 1
%endif
%ifarch aarch64
%global use_bundled_libunwind 1
%endif
%ifarch x86_64
%global runtime_arch x64
%endif
%ifarch aarch64
%global runtime_arch arm64
%endif
%global runtime_id %{distsuffix}.%{rosa_release}*-%{runtime_arch}
%bcond_with identifier_platform_rosa
Name: dotnet3.1
Version: %{sdk_rpm_version}
Release: 3
Summary: .NET Core Runtime and SDK
Group: Development/Other
License: MIT and ASL 2.0 and BSD and LGPLv2+ and CC-BY and CC0 and MS-PL and EPL-1.0 and GPL+ and GPLv2 and ISC and OFL and zlib
URL: https://github.com/dotnet/
# The source is generated on a Fedora box via:
# ./build-dotnet-tarball v%%{src_version}-SDK
Source0: dotnet-v%{src_version}-SDK%{?_with_bootstrap:-original}.tar.gz
Source1: check-debug-symbols.py
Source2: dotnet.sh.in
Patch1: source-build-warnings-are-not-errors.patch
# Fix building with our additional CFLAGS/CXXFLAGS/LDFLAGS
Patch100: corefx-optflags-support.patch
#Add some support for cgroupv2 in corefx
# All these patches are upstreamed for 5.0
Patch101: corefx-39686-cgroupv2-01.patch
Patch102: corefx-39686-cgroupv2-02.patch
Patch103: corefx-39633-cgroupv2-mountpoints.patch
# Adding Rosalinux to the group to generate RID
# https://github.com/dotnet/source-build/issues/2095
Patch104: corefx-Rosalinux-groups.patch
# Fix build with clang 10; Already applied at tarball-build time
# Patch201: coreclr-clang10.patch
# Fix build on recent versions of gcc/clang
# https://github.com/libunwind/libunwind/pull/166
# Already applied
#Patch202: coreclr-libunwind-fno-common.patch
# Disable telemetry by default; make it opt-in
Patch500: cli-telemetry-optout.patch
# fix RID bootstrap, do it once
Patch501: RuntimeIdentifierGraph-Rosa.patch
ExclusiveArch: x86_64
BuildRequires: clang
BuildRequires: cmake
BuildRequires: coreutils
%if %{without bootstrap}
BuildRequires: dotnet-build-reference-packages
BuildRequires: dotnet-sdk-3.1
BuildRequires: dotnet-sdk-3.1-source-built-artifacts
%endif
BuildRequires: findutils
BuildRequires: git
BuildRequires: locales-en
BuildRequires: hostname
BuildRequires: krb5-devel
BuildRequires: pkgconfig(libcurl)
BuildRequires: icu-devel
%if ! %{use_bundled_libunwind}
BuildRequires: libunwind-devel
%endif
BuildRequires: %{_lib}lldb-devel
BuildRequires: llvm
BuildRequires: lttng-ust-devel
BuildRequires: make
BuildRequires: openssl-devel
BuildRequires: python3
BuildRequires: systemtap-sdt-devel
BuildRequires: tar
BuildRequires: zlib-devel
BuildRequires: which
ExcludeArch: %{armx}
%description
.NET Core is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, macOS and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
.NET Core contains a runtime conforming to .NET Standards a set of
framework libraries, an SDK containing compilers and a 'dotnet'
application to drive everything.
%package -n dotnet
Version: %{sdk_rpm_version}
Summary: .NET Core CLI tools and runtime
Requires: dotnet-sdk-3.1 >= %{sdk_rpm_version}-%{release}
%description -n dotnet
.NET Core is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, macOS and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
.NET Core contains a runtime conforming to .NET Standards a set of
framework libraries, an SDK containing compilers and a 'dotnet'
application to drive everything.
%package -n dotnet-host
Version: %{host_rpm_version}
Summary: .NET command line launcher
%description -n dotnet-host
The .NET Core host is a command line program that runs a standalone
.NET core application or launches the SDK.
.NET Core is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n dotnet-hostfxr-3.1
Version: %{host_rpm_version}
Summary: .NET Core command line host resolver
# Theoretically any version of the host should work. But lets aim for the one
# provided by this package, or from a newer version of .NET Core
Requires: dotnet-host >= %{host_rpm_version}-%{release}
%description -n dotnet-hostfxr-3.1
The .NET Core host resolver contains the logic to resolve and select
the right version of the .NET Core SDK or runtime to use.
.NET Core is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n dotnet-runtime-3.1
Version: %{runtime_rpm_version}
Summary: NET Core 3.1 runtime
Requires: dotnet-hostfxr-3.1 >= %{host_rpm_version}-%{release}
# remove development tools
%if 0
# libicu is dlopen()ed
Requires: %{_lib}icu-devel
%endif
%if %{use_bundled_libunwind}
Provides: bundled(libunwind) = 1.3
%endif
%description -n dotnet-runtime-3.1
The .NET Core runtime contains everything needed to run .NET Core applications.
It includes a high performance Virtual Machine as well as the framework
libraries used by .NET Core applications.
.NET Core is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n aspnetcore-runtime-3.1
Version: %{aspnetcore_runtime_rpm_version}
Summary: ASP.NET Core 3.1 runtime
Requires: dotnet-runtime-3.1 >= %{runtime_rpm_version}-%{release}
%description -n aspnetcore-runtime-3.1
The ASP.NET Core runtime contains everything needed to run .NET Core
web applications. It includes a high performance Virtual Machine as
well as the framework libraries used by .NET Core applications.
ASP.NET Core is a fast, lightweight and modular platform for creating
cross platform web applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n dotnet-templates-3.1
Version: %{sdk_rpm_version}
Summary: .NET Core 3.1 templates
# Theoretically any version of the host should work. But lets aim for the one
# provided by this package, or from a newer version of .NET Core
Requires: dotnet-host >= %{host_rpm_version}-%{release}
%description -n dotnet-templates-3.1
This package contains templates used by the .NET Core SDK.
ASP.NET Core is a fast, lightweight and modular platform for creating
cross platform web applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n dotnet-sdk-3.1
Version: %{sdk_rpm_version}
Summary: .NET Core 3.1 Software Development Kit
Provides: bundled(js-jquery)
Provides: bundled(npm)
Requires: dotnet-runtime-3.1 >= %{runtime_rpm_version}-%{release}
Requires: aspnetcore-runtime-3.1 >= %{aspnetcore_runtime_rpm_version}-%{release}
Requires: dotnet-apphost-pack-3.1 >= %{runtime_rpm_version}-%{release}
Requires: dotnet-targeting-pack-3.1 >= %{runtime_rpm_version}-%{release}
Requires: aspnetcore-targeting-pack-3.1 >= %{aspnetcore_runtime_rpm_version}-%{release}
Requires: netstandard-targeting-pack-2.1 >= %{sdk_rpm_version}-%{release}
Requires: dotnet-templates-3.1 >= %{sdk_rpm_version}-%{release}
%description -n dotnet-sdk-3.1
The .NET Core SDK is a collection of command line applications to
create, build, publish and run .NET Core applications.
.NET Core is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%global dotnet_targeting_pack() %{expand:
%package -n %{1}
Version: %{2}
Summary: Targeting Pack for %{3} %{4}
Requires: dotnet-host
%description -n %{1}
This package provides a targeting pack for %{3} %{4}
that allows developers to compile against and target %{3} %{4}
applications using the .NET Core SDK.
%files -n %{1}
%dir %{_libdir}/dotnet/packs
%{_libdir}/dotnet/packs/%{5}
}
%dotnet_targeting_pack dotnet-apphost-pack-3.1 %{runtime_rpm_version} Microsoft.NETCore.App 3.1 Microsoft.NETCore.App.Host.%{runtime_id}
%dotnet_targeting_pack dotnet-targeting-pack-3.1 %{runtime_rpm_version} Microsoft.NETCore.App 3.1 Microsoft.NETCore.App.Ref
%dotnet_targeting_pack aspnetcore-targeting-pack-3.1 %{aspnetcore_runtime_rpm_version} Microsoft.AspNetCore.App 3.1 Microsoft.AspNetCore.App.Ref
%dotnet_targeting_pack netstandard-targeting-pack-2.1 %{sdk_rpm_version} NETStandard.Library 2.1 NETStandard.Library.Ref
%package -n dotnet-sdk-3.1-source-built-artifacts
Version: %{sdk_rpm_version}
Summary: Internal package for building .NET Core 3.1 Software Development Kit
%description -n dotnet-sdk-3.1-source-built-artifacts
The .NET Core source-built archive is a collection of packages needed
to build the .NET Core SDK itself.
These are not meant for general use.
%prep
%setup -q -n dotnet-v%{src_version}-SDK%{?_with_bootstrap:-original}
# https://github.com/dotnet/source-build/issues/1689
find . -type f -exec touch {} +
%if %{without bootstrap}
# Remove all prebuilts
find -iname '*.dll' -type f -delete
find -iname '*.so' -type f -delete
find -iname '*.tar.gz' -type f -delete
find -iname '*.nupkg' -type f -delete
find -iname '*.zip' -type f -delete
rm -rf .dotnet/
rm -rf packages/source-built
%endif
%if %{without bootstrap}
sed -i -e 's|3.1.100-preview1-014459|3.1.103|' global.json
mkdir -p packages/archive
ln -s %{_libdir}/dotnet/source-built-artifacts/*.tar.gz packages/archive/
ln -s %{_libdir}/dotnet/reference-packages/Private.SourceBuild.ReferencePackages*.tar.gz packages/archive
%endif
# Fix bad hardcoded path in build
sed -i 's|/usr/share/dotnet|%{_libdir}/dotnet|' src/core-setup.*/src/corehost/common/pal.unix.cpp
# Disable warnings
sed -i 's|skiptests|skiptests ignorewarnings|' repos/coreclr.proj
%patch1 -p1
pushd src/corefx.*
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%if %{with identifier_platform_rosa}
%patch104 -p1
%endif
popd
pushd src/coreclr.*
#%%patch201 -p1
#%%patch202 -p1
popd
pushd src/core-setup.*
popd
pushd src/cli.*
%patch500 -p1
popd
# If CLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE is misisng, add it back
grep CLR_CMAKE_USE_SYSTEM_LIBUNWIND repos/coreclr.common.props || \
sed -i 's|\$(BuildArguments) </BuildArguments>|$(BuildArguments) cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE</BuildArguments>|' repos/coreclr.common.props
%if %{use_bundled_libunwind}
sed -i 's|-DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE|-DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=FALSE|' repos/coreclr.common.props
%endif
%ifnarch x86_64
mkdir -p artifacts/obj/%{runtime_arch}/Release
cp artifacts/obj/x64/Release/PackageVersions.props artifacts/obj/%{runtime_arch}/Release/PackageVersions.props
%endif
cat source-build-info.txt
find -iname 'nuget.config' -exec echo {}: \; -exec cat {} \; -exec echo \;
%build
cat /etc/os-release
%if %{without bootstrap}
# We need to create a copy because we will mutate this
cp -a %{_libdir}/dotnet previously-built-dotnet
pushd previously-built-dotnet
patch -p1 < %{P:501}
popd
%endif
%if 0%{?fedora} > 32 || 0%{?rhel} > 8
# Setting this macro ensures that only clang supported options will be
# added to ldflags and cflags.
%global toolchain clang
%set_build_flags
%else
# Filter flags not supported by clang
# -specs=
%global dotnet_cflags %(echo %optflags | sed -re 's/-specs=[^ ]*//g')
%global dotnet_ldflags %(echo %{__global_ldflags} | sed -re 's/-specs=[^ ]*//g') -ldl -pthread -lm
export CFLAGS="%{dotnet_cflags}"
export CXXFLAGS="%{dotnet_cflags}"
export LDFLAGS="%{dotnet_ldflags}"
%endif
%ifarch aarch64
# mbranch-protection=standard breaks unwinding in CoreCLR through libunwind
CFLAGS=$(echo $CFLAGS | sed -e 's/-mbranch-protection=standard //')
CXXFLAGS=$(echo $CXXFLAGS | sed -e 's/-mbranch-protection=standard //')
%endif
# fstack-clash-protection breaks CoreCLR
CFLAGS=$(echo $CFLAGS | sed -e 's/-fstack-clash-protection//' )
CXXFLAGS=$(echo $CXXFLAGS | sed -e 's/-fstack-clash-protection//' )
echo $CFLAGS
echo $CXXFLAGS
echo $LDFLAGS
#%%if %%{without bootstrap}
# --with-ref-packages %%{_libdir}/dotnet/reference-packages/ \
# --with-packages %%{_libdir}/dotnet/source-built-artifacts/*.tar.gz \
# --with-sdk %%{_libdir}/dotnet \
#%%endif
VERBOSE=1 ./build.sh \
%if %{without bootstrap}
--with-sdk previously-built-dotnet \
%endif
-- \
/v:n \
/p:SkipPortableRuntimeBuild=true \
/p:LogVerbosity=n \
/p:MinimalConsoleLogOutput=false \
/p:ContinueOnPrebuiltBaselineError=true
sed -e 's|[@]LIBDIR[@]|%{_libdir}|g' %{SOURCE2} > dotnet.sh
%install
install -dm 0755 %{buildroot}%{_libdir}/dotnet
ls artifacts/%{runtime_arch}/Release
tar xf artifacts/%{runtime_arch}/Release/dotnet-sdk-%{sdk_version}-%{runtime_id}.tar.gz -C %{buildroot}%{_libdir}/dotnet/
# Install managed symbols
tar xf artifacts/%{runtime_arch}/Release/runtime/dotnet-runtime-symbols-%{runtime_version}-%{runtime_id}.tar.gz \
-C %{buildroot}/%{_libdir}/dotnet/shared/Microsoft.NETCore.App/%{runtime_version}/
# Fix executable permissions on files
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.dll' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.pdb' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.props' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.pubxml' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.targets' -exec chmod -x {} \;
chmod 0755 %{buildroot}/%{_libdir}/dotnet/sdk/%{sdk_version}/AppHostTemplate/apphost
chmod 0755 %{buildroot}/%{_libdir}/dotnet/packs/Microsoft.NETCore.App.Host.%{runtime_id}/%{runtime_version}/runtimes/%{runtime_id}/native/libnethost.so
chmod 0755 %{buildroot}/%{_libdir}/dotnet/packs/Microsoft.NETCore.App.Host.%{runtime_id}/%{runtime_version}/runtimes/%{runtime_id}/native/apphost
chmod 0644 %{buildroot}/%{_libdir}/dotnet/packs/Microsoft.NETCore.App.Host.%{runtime_id}/%{runtime_version}/runtimes/%{runtime_id}/native/nethost.h
install -dm 0755 %{buildroot}%{_sysconfdir}/profile.d/
install dotnet.sh %{buildroot}%{_sysconfdir}/profile.d/
install -dm 0755 %{buildroot}/%{_datadir}/bash-completion/completions
# dynamic completion needs the file to be named the same as the base command
install src/cli.*/scripts/register-completions.bash %{buildroot}/%{_datadir}/bash-completion/completions/dotnet
# TODO: the zsh completion script needs to be ported to use #compdef
#install -dm 755 %%{buildroot}/%%{_datadir}/zsh/site-functions
#install src/cli/scripts/register-completions.zsh %%{buildroot}/%%{_datadir}/zsh/site-functions/_dotnet
install -dm 0755 %{buildroot}%{_bindir}
ln -s ../../%{_libdir}/dotnet/dotnet %{buildroot}%{_bindir}/
install -dm 0755 %{buildroot}%{_mandir}/man1/
find -iname 'dotnet*.1' -type f -exec cp {} %{buildroot}%{_mandir}/man1/ \;
echo "%{_libdir}/dotnet" >> install_location
install -dm 0755 %{buildroot}%{_sysconfdir}/dotnet
install install_location %{buildroot}%{_sysconfdir}/dotnet/
install -dm 0755 %{buildroot}%{_libdir}/dotnet/source-built-artifacts
install artifacts/%{runtime_arch}/Release/Private.SourceBuilt.Artifacts.*.tar.gz %{buildroot}/%{_libdir}/dotnet/source-built-artifacts/
# Check debug symbols in all elf objects. This is not in %%check
# because native binaries are stripped by rpm-build after %%install.
# So we need to do this check earlier.
echo "Testing build results for debug symbols..."
%{__python_3} %{SOURCE1} -v %{buildroot}%{_libdir}/dotnet/
%check
%{buildroot}%{_libdir}/dotnet/dotnet --info
%files -n dotnet
# empty package useful for dependencies
%files -n dotnet-host
%dir %{_libdir}/dotnet
%{_libdir}/dotnet/dotnet
%dir %{_libdir}/dotnet/host
%dir %{_libdir}/dotnet/host/fxr
%{_bindir}/dotnet
%license %{_libdir}/dotnet/LICENSE.txt
%license %{_libdir}/dotnet/ThirdPartyNotices.txt
%doc %{_mandir}/man1/dotnet*.1.xz
%{_sysconfdir}/profile.d/dotnet.sh
%{_sysconfdir}/dotnet
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/dotnet
%files -n dotnet-hostfxr-3.1
%dir %{_libdir}/dotnet/host/fxr
%{_libdir}/dotnet/host/fxr/%{host_version}
%files -n dotnet-runtime-3.1
%dir %{_libdir}/dotnet/shared
%dir %{_libdir}/dotnet/shared/Microsoft.NETCore.App
%{_libdir}/dotnet/shared/Microsoft.NETCore.App/%{runtime_version}
%files -n aspnetcore-runtime-3.1
%dir %{_libdir}/dotnet/shared
%dir %{_libdir}/dotnet/shared/Microsoft.AspNetCore.App
%{_libdir}/dotnet/shared/Microsoft.AspNetCore.App/%{aspnetcore_runtime_version}
%files -n dotnet-templates-3.1
%dir %{_libdir}/dotnet/templates
%{_libdir}/dotnet/templates/%{templates_version}
%files -n dotnet-sdk-3.1
%dir %{_libdir}/dotnet/sdk
%{_libdir}/dotnet/sdk/%{sdk_version}
%dir %{_libdir}/dotnet/packs
%files -n dotnet-sdk-3.1-source-built-artifacts
%dir %{_libdir}/dotnet
%{_libdir}/dotnet/source-built-artifacts

35
dotnet6.0.rpmlintrc Normal file
View file

@ -0,0 +1,35 @@
# Tarball is generated, no upstream URL
addFilter("W:.*invalid-url Source0: dotnet-.*tar.gz")
# macOS is the correct name
addFilter("W: spelling-error %description -l en_US macOS ->.*")
# The name of the nuget package includes NETCore
addFilter("W: spelling-error .* NETCore -> Net Core.*")
# Upstream really has no README or documentation files. They suggest using online resources.
addFilter("W: no-documentation")
# This is a script that we run; it's expected to have execute permissions
addFilter("W: strange-permission check-debug-symbols.py")
# libicu is a required dependency, but it's used via a dlopen()
addFilter("E: explicit-lib-dependency libicu")
# There's no devel package for us to place .h files
addFilter("W: devel-file-in-non-devel-package /usr/lib64/dotnet/.*\.h")
addFilter("W: devel-file-in-non-devel-package /usr/lib64/dotnet/.*\.a")
# These paths are non-standard, so we need $ORIGIN to find these libraries
addFilter("E: binary-or-shlib-defines-rpath /usr/lib64/dotnet/.*\['\$ORIGIN/netcoredeps'\]")
addFilter("E: binary-or-shlib-defines-rpath /usr/lib64/dotnet/.*\['\$ORIGIN'\]")
# We put dll files in /usr/lib/dotnet, but rpmlint somehow doesn't see it as a binary?
addFilter("W: only-non-binary-in-usr-lib")
# We use a number of zero-length files, including _._
addFilter("E: zero-length /usr/lib64/dotnet/.*/_\._")
# Upstream uses hidden files, even though we ask them not to, as much as possible
addFilter("W: hidden-file-or-dir /usr/lib64/dotnet/.*/\.version")
addFilter("W: hidden-file-or-dir /usr/lib64/dotnet/.*/\.toolsetversion")

593
dotnet6.0.spec Normal file
View file

@ -0,0 +1,593 @@
%bcond_with bootstrap
# Avoid provides/requires from private libraries
%global privlibs libhostfxr
%global privlibs %{privlibs}|libclrjit
%global privlibs %{privlibs}|libcoreclr
%global privlibs %{privlibs}|libcoreclrtraceptprovider
%global privlibs %{privlibs}|libdbgshim
%global privlibs %{privlibs}|libhostpolicy
%global privlibs %{privlibs}|libmscordaccore
%global privlibs %{privlibs}|libmscordbi
%global privlibs %{privlibs}|libsos
%global privlibs %{privlibs}|libsosplugin
%global __provides_exclude ^(%{privlibs})\\.so
%global __requires_exclude ^(%{privlibs})\\.so
# LTO triggers a compilation error for a source level issue. Given that LTO should not
# change the validity of any given source and the nature of the error (undefined enum), I
# suspect a generator program is mis-behaving in some way. This needs further debugging,
# until that's done, disable LTO. This has to happen before setting the flags below.
%define _lto_cflags %{nil}
%global host_version 6.0.6
%global runtime_version 6.0.6
%global aspnetcore_runtime_version %{runtime_version}
%global sdk_version 6.0.106
%global sdk_feature_band_version %(echo %{sdk_version} | sed -e 's|[[:digit:]][[:digit:]]$|00|')
%global templates_version %{runtime_version}
#%%global templates_version %%(echo %%{runtime_version} | awk 'BEGIN { FS="."; OFS="." } {print $1, $2, $3+1 }')
%global host_rpm_version %{host_version}
%global runtime_rpm_version %{runtime_version}
%global aspnetcore_runtime_rpm_version %{aspnetcore_runtime_version}
%global sdk_rpm_version %{sdk_version}
# upstream can update releases without revving the SDK version so these don't always match
%global upstream_tag v%{sdk_version}
%global use_bundled_libunwind 1
%ifarch x86_64
%global runtime_arch x64
%endif
%global runtime_id %{distsuffix}.%{rosa_release}*-%{runtime_arch}
Name: dotnet6.0
Version: %{sdk_rpm_version}
Release: 1
Summary: .NET Runtime and SDK
Group: Development/Other
License: MIT and ASL 2.0 and BSD and LGPLv2+ and CC-BY and CC0 and MS-PL and EPL-1.0 and GPL+ and GPLv2 and ISC and OFL and zlib
URL: https://github.com/dotnet/
# The source is generated on a Fedora box via:
# ./build-dotnet-tarball %%{upstream_tag}
Source0: dotnet-%{upstream_tag}.tar.gz
# The source is generated on a Fedora box via:
# ./build-dotnet-tarball --bootstrap %%{upstream_tag}
Source1: dotnet-%{upstream_tag}-x64-bootstrap.tar.xz
Source10: check-debug-symbols.py
Source11: dotnet.sh.in
Patch0: runtime-ROSA-rid.patch
# Fix using lld on Fedora
Patch100: runtime-arm64-lld-fix.patch
# Mono still has a dependency on (now unbuildable) ILStrip which was removed from CoreCLR: https://github.com/dotnet/runtime/pull/60315
Patch101: runtime-mono-remove-ilstrip.patch
# https://github.com/dotnet/runtime/pull/65392
Patch102: runtime-fedora-37-rid.patch
# https://github.com/dotnet/runtime/pull/66594
Patch103: runtime-66594-s390x-debuginfo.patch
# https://github.com/dotnet/command-line-api/pull/1401
Patch300: command-line-api-use-work-tree-with-git-apply.patch
# https://github.com/microsoft/vstest/pull/3046
Patch400: vstest-use-work-tree-with-git-apply.patch
# Disable apphost, needed for s390x
Patch500: fsharp-no-apphost.patch
# This is the suggestion from https://github.com/dotnet/source-build/pull/2450, applied
Patch600: xliff-tasks-use-work-tree-with-git-apply.patch
# Disable apphost, needed for s390x
Patch700: arcade-no-apphost.patch
# Named mutex fix for mono, needed for s390x. https://github.com/dotnet/roslyn/pull/57003
Patch800: roslyn-57003-mono-named-mutex.patch
# Disable apphost, needed for s390x
Patch801: roslyn-no-apphost.patch
# Disable apphost, needed for s390x
Patch900: roslyn-analyzers-no-apphost.patch
# 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.
Patch1000: msbuild-no-systemsecurity.patch
Patch1001: msbuild-no-systemconfiguration.patch
# Disable telemetry by default; make it opt-in
Patch1500: sdk-telemetry-optout.patch
# https://github.com/dotnet/sdk/pull/22373
Patch1501: sdk-22373-portablerid.patch
# https://github.com/dotnet/installer/pull/12516
Patch1600: installer-12516-portablerid.patch
ExclusiveArch: x86_64
BuildRequires: clang
BuildRequires: cmake
BuildRequires: coreutils
%if %{without bootstrap}
BuildRequires: dotnet-sdk-6.0
BuildRequires: dotnet-sdk-6.0-source-built-artifacts
%endif
BuildRequires: findutils
BuildRequires: git
BuildRequires: locales-en
BuildRequires: hostname
BuildRequires: krb5-devel
BuildRequires: pkgconfig(libcurl)
BuildRequires: icu-devel
%if ! %{use_bundled_libunwind}
BuildRequires: libunwind-devel
%endif
BuildRequires: %{_lib}lldb-devel
BuildRequires: llvm
BuildRequires: lttng-ust-devel
BuildRequires: make
BuildRequires: openssl-devel
BuildRequires: python3
BuildRequires: systemtap-sdt-devel
BuildRequires: tar
BuildRequires: zlib-devel
BuildRequires: which
%description
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, macOS and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
.NET contains a runtime conforming to .NET Standards a set of
framework libraries, an SDK containing compilers and a 'dotnet'
application to drive everything.
%package -n dotnet
Version: %{sdk_rpm_version}
Summary: .NET CLI tools and runtime
Requires: dotnet-sdk-6.0 >= %{sdk_rpm_version}-%{release}
%description -n dotnet
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, macOS and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
.NET contains a runtime conforming to .NET Standards a set of
framework libraries, an SDK containing compilers and a 'dotnet'
application to drive everything.
%package -n dotnet-host
Version: %{host_rpm_version}
Summary: .NET command line launcher
%description -n dotnet-host
The .NET host is a command line program that runs a standalone
.NET application or launches the SDK.
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n dotnet-hostfxr-6.0
Version: %{host_rpm_version}
Summary: .NET command line host resolver
# Theoretically any version of the host should work. But lets aim for the one
# provided by this package, or from a newer version of .NET
Requires: dotnet-host >= %{host_rpm_version}-%{release}
%description -n dotnet-hostfxr-6.0
The .NET host resolver contains the logic to resolve and select
the right version of the .NET SDK or runtime to use.
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n dotnet-runtime-6.0
Version: %{runtime_rpm_version}
Summary: NET 6.0 runtime
Requires: dotnet-hostfxr-6.0 >= %{host_rpm_version}-%{release}
# libicu is dlopen()ed
Requires: icu-devel
# See src/runtime/src/libraries/Native/AnyOS/brotli-version.txt
Provides: bundled(libbrotli) = 1.0.9
%if %{use_bundled_libunwind}
# See src/runtime/src/coreclr/pal/src/libunwind/libunwind-version.txt
Provides: bundled(libunwind) = 1.5.rc1.28.g9165d2a1
%endif
%description -n dotnet-runtime-6.0
The .NET runtime contains everything needed to run .NET applications.
It includes a high performance Virtual Machine as well as the framework
libraries used by .NET applications.
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n aspnetcore-runtime-6.0
Version: %{aspnetcore_runtime_rpm_version}
Summary: ASP.NET Core 6.0 runtime
Requires: dotnet-runtime-6.0 >= %{runtime_rpm_version}-%{release}
%description -n aspnetcore-runtime-6.0
The ASP.NET Core runtime contains everything needed to run .NET
web applications. It includes a high performance Virtual Machine as
well as the framework libraries used by .NET applications.
ASP.NET Core is a fast, lightweight and modular platform for creating
cross platform web applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n dotnet-templates-6.0
Version: %{sdk_rpm_version}
Summary: .NET 6.0 templates
# Theoretically any version of the host should work. But lets aim for the one
# provided by this package, or from a newer version of .NET
Requires: dotnet-host >= %{host_rpm_version}-%{release}
%description -n dotnet-templates-6.0
This package contains templates used by the .NET SDK.
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n dotnet-sdk-6.0
Version: %{sdk_rpm_version}
Summary: .NET 6.0 Software Development Kit
Provides: bundled(js-jquery)
Requires: dotnet-runtime-6.0 >= %{runtime_rpm_version}-%{release}
Requires: aspnetcore-runtime-6.0 >= %{aspnetcore_runtime_rpm_version}-%{release}
Requires: dotnet-apphost-pack-6.0 >= %{runtime_rpm_version}-%{release}
Requires: dotnet-targeting-pack-6.0 >= %{runtime_rpm_version}-%{release}
Requires: aspnetcore-targeting-pack-6.0 >= %{aspnetcore_runtime_rpm_version}-%{release}
Requires: netstandard-targeting-pack-2.1 >= %{sdk_rpm_version}-%{release}
Requires: dotnet-templates-6.0 >= %{sdk_rpm_version}-%{release}
%description -n dotnet-sdk-6.0
The .NET SDK is a collection of command line applications to
create, build, publish and run .NET applications.
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%global dotnet_targeting_pack() %{expand:
%package -n %{1}
Version: %{2}
Summary: Targeting Pack for %{3} %{4}
Requires: dotnet-host
%description -n %{1}
This package provides a targeting pack for %{3} %{4}
that allows developers to compile against and target %{3} %{4}
applications using the .NET SDK.
%files -n %{1}
%dir %{_libdir}/dotnet/packs
%{_libdir}/dotnet/packs/%{5}
}
%dotnet_targeting_pack dotnet-apphost-pack-6.0 %{runtime_rpm_version} Microsoft.NETCore.App 6.0 Microsoft.NETCore.App.Host.%{runtime_id}
%dotnet_targeting_pack dotnet-targeting-pack-6.0 %{runtime_rpm_version} Microsoft.NETCore.App 6.0 Microsoft.NETCore.App.Ref
%dotnet_targeting_pack aspnetcore-targeting-pack-6.0 %{aspnetcore_runtime_rpm_version} Microsoft.AspNetCore.App 6.0 Microsoft.AspNetCore.App.Ref
%dotnet_targeting_pack netstandard-targeting-pack-2.1 %{sdk_rpm_version} NETStandard.Library 2.1 NETStandard.Library.Ref
%package -n dotnet-sdk-6.0-source-built-artifacts
Version: %{sdk_rpm_version}
Summary: Internal package for building .NET 6.0 Software Development Kit
%description -n dotnet-sdk-6.0-source-built-artifacts
The .NET source-built archive is a collection of packages needed
to build the .NET SDK itself.
These are not meant for general use.
%prep
%if %{without bootstrap}
%setup -q -n dotnet-%{upstream_tag}
%else
tar xf %{S:1} -C $PWD
pushd dotnet-%{upstream_tag}-x64-bootstrap
%endif
%if %{without bootstrap}
# Remove all prebuilts
find -iname '*.dll' -type f -delete
find -iname '*.so' -type f -delete
find -iname '*.tar.gz' -type f -delete
find -iname '*.nupkg' -type f -delete
find -iname '*.zip' -type f -delete
rm -rf .dotnet/
rm -rf packages/source-built
mkdir -p packages/archive
ln -s %{_libdir}/dotnet/source-built-artifacts/Private.SourceBuilt.Artifacts.*.tar.gz packages/archive/
ln -s %{_libdir}/dotnet/reference-packages/Private.SourceBuild.ReferencePackages*.tar.gz packages/archive/
%endif
# Fix bad hardcoded path in build
sed -i 's|/usr/share/dotnet|%{_libdir}/dotnet|' src/runtime/src/native/corehost/hostmisc/pal.unix.cpp
pushd src/runtime
%patch0 -p2
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
popd
pushd src/command-line-api
%patch300 -p1
popd
pushd src/vstest
%patch400 -p1
popd
pushd src/fsharp
%patch500 -p1
popd
pushd src/xliff-tasks
%patch600 -p1
popd
pushd src/arcade
%patch700 -p1
popd
pushd src/roslyn
%patch800 -p3
%patch801 -p1
popd
pushd src/roslyn-analyzers
%patch900 -p1
popd
pushd src/sdk
%patch1500 -p1
%patch1501 -p1
popd
pushd src/installer
%patch1600 -p1
popd
%if ! %{use_bundled_libunwind}
sed -i -E 's|( /p:BuildDebPackage=false)|\1 --cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE|' src/runtime/eng/SourceBuild.props
%endif
%build
%if %{with bootstrap}
pushd dotnet-%{upstream_tag}-x64-bootstrap
%endif
cat /etc/os-release
%if %{without bootstrap}
# We need to create a copy because we will mutate this
cp -a %{_libdir}/dotnet previously-built-dotnet
find previously-built-dotnet
%endif
# Filter flags not supported by clang
%global dotnet_cflags %(echo %optflags | sed -re 's/-specs=[^ ]*//g')
%global dotnet_ldflags %(echo %{__global_ldflags} | sed -re 's/-specs=[^ ]*//g')
export CFLAGS="%{dotnet_cflags}"
export CXXFLAGS="%{dotnet_cflags}"
export LDFLAGS="%{dotnet_ldflags}"
# -fstack-clash-protection breaks CoreCLR
CFLAGS=$(echo $CFLAGS | sed -e 's/-fstack-clash-protection//' )
CXXFLAGS=$(echo $CXXFLAGS | sed -e 's/-fstack-clash-protection//' )
export EXTRA_CFLAGS="$CFLAGS"
export EXTRA_CXXFLAGS="$CXXFLAGS"
export EXTRA_LDFLAGS="$LDFLAGS"
# Disable tracing, which is incompatible with certain versions of
# lttng See https://github.com/dotnet/runtime/issues/57784. The
# suggested compile-time change doesn't work, unfortunately.
export COMPlus_LTTng=0
VERBOSE=1 ./build.sh \
%if %{without bootstrap}
--with-sdk previously-built-dotnet \
%endif
-- \
echo \
/v:n \
/p:SkipPortableRuntimeBuild=true \
/p:LogVerbosity=n \
/p:MinimalConsoleLogOutput=false \
/p:ContinueOnPrebuiltBaselineError=true \
sed -e 's|[@]LIBDIR[@]|%{_libdir}|g' %{SOURCE11} > dotnet.sh
%install
%if %{with bootstrap}
pushd dotnet-%{upstream_tag}-x64-bootstrap
%endif
install -dm 0755 %{buildroot}%{_libdir}/dotnet
ls artifacts/%{runtime_arch}/Release
tar xf artifacts/%{runtime_arch}/Release/dotnet-sdk-%{sdk_version}-%{runtime_id}.tar.gz -C %{buildroot}%{_libdir}/dotnet/
# See https://github.com/dotnet/source-build/issues/2579
find %{buildroot}%{_libdir}/dotnet/ -type f -name 'testhost.x86' -delete
find %{buildroot}%{_libdir}/dotnet/ -type f -name 'vstest.console' -delete
# Install managed symbols: disabled because they don't contain sources
# but point to the paths the sources would have been at in the build
# servers. The end user experience is pretty bad atm.
# tar xf artifacts/%%{runtime_arch}/Release/runtime/dotnet-runtime-symbols-%%{runtime_id}-%%{runtime_version}.tar.gz \
# -C %%{buildroot}/%%{_libdir}/dotnet/shared/Microsoft.NETCore.App/%%{runtime_version}/
# Fix executable permissions on files
find %{buildroot}%{_libdir}/dotnet/ -type f -name 'apphost' -exec chmod +x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name 'singlefilehost' -exec chmod +x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name 'lib*so' -exec chmod +x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.a' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.dll' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.h' -exec chmod 0644 {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.json' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.pdb' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.props' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.pubxml' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.targets' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.txt' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.xml' -exec chmod -x {} \;
install -dm 0755 %{buildroot}%{_sysconfdir}/profile.d/
install dotnet.sh %{buildroot}%{_sysconfdir}/profile.d/
install -dm 0755 %{buildroot}/%{_datadir}/bash-completion/completions
# dynamic completion needs the file to be named the same as the base command
install src/sdk/scripts/register-completions.bash %{buildroot}/%{_datadir}/bash-completion/completions/dotnet
# TODO: the zsh completion script needs to be ported to use #compdef
#install -dm 755 %%{buildroot}/%%{_datadir}/zsh/site-functions
#install src/cli/scripts/register-completions.zsh %%{buildroot}/%%{_datadir}/zsh/site-functions/_dotnet
install -dm 0755 %{buildroot}%{_bindir}
ln -s ../../%{_libdir}/dotnet/dotnet %{buildroot}%{_bindir}/
install -dm 0755 %{buildroot}%{_mandir}/man1/
find -iname 'dotnet*.1' -type f -exec cp {} %{buildroot}%{_mandir}/man1/ \;
install -dm 0755 %{buildroot}%{_sysconfdir}/dotnet
echo "%{_libdir}/dotnet" >> install_location
install install_location %{buildroot}%{_sysconfdir}/dotnet/
echo "%{_libdir}/dotnet" >> install_location_%{runtime_arch}
install install_location_%{runtime_arch} %{buildroot}%{_sysconfdir}/dotnet/
install -dm 0755 %{buildroot}%{_libdir}/dotnet/source-built-artifacts
install -m 0644 artifacts/%{runtime_arch}/Release/Private.SourceBuilt.Artifacts.*.tar.gz %{buildroot}/%{_libdir}/dotnet/source-built-artifacts/
# Quick and dirty check for https://github.com/dotnet/source-build/issues/2731
test -f %{buildroot}%{_libdir}/dotnet/sdk/%{sdk_version}/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props
# Check debug symbols in all elf objects. This is not in %%check
# because native binaries are stripped by rpm-build after %%install.
# So we need to do this check earlier.
echo "Testing build results for debug symbols..."
%{__python3} %{SOURCE10} -v %{buildroot}%{_libdir}/dotnet/
%check
%{buildroot}%{_libdir}/dotnet/dotnet --info
%{buildroot}%{_libdir}/dotnet/dotnet --version
%files -n dotnet
# empty package useful for dependencies
%files -n dotnet-host
%dir %{_libdir}/dotnet
%{_libdir}/dotnet/dotnet
%dir %{_libdir}/dotnet/host
%dir %{_libdir}/dotnet/host/fxr
%{_bindir}/dotnet
%license %{_libdir}/dotnet/LICENSE.txt
%license %{_libdir}/dotnet/ThirdPartyNotices.txt
%doc %{_mandir}/man?/dotnet*.?.*
%config(noreplace) %{_sysconfdir}/profile.d/dotnet.sh
%config(noreplace) %{_sysconfdir}/dotnet
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/dotnet
%files -n dotnet-hostfxr-6.0
%dir %{_libdir}/dotnet/host/fxr
%{_libdir}/dotnet/host/fxr/%{host_version}
%files -n dotnet-runtime-6.0
%dir %{_libdir}/dotnet/shared
%dir %{_libdir}/dotnet/shared/Microsoft.NETCore.App
%{_libdir}/dotnet/shared/Microsoft.NETCore.App/%{runtime_version}
%files -n aspnetcore-runtime-6.0
%dir %{_libdir}/dotnet/shared
%dir %{_libdir}/dotnet/shared/Microsoft.AspNetCore.App
%{_libdir}/dotnet/shared/Microsoft.AspNetCore.App/%{aspnetcore_runtime_version}
%files -n dotnet-templates-6.0
%dir %{_libdir}/dotnet/templates
%{_libdir}/dotnet/templates/%{templates_version}
%files -n dotnet-sdk-6.0
%dir %{_libdir}/dotnet/sdk
%{_libdir}/dotnet/sdk/%{sdk_version}
%dir %{_libdir}/dotnet/sdk-manifests
%{_libdir}/dotnet/sdk-manifests/%{sdk_feature_band_version}
%{_libdir}/dotnet/metadata
%dir %{_libdir}/dotnet/packs
%files -n dotnet-sdk-6.0-source-built-artifacts
%dir %{_libdir}/dotnet
%{_libdir}/dotnet/source-built-artifacts

21
fsharp-no-apphost.patch Normal file
View file

@ -0,0 +1,21 @@
--- a/tests/benchmarks/MicroPerf/MicroPerf.fsproj
+++ b/tests/benchmarks/MicroPerf/MicroPerf.fsproj
@@ -9,6 +9,7 @@
<OtherFlags>$(OtherFlags) --nowarn:57</OtherFlags>
<OtherFlags>$(OtherFlags) --langversion:preview</OtherFlags>
<OtherFlags>$(OtherFlags) --define:PREVIEW</OtherFlags>
+ <UseAppHost>false</UseAppHost>
<!-- By default this project will compile with the proto compiler -->
<!-- Uncommenting this will build with a previous installed compiler -->
<!--
--- a/tests/benchmarks/TaskPerf/TaskPerf.fsproj
+++ b/tests/benchmarks/TaskPerf/TaskPerf.fsproj
@@ -4,6 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
+ <UseAppHost>false</UseAppHost>
<!-- Turn off "This function is for use by compiled F# code and should not be used directly" -->
<OtherFlags>$(OtherFlags) --nowarn:1204</OtherFlags>
<!-- Turn off "Experimental" -->

View file

@ -0,0 +1,11 @@
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -15,7 +15,7 @@
</ItemGroup>
<Exec
- Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
+ Command="git --work-tree=&quot;$(RepoRoot)&quot; apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(RepoRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>

View file

@ -0,0 +1,23 @@
From 892222071f73062f969f4f6ed1df8f759b9327b7 Mon Sep 17 00:00:00 2001
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Wed, 3 Nov 2021 15:12:59 +0100
Subject: [PATCH] GetRuntimeInformation.targets: determine
PortableProductMonikerRid based on HostOSName and Architecture.
---
src/redist/targets/GetRuntimeInformation.targets | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/redist/targets/GetRuntimeInformation.targets b/src/redist/targets/GetRuntimeInformation.targets
index 5133c3a3841..01f704c7d8e 100644
--- a/src/redist/targets/GetRuntimeInformation.targets
+++ b/src/redist/targets/GetRuntimeInformation.targets
@@ -28,6 +28,8 @@
'$(Rid)' == 'linux-musl-x64' ">$(Rid)</ProductMonikerRid>
<ProductMonikerRid Condition=" '$(ProductMonikerRid)' == '' ">$(OSName)-$(Architecture)</ProductMonikerRid>
+ <PortableProductMonikerRid Condition=" '$(PortableProductMonikerRid)' == '' ">$(HostOSName)-$(Architecture)</PortableProductMonikerRid>
+
<ArtifactNameSdk>dotnet-sdk-internal$(PgoTerm)</ArtifactNameSdk>
<ArtifactNameCombinedHostHostFxrFrameworkSdk>dotnet-sdk$(PgoTerm)</ArtifactNameCombinedHostHostFxrFrameworkSdk>

View file

@ -0,0 +1,46 @@
--- a/src/Build/Definition/ProjectCollection.cs
+++ b/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<string, Toolset>(StringComparer.OrdinalIgnoreCase);
--- a/src/Build/Definition/ToolsetReader.cs
+++ b/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<ProjectPropertyInstance> environmentProperties,
PropertyDictionary<ProjectPropertyInstance> 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;

View file

@ -0,0 +1,12 @@
--- a/src/Shared/ExceptionHandling.cs
+++ b/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
}

51
rename-tarball Executable file
View file

@ -0,0 +1,51 @@
#!/bin/bash
# Usage:
# ./rename-tarball original-name.tar.gz new-name.tar.gz
set -euo pipefail
IFS=$'\n\t'
positional_args=()
while [[ "$#" -gt 0 ]]; do
arg="${1}"
case "${arg}" in
-h|--help)
print_usage
exit 0
;;
*)
positional_args+=("$1")
shift
;;
esac
done
if [[ -z "${positional_args[0]:-}" ]]; then
echo "error: missing original tarball name"
exit 1
fi
original_path=$(readlink -f "${positional_args[0]:-}")
original_name=$(basename "$original_path")
new_name=${positional_args[1]:-}
if [[ -z ${new_name} ]]; then
echo "error: missing new tarball name"
exit 1
fi
original_name=${original_name/%.tar.gz}
new_name=${new_name/.tar.gz}
echo "Original: ${original_name}.tar.gz"
echo "New name: ${new_name}.tar.gz"
mkdir "temp-${new_name}"
pushd "temp-${new_name}"
tar xf "${original_path}"
mv -- * "${new_name}"
tar czf ../"${new_name}.tar.gz" "${new_name}"
rm -rf "${new_name}"
popd
rmdir "temp-${new_name}"

View file

@ -0,0 +1,453 @@
Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs
===================================================================
--- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs
+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs
@@ -31,5 +31,24 @@ namespace Roslyn.Utilities
}
}
}
+ /// <summary>
+ /// 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.
+ /// </summary>
+ public static bool IsUsingMonoRuntime
+ {
+ get
+ {
+ try
+ {
+ return !(Type.GetType("Mono.RuntimeStructs", throwOnError: false) is null);
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
}
}
Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs
===================================================================
--- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs
+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs
@@ -79,7 +79,7 @@ namespace Microsoft.CodeAnalysis.Compile
// 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))
{
Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs
===================================================================
--- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs
+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs
@@ -103,7 +103,7 @@ class Hello
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 @@ class Hello
}
finally
{
- mutex.ReleaseMutex();
+ mutex.Dispose();
}
}
}
Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs
===================================================================
--- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs
+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs
@@ -304,7 +304,7 @@ End Module")
var newTempDir = _tempDirectory.CreateDirectory(new string('a', 100 - _tempDirectory.Path.Length));
await ApplyEnvironmentVariables(
new[] { new KeyValuePair<string, string>("TMPDIR", newTempDir.Path) },
- async () =>
+ async () => await Task.Run(async () =>
{
using var serverData = await ServerUtil.CreateServer(_logger);
var result = RunCommandLineCompiler(
@@ -317,7 +317,7 @@ End Module")
var listener = await serverData.Complete();
Assert.Equal(CompletionData.RequestCompleted, listener.CompletionDataList.Single());
- });
+ }));
}
[Fact]
Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs
===================================================================
--- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs
+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs
@@ -101,7 +101,7 @@ namespace Microsoft.CodeAnalysis.Compile
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 @@ namespace Microsoft.CodeAnalysis.Compile
stream.Close();
doneMre.WaitOne();
- mutex.ReleaseMutex();
+ mutex.Dispose();
}
});
@@ -153,7 +153,7 @@ namespace Microsoft.CodeAnalysis.Compile
{
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 @@ namespace Microsoft.CodeAnalysis.Compile
// 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();
Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Shared/BuildServerConnection.cs
===================================================================
--- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Shared/BuildServerConnection.cs
+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Shared/BuildServerConnection.cs
@@ -543,19 +543,10 @@ namespace Microsoft.CodeAnalysis.Command
{
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 @@ namespace Microsoft.CodeAnalysis.Command
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 @@ namespace Microsoft.CodeAnalysis.Command
}
/// <summary>
- /// 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.
/// </summary>
- 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 @@ namespace Microsoft.CodeAnalysis.Command
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)
+ /// <summary>
+ /// 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.
+ /// </summary>
+ 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");
+ }
+
+ /// <summary>
+ /// 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.
+ /// </summary>
+ 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;
+ }
+
+ /// <summary>
+ /// Release the lock by deleting the lock file and disposing "Stream".
+ /// </summary>
+ 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 @@ namespace Microsoft.CodeAnalysis.Command
}
}
}
-
- /// <summary>
- /// 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.
- /// </summary>
- 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();
- }
- }
- }
-
}

View file

@ -0,0 +1,10 @@
--- a/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj
+++ b/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj
@@ -4,6 +4,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<NonShipping>true</NonShipping>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis" Version="$(MicrosoftCodeAnalysisVersion)" />

10
roslyn-no-apphost.patch Normal file
View file

@ -0,0 +1,10 @@
--- a/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj
+++ b/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj
@@ -5,6 +5,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<!-- The purpose of this project is to include all dependecies of Microsoft.CodeAnalysis.Remote.ServiceHub targeting .Net Core -->
+ <UseAppHost>false</UseAppHost>
<IsShipping>false</IsShipping>
</PropertyGroup>
<ItemGroup>

View file

@ -0,0 +1,29 @@
diff --git a/src/mono/mono.proj b/src/mono/mono.proj
index fb98ffc1896..d6a0c9a8ec2 100644
--- a/src/mono/mono.proj
+++ b/src/mono/mono.proj
@@ -519,17 +519,17 @@
<!-- if all else fails in finding a valid objcopy, fall back to no-prefix from $PATH (used for x64 on CentOS) -->
<_Objcopy Condition="'$(_ObjcopyFound)' != '0'">objcopy</_Objcopy>
</PropertyGroup>
- <ItemGroup>
+ <ItemGroup Condition="'$(KeepNativeSymbols)' != 'true'">
<FilesToStrip Include="$(_MonoRuntimeFilePath)" />
<FilesToStrip Include="$([System.IO.Directory]::GetParent($(_MonoRuntimeFilePath)))\libmono-component-*$(SharedLibExt)" />
<FilesToStrip Include="$([System.IO.Directory]::GetParent($(_MonoRuntimeFilePath)))\Mono*framework\**\Mono*" Exclude="$([System.IO.Directory]::GetParent($(_MonoRuntimeFilePath)))\Mono*framework\**\*.dwarf" />
</ItemGroup>
- <Message Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ($([MSBuild]::IsOSPlatform('OSX')) or $([MSBuild]::IsOSPlatform('Linux')))" Text="Stripping debug symbols from %(FilesToStrip.Identity)" Importance="High"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true')" Command="dsymutil --flat --minimize %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true')" Command="strip -no_code_signature_warning -S %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --only-keep-debug %(FilesToStrip.Identity) %(FilesToStrip.Identity).dbg" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --strip-unneeded %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --add-gnu-debuglink=%(FilesToStrip.Identity).dbg %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Message Condition="'@(FilesToStrip)' != '' and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ($([MSBuild]::IsOSPlatform('OSX')) or $([MSBuild]::IsOSPlatform('Linux')))" Text="Stripping debug symbols from %(FilesToStrip.Identity)" Importance="High"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true')" Command="dsymutil --flat --minimize %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true')" Command="strip -no_code_signature_warning -S %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --only-keep-debug %(FilesToStrip.Identity) %(FilesToStrip.Identity).dbg" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --strip-unneeded %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --add-gnu-debuglink=%(FilesToStrip.Identity).dbg %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
</Target>
<!-- Build AOT cross compiler (if available) -->

191
runtime-ROSA-rid.patch Normal file
View file

@ -0,0 +1,191 @@
--- src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json 2022-07-01 07:47:48.852264765 +0300
+++ src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json-diff 2022-07-01 08:35:27.637855488 +0300
@@ -2408,6 +2408,57 @@
"rhel-x64"
]
},
+ "rosa": {
+ "#import": [
+ "linux"
+ ]
+ },
+ "rosa-arm64": {
+ "#import": [
+ "rosa",
+ "linux-arm64"
+ ]
+ },
+ "rosa-x64": {
+ "#import": [
+ "rosa",
+ "linux-x64"
+ ]
+ },
+ "rosa.2019.05": {
+ "#import": [
+ "rosa"
+ ]
+ },
+ "rosa.2019.05-arm64": {
+ "#import": [
+ "rosa.2019.05",
+ "rosa-arm64"
+ ]
+ },
+ "rosa.2019.05-x64": {
+ "#import": [
+ "rosa.2019.05",
+ "rosa-x64"
+ ]
+ },
+ "rosa.2021.1": {
+ "#import": [
+ "rosa"
+ ]
+ },
+ "rosa.2021.1-arm64": {
+ "#import": [
+ "rosa.2021.1",
+ "rosa-arm64"
+ ]
+ },
+ "rosa.2021.1-x64": {
+ "#import": [
+ "rosa.2021.1",
+ "rosa-x64"
+ ]
+ },
"sles": {
"#import": [
"linux"
@@ -3766,4 +3817,4 @@
]
}
}
-}
\ В конце файла нет новой строки
+}
--- src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props 2022-07-01 07:47:48.854264756 +0300
+++ src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props-diff 2022-07-01 08:31:12.759936289 +0300
@@ -215,6 +215,13 @@
<Versions>9</Versions>
</RuntimeGroup>
+ <RuntimeGroup Include="rosa">
+ <Parent>linux</Parent>
+ <Architectures>x64;arm64</Architectures>
+ <Versions>2021.1;2019.05</Versions>
+ <TreatVersionsAsCompatible>false</TreatVersionsAsCompatible>
+ </RuntimeGroup>
+
<RuntimeGroup Include="sles">
<Parent>linux</Parent>
<Architectures>x64</Architectures>
--- src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json 2022-07-01 07:47:48.852264765 +0300
+++ src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json-diff 2022-07-01 08:40:44.789733576 +0300
@@ -6020,6 +6020,98 @@
"any",
"base"
],
+
+ "rosa": [
+ "rosa",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa-arm64": [
+ "rosa-arm64",
+ "rosa",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa-x64": [
+ "rosa-x64",
+ "rosa",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2019.05": [
+ "rosa.2019.05",
+ "rosa",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2019.05-arm64": [
+ "rosa.2019.05-arm64",
+ "rosa.2019.05",
+ "rosa-arm64",
+ "rosa",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2019.05-x64": [
+ "rosa.2019.05-x64",
+ "rosa.2019.05",
+ "rosa-x64",
+ "rosa",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2021.1": [
+ "rosa.2021.1",
+ "rosa",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2021.1-arm64": [
+ "rosa.2021.1-arm64",
+ "rosa.2021.1",
+ "rosa-arm64",
+ "rosa",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2021.1-x64": [
+ "rosa.2021.1-x64",
+ "rosa.2021.1",
+ "rosa-x64",
+ "rosa",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
"sles": [
"sles",
"linux",
@@ -8921,4 +9013,4 @@
"any",
"base"
]
-}
\ В конце файла нет новой строки
+}

View file

@ -0,0 +1,196 @@
diff --git a/dotnet-v5.0.209.1-SDK/src/runtime.7211aa01b34bb55ca67bdddd6e80ce23ee201bd2/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json b/dotnet-v5.0.209.1-SDK-diff/src/runtime.7211aa01b34bb55ca67bdddd6e80ce23ee201bd2/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json
index 844590f..35d11f8 100644
--- a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json
+++ b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json
@@ -4808,6 +4808,97 @@
"any",
"base"
],
+ "rosa": [
+ "rosa",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa-arm64": [
+ "rosa-arm64",
+ "rosa",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa-x64": [
+ "rosa-x64",
+ "rosa",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2019.05": [
+ "rosa.2019.05",
+ "rosa",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2019.05-arm64": [
+ "rosa.2019.05-arm64",
+ "rosa.2019.05",
+ "rosa-arm64",
+ "rosa",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2019.05-x64": [
+ "rosa.2019.05-x64",
+ "rosa.2019.05",
+ "rosa-x64",
+ "rosa",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2021.1": [
+ "rosa.2021.1",
+ "rosa",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2021.1-arm64": [
+ "rosa.2021.1-arm64",
+ "rosa.2021.1",
+ "rosa-arm64",
+ "rosa",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "rosa.2021.1-x64": [
+ "rosa.2021.1-x64",
+ "rosa.2021.1",
+ "rosa-x64",
+ "rosa",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
"sles": [
"sles",
"linux",
@@ -7239,4 +7330,4 @@
"any",
"base"
]
-}
\ No newline at end of file
+}
diff --git a/dotnet-v5.0.209.1-SDK/src/runtime.7211aa01b34bb55ca67bdddd6e80ce23ee201bd2/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.json b/dotnet-v5.0.209.1-SDK-diff/src/runtime.7211aa01b34bb55ca67bdddd6e80ce23ee201bd2/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.json
index 7d6aa10..9c56b1b 100644
--- a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.json
+++ b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.json
@@ -2030,6 +2030,57 @@
"rhel-x64"
]
},
+ "rosa": {
+ "#import": [
+ "linux"
+ ]
+ },
+ "rosa-arm64": {
+ "#import": [
+ "rosa",
+ "linux-arm64"
+ ]
+ },
+ "rosa-x64": {
+ "#import": [
+ "rosa",
+ "linux-x64"
+ ]
+ },
+ "rosa.2019.05": {
+ "#import": [
+ "rosa"
+ ]
+ },
+ "rosa.2019.05-arm64": {
+ "#import": [
+ "rosa.2019.05",
+ "rosa-arm64"
+ ]
+ },
+ "rosa.2019.05-x64": {
+ "#import": [
+ "rosa.2019.05",
+ "rosa-x64"
+ ]
+ },
+ "rosa.2021.1": {
+ "#import": [
+ "rosa"
+ ]
+ },
+ "rosa.2021.1-arm64": {
+ "#import": [
+ "rosa.2021.1",
+ "rosa-arm64"
+ ]
+ },
+ "rosa.2021.1-x64": {
+ "#import": [
+ "rosa.2021.1",
+ "rosa-x64"
+ ]
+ },
"sles": {
"#import": [
"linux"
@@ -3196,4 +3247,4 @@
]
}
}
-}
\ No newline at end of file
+}
diff --git a/dotnet-v5.0.209.1-SDK/src/runtime.7211aa01b34bb55ca67bdddd6e80ce23ee201bd2/src/libraries/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props b/dotnet-v5.0.209.1-SDK-diff/src/runtime.7211aa01b34bb55ca67bdddd6e80ce23ee201bd2/src/libraries/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props
index 3cb3d2d..9bc7f0d 100644
--- a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props
+++ b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props
@@ -187,6 +187,13 @@
<Versions>9</Versions>
</RuntimeGroup>
+ <RuntimeGroup Include="rosa">
+ <Parent>linux</Parent>
+ <Architectures>x64;arm64</Architectures>
+ <Versions>2021.1;2019.05</Versions>
+ <TreatVersionsAsCompatible>false</TreatVersionsAsCompatible>
+ </RuntimeGroup>
+
<RuntimeGroup Include="sles">
<Parent>linux</Parent>
<Architectures>x64</Architectures>

View file

@ -0,0 +1,18 @@
diff --git a/eng/native/init-compiler.sh b/eng/native/init-compiler.sh
index 567d18da474..927b3071e92 100755
--- a/eng/native/init-compiler.sh
+++ b/eng/native/init-compiler.sh
@@ -108,11 +108,8 @@
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

View file

@ -0,0 +1,84 @@
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json
index bf6dfc3c1a1..1de4979b8ee 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json
@@ -3029,6 +3029,38 @@
"any",
"base"
],
+ "fedora.37": [
+ "fedora.37",
+ "fedora",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "fedora.37-arm64": [
+ "fedora.37-arm64",
+ "fedora.37",
+ "fedora-arm64",
+ "fedora",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "fedora.37-x64": [
+ "fedora.37-x64",
+ "fedora.37",
+ "fedora-x64",
+ "fedora",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
"freebsd": [
"freebsd",
"unix",
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
index 2e6ec616b74..70a1582ba64 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
@@ -1146,6 +1146,23 @@
"fedora-x64"
]
},
+ "fedora.37": {
+ "#import": [
+ "fedora"
+ ]
+ },
+ "fedora.37-arm64": {
+ "#import": [
+ "fedora.37",
+ "fedora-arm64"
+ ]
+ },
+ "fedora.37-x64": {
+ "#import": [
+ "fedora.37",
+ "fedora-x64"
+ ]
+ },
"freebsd": {
"#import": [
"unix"
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props
index 1945bb9af0e..75c6d28a30f 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props
@@ -71,7 +71,7 @@
<RuntimeGroup Include="fedora">
<Parent>linux</Parent>
<Architectures>x64;arm64</Architectures>
- <Versions>23;24;25;26;27;28;29;30;31;32;33;34;35;36</Versions>
+ <Versions>23;24;25;26;27;28;29;30;31;32;33;34;35;36;37</Versions>
<TreatVersionsAsCompatible>false</TreatVersionsAsCompatible>
</RuntimeGroup>

View file

@ -0,0 +1,33 @@
diff --git a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj
index 724b704f864..3dabdc81dae 100644
--- a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj
+++ b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj
@@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
- <ProjectReference Include="$(RepoTasksDir)ILStripTask\ILStrip.csproj" />
+ <ProjectReference Include="$(RepoTasksDir)ILStripTask\ILStrip.csproj" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<ProjectReference Include="$(RepoTasksDir)RuntimeConfigParser\RuntimeConfigParser.csproj" />
<ProjectReference Include="$(RepoTasksDir)JsonToItemsTaskFactory\JsonToItemsTaskFactory.csproj" />
</ItemGroup>
@@ -15,7 +15,7 @@
<PackageFile Include="Sdk\Sdk.props" TargetPath="Sdk" />
<PackageFile Include="Sdk\Sdk.targets" TargetPath="Sdk" />
<PackageFile Include="build\$(MSBuildProjectName).props" TargetPath="build" />
- <PackageFile Include="Sdk\ILStripTask.props" TargetPath="Sdk" />
+ <PackageFile Include="Sdk\ILStripTask.props" TargetPath="Sdk" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<PackageFile Include="Sdk\RuntimeConfigParserTask.props" TargetPath="Sdk" />
<PackageFile Include="Sdk\RuntimeComponentManifest.props" TargetPath="Sdk" />
<PackageFile Include="Sdk\RuntimeComponentManifest.targets" TargetPath="Sdk" />
diff --git a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props
index 8a7ede79242..cfd515eeca9 100644
--- a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props
+++ b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props
@@ -1,5 +1,5 @@
<Project>
- <Import Project="$(MSBuildThisFileDirectory)\ILStripTask.props" />
+ <Import Project="$(MSBuildThisFileDirectory)\ILStripTask.props" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<Import Project="$(MSBuildThisFileDirectory)\RuntimeConfigParserTask.props" />
<Import Project="$(MSBuildThisFileDirectory)\RuntimeComponentManifest.props" />
</Project>

View file

@ -0,0 +1,22 @@
From 499fcf6e3b0e4b01a9c340a06f00cfc3e1fcc5d2 Mon Sep 17 00:00:00 2001
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Tue, 5 Oct 2021 09:04:14 +0200
Subject: [PATCH] Use the portable rid for --use-current-runtime.
---
.../targets/Microsoft.NET.RuntimeIdentifierInference.targets | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
index 17308aa9160..e764b2d9845 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
@@ -62,7 +62,7 @@ Copyright (c) .NET Foundation. All rights reserved.
</PropertyGroup>
<PropertyGroup Condition="'$(UseCurrentRuntimeIdentifier)' == 'true'">
- <RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
+ <RuntimeIdentifier>$(NETCoreSdkPortableRuntimeIdentifier)</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition="'$(PlatformTarget)' == ''">

View file

@ -1,7 +1,7 @@
diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs
diff --git a/src/Cli/dotnet/Program.cs b/src/Cli/dotnet/Program.cs
index de1ebb9e6..6bbf479de 100644
--- a/src/dotnet/Program.cs
+++ b/src/dotnet/Program.cs
--- a/src/Cli/dotnet/Program.cs
+++ b/src/Cli/dotnet/Program.cs
@@ -28,6 +28,13 @@ public class Program
public static int Main(string[] args)
@ -15,4 +15,4 @@ index de1ebb9e6..6bbf479de 100644
+
DebugHelper.HandleDebugSwitch(ref args);
new MulticoreJitActivator().TryActivateMulticoreJit();
// Capture the current timestamp to calculate the host overhead.

View file

@ -1,21 +0,0 @@
From c82976fd5eb4cbcf67faaba62f0bc59634d30338 Mon Sep 17 00:00:00 2001
From: Chris Rummel <crummel@microsoft.com>
Date: Fri, 14 Aug 2020 15:34:07 -0500
Subject: [PATCH] Disable XLiff warning as error
---
repos/xliff-tasks.proj | 1 +
1 file changed, 1 insertion(+)
diff --git a/repos/xliff-tasks.proj b/repos/xliff-tasks.proj
index da2ae79c5b..9b86754018 100644
--- a/repos/xliff-tasks.proj
+++ b/repos/xliff-tasks.proj
@@ -7,6 +7,7 @@
<BuildCommandArgs>$(BuildCommandArgs) /v:$(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /flp:Verbosity=Diag</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /bl</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:TreatWarningsAsErrors=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(RedirectRepoOutputToLog)</BuildCommandArgs>
<BuildCommand>$(DotnetToolCommand) $(BuildCommandArgs)</BuildCommand>

95
update-release Executable file
View file

@ -0,0 +1,95 @@
#!/bin/bash
# Usage:
# ./update-release sdk-version runtime-version [--bug bug-id] [--tarball tarball-name]
set -euo pipefail
IFS=$'\n\t'
print_usage() {
echo " Usage:"
echo " ./update-release sdk-version runtime-version [--bug bug-id] [--tarball tarball-name]"
}
user_provided_tarball_name=""
positional_args=()
bug_ids=()
while [[ "$#" -gt 0 ]]; do
arg="$1"
case "${arg}" in
--bug)
bug_ids+=("$2")
shift;
shift;
;;
-h|--help)
print_usage
exit 0
;;
--tarball)
user_provided_tarball_name="$2"
shift;
shift;
;;
*)
positional_args+=("$1")
shift
;;
esac
done
spec_files=( ./*.spec )
spec_file="${spec_files[0]}"
sdk_version=${positional_args[0]:-}
if [[ -z ${sdk_version} ]]; then
echo "error: missing sdk version"
exit 1
fi
runtime_version=${positional_args[1]:-}
if [[ -z ${runtime_version} ]]; then
echo "error: missing runtime version"
exit 1
fi
host_version="$runtime_version"
tag=v${sdk_version}
if [[ -f "dotnet-${tag}-original.tar.gz" ]]; then
echo "dotnet-${tag}-original.tar.gz alredy exists, not rebuilding tarball"
else
if [[ -n "${user_provided_tarball_name}" ]]; then
./rename-tarball "$user_provided_tarball_name" "dotnet-${tag}-original.tar.gz"
elif [[ -f "dotnet-${sdk_version}.tar.gz" ]]; then
./rename-tarball "dotnet-${sdk_version}.tar.gz" "dotnet-${tag}-original.tar.gz"
elif [[ -f "dotnet-${runtime_version}.tar.gz" ]]; then
./rename-tarball "dotnet-${runtime_version}.tar.gz" "dotnet-${tag}-original.tar.gz"
fi
fi
if [[ ! -f "dotnet-${tag}.tar.gz" ]]; then
./build-dotnet-tarball "${tag}"
fi
set -x
sed -i -E "s|^%global host_version [[:digit:]]\.[[:digit:]]\.[[:digit:]]+|%global host_version ${host_version}|" "$spec_file"
sed -i -E "s|^%global runtime_version [[:digit:]]\.[[:digit:]]\.[[:digit:]]+|%global runtime_version ${runtime_version}|" "$spec_file"
sed -i -E "s|^%global sdk_version [[:digit:]]\.[[:digit:]]\.[[:digit:]][[:digit:]][[:digit:]]|%global sdk_version ${sdk_version}|" "$spec_file"
comment="Update to .NET SDK ${sdk_version} and Runtime ${runtime_version}"
for bug_id in "${bug_ids[@]}"; do
comment="$comment
- Resolves: RHBZ#$bug_id"
done
rpmdev-bumpspec --comment="$comment" "$spec_file"
# Reset release to 1 in 'Release' tag
sed -i -E 's|^Release: [[:digit:]]+%|Release: 1%|' "$spec_file"
# Reset Release in changelog comment
# See https://stackoverflow.com/questions/18620153/find-matching-text-and-replace-next-line
sed -i -E '/^%changelog$/!b;n;s/-[[:digit:]]+$/-1/' "$spec_file"

View file

@ -0,0 +1,33 @@
From b2c4b2427d8c1a2410c4210789caccf1ec87e64a Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Thu, 9 Sep 2021 13:21:51 -0400
Subject: [PATCH] [ArPow] Use --work-tree with git apply
This makes things work better in a source-tarball build, where there may
be a .git directory somewhere in our parent directories but it's for a
different repo than vstest. In a situation like that a plain `git apply`
will (silently!) ignore patches because they wont apply to the unrelated
repository. That will (eventually) make the source-build fail.
`--work-tree` makes git directly use the directory that we care about.
See https://github.com/dotnet/source-build/issues/2445 for more details.
---
eng/SourceBuild.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props
index b365645c..68f82592 100644
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -24,7 +24,7 @@
</ItemGroup>
<Exec
- Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
+ Command="git --work-tree=&quot;$(InnerSourceBuildRepoRoot)&quot; apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(InnerSourceBuildRepoRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>
--
2.31.1

View file

@ -0,0 +1,11 @@
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -15,7 +15,7 @@
</ItemGroup>
<Exec
- Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
+ Command="git --work-tree=&quot;$(RepoRoot)&quot; apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(RepoRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>