.NET Core CLI tools and runtime
dca1b3f6af98458675fc1fae8bb48d66b6a1f459..133fb88a08018bbded3f72144213e99f0b699d27
8 days ago CentOS Sources
import rh-dotnet22-dotnet-2.2.100-5.el7
133fb8 diff | tree
9 files added
1 files deleted
809 ■■■■■ changed files
.gitignore 1 ●●●● patch | view | raw | blame | history
.rh-dotnet22-dotnet.metadata 1 ●●●● patch | view | raw | blame | history
README.md 4 ●●●● patch | view | raw | blame | history
SOURCES/check-debug-symbols.py 134 ●●●●● patch | view | raw | blame | history
SOURCES/core-setup-4510-commit-id.patch 48 ●●●●● patch | view | raw | blame | history
SOURCES/coreclr-21084-llvm-home.patch 22 ●●●●● patch | view | raw | blame | history
SOURCES/corefx-32956-alpn.patch 22 ●●●●● patch | view | raw | blame | history
SOURCES/corefx-optflags-support.patch 64 ●●●●● patch | view | raw | blame | history
SOURCES/source-build-869-build-log.patch 193 ●●●●● patch | view | raw | blame | history
SPECS/dotnet.spec 320 ●●●●● patch | view | raw | blame | history
.gitignore
New file
@@ -0,0 +1 @@
SOURCES/dotnet-v2.2.0.tar.gz
.rh-dotnet22-dotnet.metadata
New file
@@ -0,0 +1 @@
0f5a5d6efa3d37cdb120dbcdbb0fb7fceb84aa95 SOURCES/dotnet-v2.2.0.tar.gz
README.md
File was deleted
SOURCES/check-debug-symbols.py
New file
@@ -0,0 +1,134 @@
#!/usr/bin/python2
"""
Check debug symbols are present in shared object and can identify
code.
It starts scanning from a directory and recursively scans all ELF
files found in it for various symbols to ensure all debuginfo is
present and nothing has been stripped.
Usage:
./check-debug-symbols /path/of/dir/to/scan/
Example:
./check-debug-symbols /usr/lib64
"""
# This technique was explained to me by Mark Wielaard (mjw).
import collections
import os
import re
import subprocess
import sys
ScanResult = collections.namedtuple('ScanResult',
                                    'file_name debug_info debug_abbrev file_symbols gnu_debuglink')
def scan_file(file):
    "Scan the provided file and return a ScanResult containing results of the scan."
    # Test for .debug_* sections in the shared object. This is the  main test.
    # Stripped objects will not contain these.
    readelf_S_result = subprocess.check_output(['eu-readelf', '-S', file])
    has_debug_info = any(line for line in readelf_S_result.split('\n') if '] .debug_info' in line)
    has_debug_abbrev = any(line for line in readelf_S_result.split('\n') if '] .debug_abbrev' in line)
    # Test FILE symbols. These will most likely be removed by anyting that
    # manipulates symbol tables because it's generally useless. So a nice test
    # that nothing has messed with symbols.
    def contains_file_symbols(line):
        parts = line.split()
        if len(parts) < 8:
            return False
        return \
            parts[2] == '0' and parts[3] == 'FILE' and parts[4] == 'LOCAL' and parts[5] == 'DEFAULT' and \
            parts[6] == 'ABS' and re.match(r'((.*/)?[-_a-zA-Z0-9]+\.(c|cc|cpp|cxx))?', parts[7])
    readelf_s_result = subprocess.check_output(["eu-readelf", '-s', file])
    has_file_symbols = any(line for line in readelf_s_result.split('\n') if contains_file_symbols(line))
    # Test that there are no .gnu_debuglink sections pointing to another
    # debuginfo file. There shouldn't be any debuginfo files, so the link makes
    # no sense either.
    has_gnu_debuglink = any(line for line in readelf_s_result.split('\n') if '] .gnu_debuglink' in line)
    return ScanResult(file, has_debug_info, has_debug_abbrev, has_file_symbols, has_gnu_debuglink)
def is_elf(file):
    result = subprocess.check_output(['file', file])
    return re.search('ELF 64-bit LSB (?:executable|shared object)', result)
def scan_file_if_sensible(file):
    if is_elf(file):
        # print(file)
        return scan_file(file)
    return None
