-
Notifications
You must be signed in to change notification settings - Fork 219
Conversation
@wfurt, |
@wfurt - the RID calculation code exists in 2 places - once in C# and once in C++. Since you are changing the C# RID calculation code, you should also change the C++ RID calculation: https://github.com/dotnet/core-setup/blob/master/src/corehost/common/pal.unix.cpp#L207-L400 |
Thanks for the pointer @eerhardt I'll get that as separate PR. |
Please don't separate this. These two pieces of logic (managed and native RID calculation) need to remain in sync, it doesn't make sense for one to be updated, without the other.
The managed RID calculation is pretty self-explanatory - anywhere managed code needs to get the current machine's RID, it calls into The native RID calculation is used by the It would be ideal if these two places could be shared, but it currently isn't easily possible. The managed code is used outside of .NET Core, so it can't depend on an API that is only available in .NET Core. The native piece is invoked before the CLR is even loaded, so it cannot invoke managed code. This is why we have the calculation in two places. |
@@ -101,6 +103,8 @@ private static string GetRIDOS() | |||
return OperatingSystem.ToLowerInvariant(); | |||
case Platform.Darwin: | |||
return "osx"; | |||
case Platform.FreeBSD: | |||
return "FreeBSD"; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
String verson = RuntimeInformation.OSDescription; | ||
try | ||
{ | ||
return RuntimeInformation.OSDescription.Split()[1]; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
set on rid freebsd.11-x64 |
src/corehost/build.sh
Outdated
else | ||
__rid_plat="linux" | ||
fi | ||
fi | ||
echo __rid_plat=$__rid_plat |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -60,6 +60,8 @@ private static string GetRIDVersion() | |||
return $".{OperatingSystemVersion}"; | |||
case Platform.Darwin: | |||
return $".{OperatingSystemVersion}"; | |||
case Platform.FreeBSD: | |||
return $".{OperatingSystemVersion.Split('.')[0]}"; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -214,6 +231,11 @@ private static Platform DetermineOSPlatform() | |||
{ | |||
return Platform.Darwin; | |||
} | |||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD"))) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -60,6 +60,8 @@ private static string GetRIDVersion() | |||
return $".{OperatingSystemVersion}"; | |||
case Platform.Darwin: | |||
return $".{OperatingSystemVersion}"; | |||
case Platform.FreeBSD: | |||
return $".{OperatingSystemVersion.Split('.')[0]}"; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/corehost/common/pal.unix.cpp
Outdated
if (ret == 0) | ||
{ | ||
char *pos = strchr(str,'.'); | ||
if (pos) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
try | ||
{ | ||
// second token up to first dot | ||
return RuntimeInformation.OSDescription.Split()[1].Split('.')[0]; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks @wfurt !
Based on how we do Ubuntu (every numbered release) this should probably include the minor. So on a latest-and-greatest build we'd want it to be |
This is part for https://github.com/dotnet/corefx/issues/1626
This change adds recognition for FreeBSD and implements function to get OS version.
There should be no impact for other platforms.
./dotnet --info
Runtime Environment:
OS Name: FreeBSD
OS Version: 11.0-RELEASE-p1
OS Platform: FreeBSD
RID: linux-x64
Base Path: /mnt/dotnetcli4/dotnetcli.OK/sdk/2.0.0-preview1-005977/
(RID fixup is not part of this change)