diff --git a/.gitignore b/.gitignore index 0d2a078..9cb7e9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/dotnet-2.0.3.tar.gz +SOURCES/dotnet-2.0.5.tar.gz diff --git a/.rh-dotnet20-dotnet.metadata b/.rh-dotnet20-dotnet.metadata index 3da39c8..573208e 100644 --- a/.rh-dotnet20-dotnet.metadata +++ b/.rh-dotnet20-dotnet.metadata @@ -1 +1 @@ -efe252f9861da1a2b5d18310631b54d46931f90e SOURCES/dotnet-2.0.3.tar.gz +fa5c42294761d301ba74a103f219956a6162f1f5 SOURCES/dotnet-2.0.5.tar.gz diff --git a/SOURCES/check_debug_symbols.py b/SOURCES/check_debug_symbols.py new file mode 100644 index 0000000..7eb06f9 --- /dev/null +++ b/SOURCES/check_debug_symbols.py @@ -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:])) diff --git a/SOURCES/coreclr-werror.patch b/SOURCES/coreclr-werror.patch index 2e0f38b..66ff06c 100644 --- a/SOURCES/coreclr-werror.patch +++ b/SOURCES/coreclr-werror.patch @@ -2,7 +2,7 @@ +++ dotnet/targets/coreclr.props 2017-08-02 12:44:44.361013247 -0400 @@ -4,6 +4,7 @@ $(PathToRepo) - $(Platform) $(Configuration) skiptests -PortableBuild=false + $(Platform) $(Configuration) skiptests -PortableBuild=false msbuildonunsupportedplatform $(BuildArguments) skipnuget cross -skiprestore stripSymbols + $(BuildArguments) ignorewarnings $(ProjectDirectory)/build$(ShellExtension) $(BuildArguments) diff --git a/SOURCES/corefx-debuginfo.patch b/SOURCES/corefx-debuginfo.patch new file mode 100644 index 0000000..aa1fba2 --- /dev/null +++ b/SOURCES/corefx-debuginfo.patch @@ -0,0 +1,39 @@ +From efe76524067c7948e2ccdbf735c5419a7554ddc3 Mon Sep 17 00:00:00 2001 +From: Omair Majid +Date: Wed, 1 Nov 2017 00:13:41 -0400 +Subject: [PATCH] Add -g flag to generate debuginfo on unix platforms (#24979) + +The windows build already includes /Zi /Zl as part of commit 920fd2f3 +(PR #7840). It looks like it was simply missed on Unix. + +This change also makes the native debug information closer to what +CoreCLR does on all platforms. See +https://github.com/dotnet/coreclr/pull/3445 for more information. + +This is also needed for the end-to-end debuginfo generation as part of +source-build. See https://github.com/dotnet/source-build/issues/267 +--- + src/Native/Unix/CMakeLists.txt | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git dotnet/src/corefx/src/Native/Unix/CMakeLists.txt dotnet/src/corefx/src/Native/Unix/CMakeLists.txt +index de8ae20f262..ca2716f37b5 100644 +--- dotnet/src/corefx/src/Native/Unix/CMakeLists.txt ++++ dotnet/src/corefx/src/Native/Unix/CMakeLists.txt +@@ -20,6 +20,7 @@ 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(-Wno-c99-extensions) ++add_compile_options(-g) + + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5) + add_compile_options(-Wno-unreachable-code) +@@ -60,7 +61,7 @@ endif () + + string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_CMAKE_BUILD_TYPE) + if (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG) +- add_compile_options(-g -O0) ++ add_compile_options(-O0) + add_definitions(-DDEBUG) + + # obtain settings from running coreclr\enablesanitizers.sh diff --git a/SOURCES/corefx-not-portable.patch b/SOURCES/corefx-not-portable.patch index 87b47de..532c49e 100644 --- a/SOURCES/corefx-not-portable.patch +++ b/SOURCES/corefx-not-portable.patch @@ -7,8 +7,8 @@ diff -ruN dotnet/targets/corefx.targets dotnet/targets/corefx.targets -- diff --git a/SOURCES/do-not-strip-debuginfo.patch b/SOURCES/do-not-strip-debuginfo.patch index 350ad5a..fd7ad53 100644 --- a/SOURCES/do-not-strip-debuginfo.patch +++ b/SOURCES/do-not-strip-debuginfo.patch @@ -31,21 +31,9 @@ diff -ruN dotnet/targets/coreclr.props dotnet/targets/coreclr.props @@ -3,7 +3,7 @@ $(PathToRepo) - $(Platform) $(Configuration) skiptests -PortableBuild=false + $(Platform) $(Configuration) skiptests -PortableBuild=false msbuildonunsupportedplatform - $(BuildArguments) skipnuget cross -skiprestore stripSymbols + $(BuildArguments) skipnuget cross -skiprestore $(BuildArguments) ignorewarnings $(ProjectDirectory)/build$(ShellExtension) $(BuildArguments) $(ArmEnvironmentVariables) $(BuildCommand) -diff -ruN dotnet/targets/core-setup.props dotnet/targets/core-setup.props ---- dotnet/targets/core-setup.props 2017-10-25 20:40:18.000000000 -0400 -+++ dotnet/targets/core-setup.props 2017-11-09 13:01:10.778592131 -0500 -@@ -3,7 +3,7 @@ - - $(PathToRepo) - rhel.7.4-x64 -- -ConfigurationGroup=$(Configuration) -PortableBuild=false -strip-symbols -SkipTests=true -DistroRid=$(FixRid) -+ -ConfigurationGroup=$(Configuration) -PortableBuild=false -SkipTests=true -DistroRid=$(FixRid) - $(BuildArguments) -TargetArchitecture=arm -DistroRid=linux-arm -DisableCrossgen=true -SkipTests=true -CrossBuild=true - $(ProjectDirectory)/build$(ShellExtension) $(BuildArguments) -- /p:BuildDebPackage=false - $(ArmEnvironmentVariables) $(BuildCommand) diff --git a/SOURCES/roslyn-verbose.patch b/SOURCES/roslyn-verbose.patch deleted file mode 100644 index 7689328..0000000 --- a/SOURCES/roslyn-verbose.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- dotnet/src/roslyn/Makefile -+++ dotnet/src/roslyn/Makefile -@@ -10,7 +10,7 @@ DOTNET_VERSION = 1.0.1 - DOTNET = $(BINARIES_PATH)/dotnet-cli/dotnet - TARGET_FX = netcoreapp1.1 - --MSBUILD_ADDITIONALARGS := /v:m /fl /fileloggerparameters:Verbosity=normal /p:Configuration=$(BUILD_CONFIGURATION) -+MSBUILD_ADDITIONALARGS := /v:diag /fl /fileloggerparameters:Verbosity=normal /p:Configuration=$(BUILD_CONFIGURATION) - - ifeq ($(OS_NAME),Linux) - RUNTIME_ID := $(shell . /etc/os-release && echo $$ID.$$VERSION_ID)-x64 diff --git a/SOURCES/templates-publish-without-manifest.patch b/SOURCES/templates-publish-without-manifest.patch index 57d38da..ba838d2 100644 --- a/SOURCES/templates-publish-without-manifest.patch +++ b/SOURCES/templates-publish-without-manifest.patch @@ -7,8 +7,8 @@ not part of these public built-from-source builds. If published applications use the manifest - and expect the runtime store to be available - they will publish correctly but fail to run at runtime. ---- dotnet/src/templating/template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/EmptyWeb-CSharp/Company.WebApplication1.csproj 2017-06-09 15:35:23.000000000 -0400 -+++ dotnet/src/templating/template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/EmptyWeb-CSharp/Company.WebApplication1.csproj 2017-07-19 15:59:25.900632277 -0400 +--- a/content/EmptyWeb-CSharp/Company.WebApplication1.csproj 2017-06-09 15:35:23.000000000 -0400 ++++ b/content/EmptyWeb-CSharp/Company.WebApplication1.csproj 2017-07-19 15:59:25.900632277 -0400 @@ -3,6 +3,7 @@ netcoreapp2.0 @@ -17,8 +17,8 @@ available - they will publish correctly but fail to run at runtime. ---- dotnet/src/templating/template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/RazorPagesWeb-CSharp/Company.WebApplication1.csproj 2017-06-09 15:35:23.000000000 -0400 -+++ dotnet/src/templating/template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/RazorPagesWeb-CSharp/Company.WebApplication1.csproj 2017-07-19 16:07:23.248684922 -0400 +--- a/content/RazorPagesWeb-CSharp/Company.WebApplication1.csproj 2017-06-09 15:35:23.000000000 -0400 ++++ b/content/RazorPagesWeb-CSharp/Company.WebApplication1.csproj 2017-07-19 16:07:23.248684922 -0400 @@ -5,6 +5,7 @@ aspnet-Company.WebApplication1-0ce56475-d1db-490f-8af1-a881ea4fcd2d 0 @@ -27,8 +27,8 @@ available - they will publish correctly but fail to run at runtime. ---- dotnet/src/templating/template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Company.WebApplication1.csproj 2017-06-09 15:35:23.000000000 -0400 -+++ dotnet/src/templating/template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Company.WebApplication1.csproj 2017-07-19 16:00:58.613168965 -0400 +--- a/content/StarterWeb-CSharp/Company.WebApplication1.csproj 2017-06-09 15:35:23.000000000 -0400 ++++ b/content/StarterWeb-CSharp/Company.WebApplication1.csproj 2017-07-19 16:00:58.613168965 -0400 @@ -8,6 +8,7 @@ aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502 0 @@ -37,8 +37,8 @@ available - they will publish correctly but fail to run at runtime. ---- dotnet/src/templating/template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-FSharp/Company.WebApplication1.fsproj 2017-06-09 15:35:23.000000000 -0400 -+++ dotnet/src/templating/template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-FSharp/Company.WebApplication1.fsproj 2017-07-19 16:01:12.964097252 -0400 +--- a/content/StarterWeb-FSharp/Company.WebApplication1.fsproj 2017-06-09 15:35:23.000000000 -0400 ++++ b/content/StarterWeb-FSharp/Company.WebApplication1.fsproj 2017-07-19 16:01:12.964097252 -0400 @@ -4,6 +4,7 @@ netcoreapp2.0 TargetFrameworkOverride @@ -47,8 +47,8 @@ available - they will publish correctly but fail to run at runtime. ---- dotnet/src/templating/template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/WebApi-CSharp/Company.WebApplication1.csproj 2017-06-09 15:35:23.000000000 -0400 -+++ dotnet/src/templating/template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/WebApi-CSharp/Company.WebApplication1.csproj 2017-07-19 16:04:59.211162884 -0400 +--- a/content/WebApi-CSharp/Company.WebApplication1.csproj 2017-06-09 15:35:23.000000000 -0400 ++++ b/content/WebApi-CSharp/Company.WebApplication1.csproj 2017-07-19 16:04:59.211162884 -0400 @@ -6,6 +6,7 @@ aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502 0 diff --git a/SPECS/dotnet.spec b/SPECS/dotnet.spec index 2f1c731..331f0e7 100644 --- a/SPECS/dotnet.spec +++ b/SPECS/dotnet.spec @@ -5,8 +5,8 @@ %undefine _include_minidebuginfo %global _find_debuginfo_dwz_opts %{nil} -%global sdk_version 2.0.3 -%global runtime_version 2.0.3 +%global sdk_version 2.1.4 +%global runtime_version 2.0.5 # Do not provide internal .so as standard libraries %global __provides_exclude_from ^(%{_libdir}/dotnet/.*\\.so|%{_libdir}/dotnetcore/sdk/%{sdk_version}/.*\\.so|%{_libdir}/dotnetcore/shared/Microsoft.NETCore.App/%{runtime_version}/.*)$ @@ -15,21 +15,23 @@ %global __requires_exclude ^(libmscordaccore.so\\(\\)\\(64bit\\)|libmscordaccore.so\\(V1.0\\)\\(64bit\\))$ Name: %{?scl_prefix}dotnet -Version: %{sdk_version} -Release: 4.1%{?dist} +Version: %{runtime_version} +Release: 1%{?dist} Summary: .NET Core is a general-purpose cross platform development platform Group: Development/Languages License: ASL 2.0 and MIT URL: https://www.microsoft.com/net/core -Source0: dotnet-%{sdk_version}.tar.gz +Source0: dotnet-%{runtime_version}.tar.gz +Source1: check_debug_symbols.py Patch0: coreclr-werror.patch Patch1: coreclr-sequential-build.patch -Patch2: roslyn-verbose.patch -Patch3: templates-publish-without-manifest.patch -Patch4: do-not-strip-debuginfo.patch -Patch5: corefx-not-portable.patch +Patch2: do-not-strip-debuginfo.patch +Patch3: corefx-not-portable.patch +Patch4: corefx-debuginfo.patch + +Patch5: templates-publish-without-manifest.patch ExclusiveArch: x86_64 @@ -46,9 +48,12 @@ BuildRequires: %{?scl_prefix}llvm BuildRequires: %{?scl_prefix}lttng-ust-devel BuildRequires: openssl-devel BuildRequires: python2 +BuildRequires: unzip BuildRequires: %{?scl_prefix}userspace-rcu-devel +BuildRequires: zip BuildRequires: zlib-devel +# For the sake of compatibility, we default to the older SDK Requires: %{?scl_prefix}dotnet-sdk-2.0 %description @@ -96,13 +101,17 @@ cross platform applications that work on Linux, Mac and Windows. It particularly focuses on creating console applications, web applications and micro-services. -%package -n %{?scl_prefix}dotnet-sdk-2.0 +%package -n %{?scl_prefix}dotnet-sdk-2.1 + +Version: %{sdk_version} Summary: A software development kit for developing .NET Core applications + +# SDK 2.1 requires runtime 2.0 Requires: %{?scl_prefix}dotnet-runtime-2.0 -%description -n %{?scl_prefix}dotnet-sdk-2.0 -The .NET Core 2.0 SDK provides a number of command line tools to build +%description -n %{?scl_prefix}dotnet-sdk-2.1 +The .NET Core 2.1 SDK provides a number of command line tools to build .NET Core applications. It includes compilers for C\#, VB.NET and F\#. .NET Core is a fast, lightweight and modular platform for creating @@ -120,15 +129,24 @@ applications and micro-services. %patch2 -p1 %patch3 -p1 %patch4 -p1 + +# The templates are "pre-built" into a nuget package. Lets extract, patch, and +# compile the nuget package back into it. +mkdir templates +pushd templates +unzip ../prebuilt/nuget-packages/microsoft.dotnet.web.projecttemplates.2.0.1.0.0-beta2-20170810-304.nupkg +rm ../prebuilt/nuget-packages/microsoft.dotnet.web.projecttemplates.2.0.1.0.0-beta2-20170810-304.nupkg %patch5 -p1 +zip -r ../prebuilt/nuget-packages/microsoft.dotnet.web.projecttemplates.2.0.1.0.0-beta2-20170810-304.nupkg . +popd # Increase build verbosity -sed -ie "s|flp:Verbosity=normal|flp:Verbosity=diag|" src/coreclr/build.sh +sed -i -e "s|flp:Verbosity=normal|flp:Verbosity=diag|" src/coreclr/build.sh # Change text printed when SDK is not installed -sed -ie "s|http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409|yum install %{?scl_prefix}dotnet-sdk-2.0|" src/core-setup/src/corehost/common/utils.h +sed -i -e "s|http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409|yum install %{?scl_prefix}dotnet-sdk-2.0|" src/core-setup/src/corehost/common/utils.h -%if %{centos} >= 7 +%if 0%{?centos} > 6 # Replace RHEL rid with CentOS rid sed -i -e 's|rhel.7.4-|centos.%{centos}-|g' targets/core-setup.props sed -i -e 's|rhel.7.4-|centos.%{centos}-|g' targets/cli.props @@ -151,7 +169,7 @@ VERBOSE=1 ./build.sh /clp:v=detailed install -dm 755 $RPM_BUILD_ROOT/%{_libdir}/%{pkg_name}/ # for debugging find bin/x64/Release/ -tar xf bin/x64/Release/dotnet-sdk-%{sdk_version}-centos.%{centos}-x64.tar.gz -C $RPM_BUILD_ROOT/%{_libdir}/%{pkg_name}/ +tar xf bin/x64/Release/dotnet-sdk-%{sdk_version}-*-x64.tar.gz -C $RPM_BUILD_ROOT/%{_libdir}/%{pkg_name}/ install -dm 755 $RPM_BUILD_ROOT/%{_root_datadir}/bash-completion/completions # dynamic completion needs the file to be named the same as the base command @@ -175,6 +193,9 @@ ln -s %{_libdir}/%{pkg_name}/dotnet $RPM_BUILD_ROOT/%{_bindir}/ mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1/ find -type f -iname 'dotnet*\.1' -exec cp {} $RPM_BUILD_ROOT/%{_mandir}/man1/ \; +echo "Testing build results for debug symbols..." +python %{SOURCE1} %{buildroot}%{_libdir}/dotnet/ + %files # empty package useful for dependencies @@ -194,7 +215,7 @@ find -type f -iname 'dotnet*\.1' -exec cp {} $RPM_BUILD_ROOT/%{_mandir}/man1/ \; %dir %{_libdir}/%{pkg_name}/shared/Microsoft.NETCore.App %{_libdir}/%{pkg_name}/shared/Microsoft.NETCore.App/%{runtime_version} -%files -n %{?scl_prefix}dotnet-sdk-2.0 +%files -n %{?scl_prefix}dotnet-sdk-2.1 #%doc LICENSE.TXT #%doc THIRD-PARTY-NOTICES.TXT %dir %{_libdir}/%{pkg_name}/sdk @@ -209,8 +230,14 @@ find -type f -iname 'dotnet*\.1' -exec cp {} $RPM_BUILD_ROOT/%{_mandir}/man1/ \; %{_root_datadir}/zsh/site-functions/%{name} %changelog -* Wed Nov 29 2017 Johnny Hughes - 2.0.3-4.1 -- Mod to use CentOS rid +* Thu Feb 8 2018 Omair Majid - 2.0.5-1 +- Update to .NET Core 2.0.5 + +* Mon Dec 11 2017 Omair Majid - 2.0.3-6 +- Add fixes to build on CentOS + +* Fri Dec 01 2017 Andrew Slice - 2.0.3-5 +- Add a test script to sanity check debug and symbol info. * Fri Nov 10 2017 Omair Majid - 2.0.3-4 - Make corefx build non-portable, which was how it was in 2.0.0