def scan_dir(dir):
    results = []
    for root, _, files in os.walk(dir):
        for name in files:
            result = scan_file_if_sensible(os.path.join(root, name))
            if result:
                results.append(result)
    return results
def scan(file):
    file = os.path.abspath(file)
    if os.path.isdir(file):
        return scan_dir(file)
    elif os.path.isfile(file):
        return scan_file_if_sensible(file)
def is_bad_result(result):
    return not result.debug_info or not result.debug_abbrev or not result.file_symbols or result.gnu_debuglink
def print_scan_results(results, verbose):
    # print(results)
    for result in results:
        file_name = result.file_name
        found_issue = False
        if not result.debug_info:
            found_issue = True
            print('error: missing .debug_info section in ' + file_name)
        if not result.debug_abbrev:
            found_issue = True
            print('error: missing .debug_abbrev section in ' + file_name)
        if not result.file_symbols:
            found_issue = True
            print('error: missing FILE symbols in ' + file_name)
        if result.gnu_debuglink:
            found_issue = True
            print('error: unexpected .gnu_debuglink section in ' + file_name)
        if verbose and not found_issue:
            print('OK: ', file_name)
def main(args):
    verbose = False
    files = []
    for arg in args:
        if arg == '--verbose' or arg == '-v':
            verbose = True
        else:
            files.append(arg)
    results = []
    for file in files:
        results.extend(scan(file) or [])
    print_scan_results(results, verbose)
    if any(is_bad_result(result) for result in results):
        return 1
    return 0
if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))
SOURCES/core-setup-4510-commit-id.patch
New file
@@ -0,0 +1,48 @@
From e02ee86364b9db3edc298a6a081004aa07473d09 Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Wed, 29 Aug 2018 17:03:25 -0400
Subject: [PATCH] Allow setting the commit id using /p:LatestCommit
This is similar to how CommitCount is already supported.
This lets consumers who are building outside a git repo, such as
source-build, set a commit id which is displayed by `dotnet --info`
and `strings dotnet | grep '@(#)'`.
See: https://github.com/dotnet/source-build/issues/651
See: https://github.com/dotnet/cli/pull/5945
---
 dir.targets | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/dir.targets b/dir.targets
index 8d34872c6..59dc1ebde 100644
--- a/dir.targets
+++ b/dir.targets
@@ -17,7 +17,8 @@
     <Exec Command="$(DotnetToolCommand) build $(MSBuildThisFileDirectory)tools-local/tasks/core-setup.tasks.csproj" />
   </Target>
-  <Target Name="GetLatestCommitHash">
+  <Target Name="GetLatestCommitHash"
+          Condition="'$(LatestCommit)' == ''">
     <!-- Get the latest commit hash -->
     <Exec Command="git rev-parse HEAD 2>&amp;1" StandardOutputImportance="Low" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" ConsoleToMSBuild="true">
       <Output TaskParameter="ConsoleOutput" PropertyName="LatestCommit" />
@@ -29,13 +30,13 @@
     </PropertyGroup>
   </Target>
-  <Target Name="GetCommitCount">
+  <Target Name="GetCommitCount"
+          Condition="'$(CommitCount)' == ''">
     <Exec Command="git rev-list --count HEAD"
           StandardOutputImportance="Low"
           IgnoreExitCode="true"
           IgnoreStandardErrorWarningFormat="true"
-          ConsoleToMSBuild="true"
-          Condition="'$(CommitCount)' == ''">
+          ConsoleToMSBuild="true">
      <Output TaskParameter="ConsoleOutput" PropertyName="CommitCount" />
      <Output TaskParameter="ExitCode" PropertyName="CommitCountExitCode" />
     </Exec>
SOURCES/coreclr-21084-llvm-home.patch
New file
@@ -0,0 +1,22 @@
diff --git a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
index 96aec3019b..c91466e4cb 100644
--- a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
+++ b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
@@ -66,7 +66,7 @@ if(NOT $ENV{LLDB_LIB} STREQUAL "")
 else()
     # Check for LLDB library
     if(CLR_CMAKE_PLATFORM_DARWIN)
