dotnet7.0/SOURCES/1000-set-OL-RID.patch

314 lines
12 KiB
Diff

From b237532a0f6ee04ccdee1964c44b91bb75fdce6b Mon Sep 17 00:00:00 2001
From: Tianyue Lan <tianyue.lan@oracle.com>
Date: Thu, 6 Oct 2022 10:17:55 -0700
Subject: [PATCH] Set TargetRid based on os release major version
Also added OL arm64 RuntimeIdentifier
[Orabug:34671152]
Signed-Off-By: Tianyue.Lan@oracle.com
Updated for ol9u1
src/diagnostics/eng/native/init-distro-rid.sh renamed src/diagnostics/eng/init-distro-rid.sh
and updated for context change.
Signed-Off-By: John.Mcwalters@oracle.com
---
.../Native/PlatformApis.cs | 2 +-
.../eng/native/init-distro-rid.sh | 2 +-
src/diagnostics/eng/init-distro-rid.sh | 2 +-
src/runtime/eng/native/init-distro-rid.sh | 2 +-
.../System/PlatformDetection.Unix.cs | 2 +-
.../src/Microsoft.NETCore.Platforms.csproj | 2 +-
.../src/runtime.compatibility.json | 70 +++++++++++++++++++
.../src/runtime.json | 33 +++++++++
.../src/runtimeGroups.props | 4 +-
.../src/native/corehost/hostmisc/pal.unix.cpp | 7 +-
.../RuntimeEnvironment.cs | 2 +-
11 files changed, 118 insertions(+), 10 deletions(-)
diff --git a/src/arcade/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions/Native/PlatformApis.cs b/src/arcade/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions/Native/PlatformApis.cs
index 80fcf45e4..4d94dc27b 100644
--- a/src/arcade/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions/Native/PlatformApis.cs
+++ b/src/arcade/src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions/Native/PlatformApis.cs
@@ -131,7 +131,7 @@ private static DistroInfo NormalizeDistroInfo(DistroInfo distroInfo)
// Handle if VersionId is null by just setting the index to -1.
int minorVersionNumberSeparatorIndex = distroInfo.VersionId?.IndexOf('.') ?? -1;
- if (distroInfo.Id == "rhel" && minorVersionNumberSeparatorIndex != -1)
+ if ((distroInfo.Id == "rhel" || distroInfo.Id == "ol") && minorVersionNumberSeparatorIndex != -1)
{
distroInfo.VersionId = distroInfo.VersionId.Substring(0, minorVersionNumberSeparatorIndex);
}
diff --git a/src/deployment-tools/eng/native/init-distro-rid.sh b/src/deployment-tools/eng/native/init-distro-rid.sh
index 22efd8e8b..28ea80898 100644
--- a/src/deployment-tools/eng/native/init-distro-rid.sh
+++ b/src/deployment-tools/eng/native/init-distro-rid.sh
@@ -41,7 +41,7 @@ initNonPortableDistroRid()
# We have forced __PortableBuild=0. This is because -portablebuld
# has been passed as false.
if (( isPortable == 0 )); then
- if [ "${ID}" = "rhel" ]; then
+ if [[ "${ID}" == "rhel" || "${ID}" == "ol" ]]; then
# remove the last version digit
VERSION_ID="${VERSION_ID%.*}"
fi
diff --git a/src/diagnostics/eng/native/init-distro-rid.sh b/src/diagnostics/eng/native/init-distro-rid.sh
index 97fd647..ef2284c 100644
--- a/src/diagnostics/eng/native/init-distro-rid.sh
+++ b/src/diagnostics/eng/native/init-distro-rid.sh
@@ -41,7 +41,7 @@ initNonPortableDistroRid()
# We have forced __PortableBuild=0. This is because -portablebuld
# has been passed as false.
if (( isPortable == 0 )); then
- if [[ "${ID}" == "rhel" || "${ID}" == "rocky" ]]; then
+ if [[ "${ID}" == "rhel" || "${ID}" == "rocky" || "${ID}" == "ol" ]]; then
# remove the last version digit
VERSION_ID="${VERSION_ID%.*}"
fi
diff --git a/src/runtime/eng/native/init-distro-rid.sh b/src/runtime/eng/native/init-distro-rid.sh
index 750122406..fe6d8ffa2 100644
--- a/src/runtime/eng/native/init-distro-rid.sh
+++ b/src/runtime/eng/native/init-distro-rid.sh
@@ -41,7 +41,7 @@ initNonPortableDistroRid()
# We have forced __PortableBuild=0. This is because -portablebuld
# has been passed as false.
if (( isPortable == 0 )); then
- if [[ "${ID}" == "rhel" || "${ID}" == "rocky" || "${ID}" == "alpine" ]]; then
+ if [[ "${ID}" == "rhel" || "${ID}" == "rocky" || "${ID}" == "alpine" || "${ID}" == "ol" ]]; then
# remove the last version digit
VERSION_ID="${VERSION_ID%.*}"
fi
diff --git a/src/runtime/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs b/src/runtime/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs
index 33c4f5f93..600c20024 100644
--- a/src/runtime/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs
+++ b/src/runtime/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs
@@ -258,7 +258,7 @@ private static DistroInfo GetDistroInfo()
private static bool IsRedHatFamilyAndVersion(int major = -1, int minor = -1, int build = -1, int revision = -1)
{
- return IsDistroAndVersion((distro) => distro == "rhel" || distro == "centos", major, minor, build, revision);
+ return IsDistroAndVersion((distro) => distro == "rhel" || distro == "centos" || distro == "ol", major, minor, build, revision);
}
/// <summary>
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
index 482e0b70e..681ad6c2b 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
@@ -76,7 +76,7 @@
RuntimeJson="runtime.json"
CompatibilityMap="runtime.compatibility.json"
RuntimeDirectedGraph="$(OutputPath)runtime.json.dgml"
- UpdateRuntimeFiles="$(UpdateRuntimeFiles)" />
+ UpdateRuntimeFiles="true" />
</Target>
</Project>
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json
index 15c8c0a74..77a0fcfd3 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json
@@ -4938,6 +4938,18 @@
"any",
"base"
],
+ "ol-arm64": [
+ "ol-arm64",
+ "ol",
+ "rhel-arm64",
+ "rhel",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
"ol.7": [
"ol.7",
"ol",
@@ -5324,6 +5336,22 @@
"any",
"base"
],
+ "ol.8-arm64": [
+ "ol.8-arm64",
+ "ol.8",
+ "ol-arm64",
+ "rhel.8-arm64",
+ "ol",
+ "rhel.8",
+ "rhel-arm64",
+ "rhel",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
"ol.8-x64": [
"ol.8-x64",
"ol.8",
@@ -5372,6 +5400,48 @@
"any",
"base"
],
+ "ol.9": [
+ "ol.9",
+ "ol",
+ "rhel.9",
+ "rhel",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "ol.9-arm64": [
+ "ol.9-arm64",
+ "ol.9",
+ "ol-arm64",
+ "rhel.9-arm64",
+ "ol",
+ "rhel.9",
+ "rhel-arm64",
+ "rhel",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "ol.9-x64": [
+ "ol.9-x64",
+ "ol.9",
+ "ol-x64",
+ "rhel.9-x64",
+ "ol",
+ "rhel.9",
+ "rhel-x64",
+ "rhel",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
"omnios": [
"omnios",
"illumos",
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
index 050ce1e4e..71763c670 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
@@ -1933,6 +1933,12 @@
"rhel-x64"
]
},
+ "ol-arm64": {
+ "#import": [
+ "ol",
+ "rhel-arm64"
+ ]
+ },
"ol.7": {
"#import": [
"ol",
@@ -2050,6 +2056,13 @@
"rhel.8-x64"
]
},
+ "ol.8-arm64": {
+ "#import": [
+ "ol.8",
+ "ol-arm64",
+ "rhel.8-arm64"
+ ]
+ },
"ol.8.0": {
"#import": [
"ol.8",
@@ -2063,6 +2076,26 @@
"rhel.8.0-x64"
]
},
+ "ol.9": {
+ "#import": [
+ "ol",
+ "rhel.9"
+ ]
+ },
+ "ol.9-arm64": {
+ "#import": [
+ "ol.9",
+ "ol-arm64",
+ "rhel.9-arm64"
+ ]
+ },
+ "ol.9-x64": {
+ "#import": [
+ "ol.9",
+ "ol-x64",
+ "rhel.9-x64"
+ ]
+ },
"omnios": {
"#import": [
"illumos"
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props
index 1b10a2604..dc57d4580 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props
@@ -157,8 +157,8 @@
</RuntimeGroup>
<RuntimeGroup Include="ol">
<Parent>rhel</Parent>
- <Architectures>x64</Architectures>
- <Versions>8;8.0</Versions>
+ <Architectures>x64;arm64</Architectures>
+ <Versions>8;8.0;9</Versions>
<ApplyVersionsToParent>true</ApplyVersionsToParent>
</RuntimeGroup>
diff --git a/src/runtime/src/native/corehost/hostmisc/pal.unix.cpp b/src/runtime/src/native/corehost/hostmisc/pal.unix.cpp
index 422c966a3..b4ab15c15 100644
--- a/src/runtime/src/native/corehost/hostmisc/pal.unix.cpp
+++ b/src/runtime/src/native/corehost/hostmisc/pal.unix.cpp
@@ -764,12 +764,17 @@ pal::string_t pal::get_current_os_rid_platform()
static
pal::string_t normalize_linux_rid(pal::string_t rid)
{
+ pal::string_t olPrefix(_X("ol."));
pal::string_t rhelPrefix(_X("rhel."));
pal::string_t alpinePrefix(_X("alpine."));
pal::string_t rockyPrefix(_X("rocky."));
size_t lastVersionSeparatorIndex = std::string::npos;
- if (rid.compare(0, rhelPrefix.length(), rhelPrefix) == 0)
+ if (rid.compare(0, olPrefix.length(), olPrefix) == 0)
+ {
+ lastVersionSeparatorIndex = rid.find(_X("."), olPrefix.length());
+ }
+ else if (rid.compare(0, rhelPrefix.length(), rhelPrefix) == 0)
{
lastVersionSeparatorIndex = rid.find(_X("."), rhelPrefix.length());
}
diff --git a/src/sdk/src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs b/src/sdk/src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs
index 11d42fda8..877bb2050 100644
--- a/src/sdk/src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs
+++ b/src/sdk/src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs
@@ -220,7 +220,7 @@ private static DistroInfo NormalizeDistroInfo(DistroInfo distroInfo)
lastVersionNumberSeparatorIndex = distroInfo.VersionId.IndexOf('.', lastVersionNumberSeparatorIndex + 1);
}
- if (lastVersionNumberSeparatorIndex != -1 && (distroInfo.Id == "rhel" || distroInfo.Id == "alpine"))
+ if (lastVersionNumberSeparatorIndex != -1 && (distroInfo.Id == "rhel" || distroInfo.Id == "alpine" || distroInfo.Id == "ol"))
{
distroInfo.VersionId = distroInfo.VersionId.Substring(0, lastVersionNumberSeparatorIndex);
}
--
2.27.0