-        find_library(LLDB_LIB NAMES LLDB lldb lldb-6.0 lldb-5.0 lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATHS "${WITH_LLDB_LIBS}" PATH_SUFFIXES llvm NO_DEFAULT_PATH)
+        find_library(LLDB_LIB NAMES LLDB lldb lldb-6.0 lldb-5.0 lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATHS "${LLDB_LIB_DIR}" PATH_SUFFIXES llvm NO_DEFAULT_PATH)
         find_library(LLDB_LIB NAMES LLDB lldb lldb-6.0 lldb-5.0 lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATH_SUFFIXES llvm)
         if(LLDB_LIB STREQUAL LLDB_LIB-NOTFOUND)
             if(REQUIRE_LLDBPLUGIN)
@@ -88,7 +88,7 @@ else()
     # Check for LLDB headers
     # Multiple versions of LLDB can install side-by-side, so we need to check for lldb in various locations.
     # If the file in a directory is found the result is stored in the variable and the search will not be repeated unless the variable is cleared.
-    find_path(LLDB_H "lldb/API/LLDB.h" PATHS "${WITH_LLDB_INCLUDES}" NO_DEFAULT_PATH)
+    find_path(LLDB_H "lldb/API/LLDB.h" PATHS "${LLDB_INCLUDE_DIR}" NO_DEFAULT_PATH)
     find_path(LLDB_H "lldb/API/LLDB.h")
     find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-6.0/include")
     find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-5.0/include")
SOURCES/corefx-32956-alpn.patch
New file
@@ -0,0 +1,22 @@
From 9b9697318e9990655ea878a28a00eda44fb615c2 Mon Sep 17 00:00:00 2001
From: Jeremy Barton <jbarton@microsoft.com>
Date: Mon, 22 Oct 2018 11:54:52 -0700
Subject: [PATCH] Fix ALPN detection logic (for non-portable shim builds)
---
 .../Unix/System.Security.Cryptography.Native/configure.cmake    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake b/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake
index cdc9f50f3c33..fac8c16343df 100644
--- a/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake
+++ b/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake
@@ -2,7 +2,7 @@ include(CheckLibraryExists)
 check_library_exists(${OPENSSL_SSL_LIBRARY} "TLSv1_1_method" "" HAVE_TLS_V1_1)
 check_library_exists(${OPENSSL_SSL_LIBRARY} "TLSv1_2_method" "" HAVE_TLS_V1_2)
-set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
+set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY})
 check_function_exists(
     EC_GF2m_simple_method
SOURCES/corefx-optflags-support.patch
New file
@@ -0,0 +1,64 @@
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,6 @@ add_compile_options(-fPIC)
 add_compile_options(-I${CMAKE_CURRENT_SOURCE_DIR}/Common)
 add_compile_options(-I${CMAKE_CURRENT_BINARY_DIR}/Common)
 add_compile_options(-g)
-add_compile_options(-Werror)
 if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
     add_compile_options(-Wno-unreachable-code)
 endif ()
diff --git a/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake b/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake
index 809ffe318e..de55150e36 100644
--- a/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake
+++ b/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake
@@ -3,6 +3,11 @@ include(CheckFunctionExists)
 set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
+set (PREVIOUS_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+set (CMAKE_CXX_FLAGS "")
+set (PREVIOUS_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+set (CMAKE_C_FLAGS "")
+
 # Check which versions of TLS the OpenSSL/ssl library supports
 check_library_exists(${OPENSSL_SSL_LIBRARY} "TLSv1_1_method" "" HAVE_TLS_V1_1)
 check_library_exists(${OPENSSL_SSL_LIBRARY} "TLSv1_2_method" "" HAVE_TLS_V1_2)
@@ -17,6 +22,9 @@ check_function_exists(
     SSL_get0_alpn_selected
     HAVE_OPENSSL_ALPN)
+set (CMAKE_CXX_FLAGS "${PREVIOUS_CMAKE_CXX_FLAGS}")
+set (CMAKE_C_FLAGS "${PREVIOUS_CMAKE_C_FLAGS}")
+
 configure_file(
     ${CMAKE_CURRENT_SOURCE_DIR}/pal_crypto_config.h.in
     ${CMAKE_CURRENT_BINARY_DIR}/pal_crypto_config.h)
diff --git a/src/Native/Unix/configure.cmake b/src/Native/Unix/configure.cmake
index f4a30ad6cb..cf8eaa73d3 100644
--- a/src/Native/Unix/configure.cmake
+++ b/src/Native/Unix/configure.cmake
@@ -27,6 +27,11 @@ 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 "")
+set (PREVIOUS_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+set (CMAKE_C_FLAGS "")
+
 # 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.
@@ -709,6 +714,9 @@ check_c_source_compiles(
     "
     HAVE_IN_EXCL_UNLINK)
+set (CMAKE_CXX_FLAGS "${PREVIOUS_CMAKE_CXX_FLAGS}")
+set (CMAKE_C_FLAGS "${PREVIOUS_CMAKE_C_FLAGS}")
+
 configure_file(
     ${CMAKE_CURRENT_SOURCE_DIR}/Common/pal_config.h.in
     ${CMAKE_CURRENT_BINARY_DIR}/Common/pal_config.h)
SOURCES/source-build-869-build-log.patch
New file
@@ -0,0 +1,193 @@
From a542e1977bf264a1a4e26f0e978387668c74b798 Mon Sep 17 00:00:00 2001
From: Davis Goodin <dagood@microsoft.com>
Date: Wed, 14 Nov 2018 10:05:41 -0600
Subject: [PATCH] Set IgnoreStandardErrorWarningFormat on Execs
For every Exec that takes RedirectRepoOutputToLog, ignore standard error/warning format. If it isn't ignored, there might be problems that are ignored by redirecting to the logs that aren't ignored if redirecting is turned off. Configure Exec not to detect these at all to behave the same whether redirecting or not.
---
 repos/application-insights.proj |  9 ++++++---
 repos/dir.targets               | 21 ++++++++++++---------
 repos/netcorecli-fsc.proj       |  3 ++-
 repos/newtonsoft-json.proj      |  3 ++-
 repos/nuget-client.proj         |  9 ++++++---
 repos/roslyn.proj               |  9 ++++++---
 repos/templating.proj           |  3 ++-
 7 files changed, 36 insertions(+), 21 deletions(-)
diff --git a/repos/application-insights.proj b/repos/application-insights.proj
index d9d56eb194..64dffe8ecb 100644
--- a/repos/application-insights.proj
+++ b/repos/application-insights.proj
@@ -18,14 +18,17 @@
     <Exec Command="$(DotnetToolCommand) restore /bl:restore.binlog $(BuildCommandArgs)  "
           EnvironmentVariables="@(EnvironmentVariables)"
-          WorkingDirectory="$(ProjectDirectory)" />
+          WorkingDirectory="$(ProjectDirectory)"
+          IgnoreStandardErrorWarningFormat="true" />
     <Exec Command="$(DotnetToolCommand) build /bl:build.binlog $(BuildCommandArgs)"
           EnvironmentVariables="@(EnvironmentVariables)"
-          WorkingDirectory="$(ProjectDirectory)" />
+          WorkingDirectory="$(ProjectDirectory)"
+          IgnoreStandardErrorWarningFormat="true" />
     <Exec Command="$(DotnetToolCommand) pack /bl:pack.binlog $(BuildCommandArgs)"
           EnvironmentVariables="@(EnvironmentVariables)"
-          WorkingDirectory="$(ProjectDirectory)" />
+          WorkingDirectory="$(ProjectDirectory)"
+          IgnoreStandardErrorWarningFormat="true" />
   </Target>
 </Project>
diff --git a/repos/dir.targets b/repos/dir.targets
index 761e7ae603..b3793b1d04 100644
--- a/repos/dir.targets
+++ b/repos/dir.targets
@@ -245,7 +245,10 @@
     <ItemGroup>
       <EnvironmentVariables Condition="'$(NUGET_PACKAGES)'!=''" Include="NUGET_PACKAGES=$(NUGET_PACKAGES)" />
     </ItemGroup>
-    <Exec Command="$(BuildCommand) $(RepoApiArgs) $(RedirectRepoOutputToLog)" WorkingDirectory="$(ProjectDirectory)" EnvironmentVariables="@(EnvironmentVariables)" />
+    <Exec Command="$(BuildCommand) $(RepoApiArgs) $(RedirectRepoOutputToLog)"
+          WorkingDirectory="$(ProjectDirectory)"
+          EnvironmentVariables="@(EnvironmentVariables)"
+          IgnoreStandardErrorWarningFormat="true" />
   </Target>
   <Target Name="ReportRepoError">
@@ -261,7 +264,10 @@
     <Message Importance="High" Text="  Log: $(RepoConsoleLogFile)" />
     <Message Importance="High" Text="  With Environment Variables:" />
     <Message Importance="High" Text="    %(EnvironmentVariables.Identity)" />
-    <Exec Command="$(BuildPackagesCommand) $(RedirectRepoOutputToLog)" WorkingDirectory="$(ProjectDirectory)" EnvironmentVariables="@(EnvironmentVariables)" />
+    <Exec Command="$(BuildPackagesCommand) $(RedirectRepoOutputToLog)"
+          WorkingDirectory="$(ProjectDirectory)"
+          EnvironmentVariables="@(EnvironmentVariables)"
+          IgnoreStandardErrorWarningFormat="true" />
     <Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Packaging $(ProjectBuildReason)...done" />
     <OnError ExecuteTargets="ReportRepoError" />
   </Target>
@@ -309,13 +315,10 @@
   </Target>
   <Target Name="Clean" Condition="'$(CleanCommand)' != ''" >
-    <Exec Command="$(CleanCommand) $(RedirectRepoOutputToLog)" WorkingDirectory="$(ProjectDirectory)" EnvironmentVariables="@(EnvironmentVariables)" />
-  </Target>
-
-  <Target Name="Update"
-          BeforeTargets="Build"
-          Condition="'$(DependencyVersionInputRepoApiImplemented)' != 'true' AND '$(UpdateCommand)' != ''">
-    <Exec Command="$(UpdateCommand) $(RedirectRepoOutputToLog)" WorkingDirectory="$(ProjectDirectory)" EnvironmentVariables="@(EnvironmentVariables)" />
+    <Exec Command="$(CleanCommand) $(RedirectRepoOutputToLog)"
+          WorkingDirectory="$(ProjectDirectory)"
+          EnvironmentVariables="@(EnvironmentVariables)"
+          IgnoreStandardErrorWarningFormat="true" />
   </Target>
   <Target Name="SetNuGetPackagesEnvironment" Condition="'$(ArchiveDownloadedPackages)' == 'true'">
diff --git a/repos/netcorecli-fsc.proj b/repos/netcorecli-fsc.proj
index c905cf9d81..0422eeb233 100644
--- a/repos/netcorecli-fsc.proj
+++ b/repos/netcorecli-fsc.proj
@@ -12,7 +12,8 @@
   <Target Name="Restore" BeforeTargets="Build" DependsOnTargets="UpdateNuGetConfig">
     <Exec Command="$(DotnetToolCommand) restore FSharp.NET.Sdk.csproj $(OutputArgs) $(RedirectRepoOutputToLog)"
           WorkingDirectory="$(ProjectDirectory)"
-          EnvironmentVariables="@(EnvironmentVariables)" />
+          EnvironmentVariables="@(EnvironmentVariables)"
+          IgnoreStandardErrorWarningFormat="true" />
   </Target>
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))/dir.targets" />
diff --git a/repos/newtonsoft-json.proj b/repos/newtonsoft-json.proj
index 073f725fa0..9ad089b05a 100644
--- a/repos/newtonsoft-json.proj
+++ b/repos/newtonsoft-json.proj
@@ -19,7 +19,8 @@
   <Target Name="Restore" BeforeTargets="Build" DependsOnTargets="UpdateNuGetConfig">
     <Exec Command="$(DotnetToolCommand) restore $(NewtonsoftJsonProjectPath) $(DotnetToolCommandArguments) $(RedirectRepoOutputToLog)"
           WorkingDirectory="$(ProjectDirectory)"
-          EnvironmentVariables="@(EnvironmentVariables)" />
+          EnvironmentVariables="@(EnvironmentVariables)"
+          IgnoreStandardErrorWarningFormat="true" />
   </Target>
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))/dir.targets" />
diff --git a/repos/nuget-client.proj b/repos/nuget-client.proj
index da135caa8a..d97f550d46 100644
--- a/repos/nuget-client.proj
+++ b/repos/nuget-client.proj
@@ -36,11 +36,13 @@
     <Exec Command="$(BuildCommandBase) /t:RestoreXPLAT /bl:restore.binlog $(RedirectRepoOutputToLog)"
           EnvironmentVariables="@(EnvironmentVariables)"
-          WorkingDirectory="$(ProjectDirectory)" />
+          WorkingDirectory="$(ProjectDirectory)"
+          IgnoreStandardErrorWarningFormat="true" />
     <Exec Command="$(BuildCommandBase) /t:BuildXPLAT /bl:build.binlog $(RedirectRepoOutputToLog)"
           EnvironmentVariables="@(EnvironmentVariables)"
-          WorkingDirectory="$(ProjectDirectory)" />
+          WorkingDirectory="$(ProjectDirectory)"
+          IgnoreStandardErrorWarningFormat="true" />
     <PropertyGroup>
       <PackCommand>$(BuildCommandBase) /t:PackXPlat</PackCommand>
@@ -53,7 +55,8 @@
     <Exec Command="$(PackCommand)"
           EnvironmentVariables="@(EnvironmentVariables)"
-          WorkingDirectory="$(ProjectDirectory)" />
+          WorkingDirectory="$(ProjectDirectory)"
+          IgnoreStandardErrorWarningFormat="true" />
   </Target>
   <Target Name="InitSubmodules" Condition="Exists('$(ProjectDirectory).git')">
diff --git a/repos/roslyn.proj b/repos/roslyn.proj
index 84d05915b2..5601e710cd 100644
--- a/repos/roslyn.proj
+++ b/repos/roslyn.proj
@@ -56,7 +56,8 @@
     <Exec Command="$(DotnetToolCommand) $(RestoreArgs)"
           WorkingDirectory="$(ProjectDirectory)"
-          EnvironmentVariables="@(EnvironmentVariables)" />
+          EnvironmentVariables="@(EnvironmentVariables)"
+          IgnoreStandardErrorWarningFormat="true" />
     <Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Restoring 'roslyn'...done" />
   </Target>
@@ -90,7 +91,8 @@
     <Exec Command="$(DotnetToolCommand) $(PublishCommandArgs) %(PublishWithoutBuildingProject.Identity) $(RedirectRepoOutputToLog)"
           WorkingDirectory="$(ProjectDirectory)"
-          EnvironmentVariables="@(EnvironmentVariables)" />
+          EnvironmentVariables="@(EnvironmentVariables)"
+          IgnoreStandardErrorWarningFormat="true" />
     <PropertyGroup>
       <PackCommandArgs>pack --no-build</PackCommandArgs>
@@ -104,7 +106,8 @@
     <Exec Command="$(DotnetToolCommand) $(PackCommandArgs) -p:NuspecFile=%(NuSpecFiles.Identity) $(RedirectRepoOutputToLog)"
           WorkingDirectory="$(ProjectDirectory)"
-          EnvironmentVariables="@(EnvironmentVariables)" />
+          EnvironmentVariables="@(EnvironmentVariables)"
+          IgnoreStandardErrorWarningFormat="true" />
     <Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Packaging 'roslyn'...done" />
   </Target>
diff --git a/repos/templating.proj b/repos/templating.proj
index 568949f865..91a84908c6 100644
--- a/repos/templating.proj
+++ b/repos/templating.proj
@@ -38,7 +38,8 @@
     <Exec Command="$(DotnetToolCommand) msbuild $(BuildCommandArgs)"
           WorkingDirectory="$(ProjectDirectory)"
-          EnvironmentVariables="@(EnvironmentVariables)" />
+          EnvironmentVariables="@(EnvironmentVariables)"
+          IgnoreStandardErrorWarningFormat="true" />
     <!-- The templates are built to a different folder than the packages, copy them into the packages folder. -->
     <ItemGroup>
SPECS/dotnet.spec
New file
@@ -0,0 +1,320 @@
# Do *NOT* try and build this locally (using rhpkg or any other tool) if one of
# the parent directories is a git repository. This build uses git-apply during
# the upstream build process. git-apply will simply skip all patches since none
# of the patches affect the build subdirectory.
#
# Use `rhpkg local --builddir ../dotnet-build` or something similar to work
# around this.
%{?scl:%scl_package dotnet}
%{!?scl:%global pkg_name %{name}}
# lldb doesn't like our nice debug information
%undefine _include_minidebuginfo
%global _find_debuginfo_dwz_opts %{nil}
# 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
# Remove private libraries and the automatically generated dependency
# on system libcurl package. We require the %%{?scl_prefix}libcurl package
%global __requires_exclude ^(%{privlibs}|libcurl)\\.so
# Filter flags not supported by clang/dotnet:
#  -fcf-protection is not supported by clang
#  -specs= is not supported by clang
%global dotnet_cflags %(echo %optflags | sed -e 's/-fcf-protection//' | sed -re 's/-specs=[^ ]*//g')
%global dotnet_ldflags %(echo %{__global_ldflags} | sed -re 's/-specs=[^ ]*//g')
%global host_version 2.2.0
%global sdk_version 2.2.100
%global runtime_version 2.2.0
Name:           %{?scl_prefix}dotnet
Version:        %{sdk_version}
Release:        5%{?dist}
Group:          Development/Languages
Summary:        .NET Core CLI tools and runtime
License:        MIT and ASL 2.0 and BSD
URL:            https://github.com/dotnet/
# The source is generated on a RHEL box via:
# - git clone https://github.com/dotnet/source-build
# - git checkout v%%{sdk_version}
# - set environment variables + tweak sources to build
# - ./build-source-tarball.sh dotnet-%%{sdk_version}
# - tar cvzf dotnet-%%{sdk_version}.tar.gz dotnet-%%{sdk_version}
Source0:        dotnet-v%{runtime_version}.tar.gz
Source1:        check-debug-symbols.py
Patch1:         source-build-869-build-log.patch
Patch100:       corefx-32956-alpn.patch
Patch101:       corefx-optflags-support.patch
Patch200:       coreclr-21084-llvm-home.patch
Patch300:       core-setup-4510-commit-id.patch
ExclusiveArch:  x86_64
BuildRequires:  llvm-toolset-7-clang
BuildRequires:  cmake
BuildRequires:  git
BuildRequires:  hostname
BuildRequires:  krb5-devel
BuildRequires:  %{?scl_prefix}libcurl-devel
BuildRequires:  libicu-devel
BuildRequires:  libunwind-devel
BuildRequires:  llvm-toolset-7-lldb-devel
BuildRequires:  llvm-toolset-7-llvm
BuildRequires:  %{?scl_prefix}lttng-ust-devel
BuildRequires:  openssl-devel
BuildRequires:  python2
BuildRequires:  zlib-devel
Requires:       %{name}-sdk-2.2%{?_isa}
%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 host
Version:        %{runtime_version}
Summary:        .NET command line launcher
%description 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 host-fxr-2.2
Version:        %{host_version}
Summary:        .NET Core command line host resolver
# Theoretically any version of the host should work
Requires:       %{name}-host%{?_isa}
%description host-fxr-2.2
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 runtime-2.2
Version:        %{runtime_version}
Summary:        NET Core 2.2 runtime
Requires:       %{name}-host-fxr-2.2%{?_isa}
# libicu is dlopen()ed
Requires:       libicu
# libcurl is dlopen()ed
Requires:       %{?scl_prefix}libcurl
%description runtime-2.2
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 sdk-2.2
Version:        %{sdk_version}
Summary:        .NET Core 2.2 Software Development Kit
Requires:       %{name}-sdk-2.2.1xx%{?_isa}
%description sdk-2.2
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.
%package sdk-2.2.1xx
Version:        %{sdk_version}
Summary:        .NET Core 2.2.1xx Software Development Kit
Requires:       %{name}-runtime-2.2%{?_isa}
%description sdk-2.2.1xx
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.
%prep
%setup -q -n %{pkg_name}-v%{runtime_version}
# Disable warnings
sed -i 's|skiptests|skiptests ignorewarnings|' repos/coreclr.proj
# Fix bad hardcoded path in build
sed -i 's|/usr/share/dotnet|%{_libdir}/%{pkg_name}|' src/core-setup/src/corehost/common/pal.unix.cpp
%patch1 -p1
pushd src/corefx
%patch100 -p1
%patch101 -p1
popd
pushd src/coreclr
%patch200 -p1
popd
pushd src/core-setup
%patch300 -p1
popd
%build
%{?scl:scl enable %scl llvm-toolset-7 - << \EOF}
set -xe
export CFLAGS="%{dotnet_cflags}"
export CXXFLAGS="%{dotnet_cflags}"
export LDFLAGS="%{dotnet_ldflags}"
export LIBRARY_PATH="%{_libdir}"
export LLVM_HOME=/opt/rh/llvm-toolset-7/root/usr
export CMAKE_PREFIX_PATH="%{_prefix}"
VERBOSE=1 ./build.sh \
  /v:diag \
  /p:MinimalConsoleLogOutput=false \
  /p:ContinueOnPrebuiltBaselineError=true
%{?scl:EOF}
%install
install -d -m 0755 %{buildroot}%{_libdir}/%{pkg_name}/
ls bin/x64/Release
tar vxf bin/x64/Release/dotnet-sdk-%{sdk_version}-*.tar.gz -C %{buildroot}%{_libdir}/%{pkg_name}/
# Fix permissions on files
find %{buildroot}%{_libdir}/%{pkg_name}/ -type f -name '*.props' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/%{pkg_name}/ -type f -name '*.targets' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/%{pkg_name}/ -type f -name '*.dll' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/%{pkg_name}/ -type f -name '*.pubxml' -exec chmod -x {} \;
#TODO: find a way to make completion parallel-installable
#install -dm 755 %%{buildroot}/%%{_root_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}/%%{_root_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 -d -m 0755 %{buildroot}%{_bindir}
ln -s %{_libdir}/%{pkg_name}/dotnet %{buildroot}%{_bindir}/
install -d -m 0755 %{buildroot}%{_mandir}/man1/
find -iname 'dotnet*.1' -type f -exec cp {} %{buildroot}%{_mandir}/man1/ \;
# 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..."
%{SOURCE1} -v %{buildroot}%{_libdir}/%{pkg_name}/
%check
%{buildroot}%{_libdir}/%{pkg_name}/dotnet --info
%files
# empty package useful for dependencies
%files host
%dir %{_libdir}/%{pkg_name}
%{_libdir}/%{pkg_name}/dotnet
%{_libdir}/%{pkg_name}/host
%{_bindir}/dotnet
%doc %{_libdir}/%{pkg_name}/LICENSE.txt
%doc %{_libdir}/%{pkg_name}/ThirdPartyNotices.txt
%doc %{_mandir}/man1/dotnet*.1.gz
# shell completions are currently only picked up from %%{_root_datadir}
#%%dir %%{_root_datadir}/bash-completion
#%%dir %%{_root_datadir}/bash-completion/completions
#%%{_root_datadir}/bash-completion/completions/dotnet
%files host-fxr-2.2
%dir %{_libdir}/%{pkg_name}/host/fxr
%{_libdir}/%{pkg_name}/host/fxr/%{host_version}
%files runtime-2.2
%dir %{_libdir}/%{pkg_name}/shared
%dir %{_libdir}/%{pkg_name}/shared/Microsoft.NETCore.App
%{_libdir}/%{pkg_name}/shared/Microsoft.NETCore.App/%{runtime_version}
%files sdk-2.2
# empty package useful for dependencies
%files sdk-2.2.1xx
%dir %{_libdir}/%{pkg_name}/sdk
%{_libdir}/%{pkg_name}/sdk/%{sdk_version}
%changelog
* Thu Nov 29 2018 Omair Majid <omajid@redhat.com> - 2.2.100-5
- Remove bash completion to fix parallel installation with .NET Core 2.1
- Resolves: RHBZ#1649584
* Wed Nov 21 2018 Omair Majid <omajid@redhat.com> - 2.2.100-4
- Fix dependency on host-fxr-2.2
- Resolves: RHBZ#1649584
* Wed Nov 21 2018 Omair Majid <omajid@redhat.com> - 2.2.100-3
- Fix configure check in the presence of distro-supplied cflags/ldflags
- Fixes ALPN support
- Resolves: RHBZ#1649584
* Tue Nov 20 2018 Omair Majid <omajid@redhat.com> - 2.2.100-2
- Increase build verbosity
- Resolves: RHBZ#1649584
* Mon Nov 19 2018 Omair Majid <omajid@redhat.com> - 2.2.100-1
- New package.
- Resolves: RHBZ#1649584