From 90e217831bfaa8e48f59f133dc8524cd5fcaed21 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Thu, 21 Sep 2017 15:20:55 +0000 Subject: [PATCH] Enable RHEL 6 support This change enables RHEL 6 support. It also adds a new command line option to the run-build.sh script that enables passing in a folder containing a bootstrap CLI. This helps in bringup of new target platforms. --- .../AppWithCorruptedLaunchSettings.csproj | 2 +- .../AppWithLaunchSettings.csproj | 2 +- .../AppWithLaunchSettingsNoDefault.csproj | 2 +- .../MSBuildTestApp/MSBuildTestApp.csproj | 2 +- build/BuildDefaults.props | 5 ++-- run-build.ps1 | 4 +-- run-build.sh | 27 +++++++++-------- scripts/obtain/dotnet-install.sh | 30 +++++++++++++++---- .../EnvironmentInfo.cs | 12 +++++++- 9 files changed, 58 insertions(+), 28 deletions(-) diff --git a/TestAssets/TestProjects/AppWithCorruptedLaunchSettings/AppWithCorruptedLaunchSettings.csproj b/TestAssets/TestProjects/AppWithCorruptedLaunchSettings/AppWithCorruptedLaunchSettings.csproj index f2064f994..fce4c7b68 100644 --- a/TestAssets/TestProjects/AppWithCorruptedLaunchSettings/AppWithCorruptedLaunchSettings.csproj +++ b/TestAssets/TestProjects/AppWithCorruptedLaunchSettings/AppWithCorruptedLaunchSettings.csproj @@ -4,6 +4,6 @@ Exe netcoreapp2.1 - win7-x64;win7-x86;osx.10.12-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64 + win7-x64;win7-x86;osx.10.12-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;rhel.6-x64;centos.7-x64;rhel.7-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64 diff --git a/TestAssets/TestProjects/AppWithLaunchSettings/AppWithLaunchSettings.csproj b/TestAssets/TestProjects/AppWithLaunchSettings/AppWithLaunchSettings.csproj index f2064f994..fce4c7b68 100644 --- a/TestAssets/TestProjects/AppWithLaunchSettings/AppWithLaunchSettings.csproj +++ b/TestAssets/TestProjects/AppWithLaunchSettings/AppWithLaunchSettings.csproj @@ -4,6 +4,6 @@ Exe netcoreapp2.1 - win7-x64;win7-x86;osx.10.12-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64 + win7-x64;win7-x86;osx.10.12-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;rhel.6-x64;centos.7-x64;rhel.7-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64 diff --git a/TestAssets/TestProjects/AppWithLaunchSettingsNoDefault/AppWithLaunchSettingsNoDefault.csproj b/TestAssets/TestProjects/AppWithLaunchSettingsNoDefault/AppWithLaunchSettingsNoDefault.csproj index f2064f994..fce4c7b68 100644 --- a/TestAssets/TestProjects/AppWithLaunchSettingsNoDefault/AppWithLaunchSettingsNoDefault.csproj +++ b/TestAssets/TestProjects/AppWithLaunchSettingsNoDefault/AppWithLaunchSettingsNoDefault.csproj @@ -4,6 +4,6 @@ Exe netcoreapp2.1 - win7-x64;win7-x86;osx.10.12-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64 + win7-x64;win7-x86;osx.10.12-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;rhel.6-x64;centos.7-x64;rhel.7-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64 diff --git a/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj index 0bfe9b1e3..58e9e4b5b 100644 --- a/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj +++ b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj @@ -4,7 +4,7 @@ Exe netcoreapp2.1 - win7-x64;win7-x86;osx.10.12-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64 + win7-x64;win7-x86;osx.10.12-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;rhel.6-x64;centos.7-x64;rhel.7-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64 $(TEST_PACKAGES) diff --git a/build/BuildDefaults.props b/build/BuildDefaults.props index 8561a45b0..c892e6068 100644 --- a/build/BuildDefaults.props +++ b/build/BuildDefaults.props @@ -3,9 +3,10 @@ Prepare;Compile;Test;Package;Publish Debug true + true false - true - true + true + true true diff --git a/run-build.ps1 b/run-build.ps1 index 255614894..86a767873 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -68,8 +68,8 @@ $env:VSTEST_TRACE_BUILD=1 # install a stage0 $dotnetInstallPath = Join-Path $RepoRoot "scripts\obtain\dotnet-install.ps1" -Write-Output "$dotnetInstallPath -Channel ""master"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" -Invoke-Expression "$dotnetInstallPath -Channel ""master"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" +Write-Output "$dotnetInstallPath -Channel ""master"" -version ""2.1.0-preview1-007172"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" +Invoke-Expression "$dotnetInstallPath -Channel ""master"" -version ""2.1.0-preview1-007172"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture""" if ($LastExitCode -ne 0) { Write-Output "The .NET CLI installation failed with exit code $LastExitCode" diff --git a/run-build.sh b/run-build.sh index 02ce271ab..3d3ec22d8 100755 --- a/run-build.sh +++ b/run-build.sh @@ -51,6 +51,8 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" REPOROOT="$DIR" ARCHITECTURE="x64" +BOOTSTRAP_CLI= + source "$REPOROOT/scripts/common/_prettyprint.sh" BUILD=1 @@ -61,51 +63,44 @@ CUSTOM_BUILD_ARGS= # Set nuget package cache under the repo [ -z $NUGET_PACKAGES ] && export NUGET_PACKAGES="$REPOROOT/.nuget/packages" -args=( "$@" ) +args=( ) while [[ $# > 0 ]]; do lowerI="$(echo $1 | awk '{print tolower($0)}')" case $lowerI in -c|--configuration) export CONFIGURATION=$2 - args=( "${args[@]/$1}" ) - args=( "${args[@]/$2}" ) shift ;; --nopackage) export DOTNET_BUILD_SKIP_PACKAGING=1 - args=( "${args[@]/$1}" ) ;; --skip-prereqs) # Allow CI to disable prereqs check since the CI has the pre-reqs but not ldconfig it seems export DOTNET_INSTALL_SKIP_PREREQS=1 - args=( "${args[@]/$1}" ) ;; --nobuild) BUILD=0 ;; --architecture) ARCHITECTURE=$2 - args=( "${args[@]/$1}" ) - args=( "${args[@]/$2}" ) shift ;; --runtime-id) CUSTOM_BUILD_ARGS="/p:Rid=\"$2\"" - args=( "${args[@]/$1}" ) - args=( "${args[@]/$2}" ) shift ;; # This is here just to eat away this parameter because CI still passes this in. --targets) - args=( "${args[@]/$1}" ) - args=( "${args[@]/$2}" ) shift ;; --linux-portable) LINUX_PORTABLE_INSTALL_ARGS="--runtime-id linux-x64" CUSTOM_BUILD_ARGS="/p:Rid=\"linux-x64\" /p:OSName=\"linux\" /p:IslinuxPortable=\"true\"" - args=( "${args[@]/$1}" ) + ;; + --bootstrap-cli) + BOOTSTRAP_CLI=$2 + shift ;; --help) echo "Usage: $0 [--configuration ] [--skip-prereqs] [--nopackage] [--docker ] [--help]" @@ -121,6 +116,7 @@ while [[ $# > 0 ]]; do exit 0 ;; *) + args=(${args[@]} $1) break ;; esac @@ -150,7 +146,12 @@ export VSTEST_TRACE_BUILD=1 export DOTNET_MULTILEVEL_LOOKUP=0 # Install a stage 0 -(set -x ; "$REPOROOT/scripts/obtain/dotnet-install.sh" --channel "master" --install-dir "$DOTNET_INSTALL_DIR" --architecture "$ARCHITECTURE" $LINUX_PORTABLE_INSTALL_ARGS) +if [ "$BOOTSTRAP_CLI" == "" ]; then + (set -x ; "$REPOROOT/scripts/obtain/dotnet-install.sh" --channel "master" --version "2.1.0-preview1-007172" --install-dir "$DOTNET_INSTALL_DIR" --architecture "$ARCHITECTURE" $LINUX_PORTABLE_INSTALL_ARGS) +else + echo "Copying bootstrap cli from $BOOTSTRAP_CLI" + cp -r $BOOTSTRAP_CLI/* "$DOTNET_INSTALL_DIR" +fi EXIT_CODE=$? if [ $EXIT_CODE != 0 ]; then diff --git a/scripts/obtain/dotnet-install.sh b/scripts/obtain/dotnet-install.sh index ae8f84be8..71dc18fa8 100755 --- a/scripts/obtain/dotnet-install.sh +++ b/scripts/obtain/dotnet-install.sh @@ -84,6 +84,10 @@ get_os_download_name_from_platform() { echo "opensuse.42.1" return 0 ;; + "rhel.6"*) + echo "rhel.6" + return 0 + ;; "rhel.7"*) echo "rhel" return 0 @@ -115,8 +119,14 @@ get_current_os_name() { if [ "$uname" = "Darwin" ]; then echo "osx" return 0 - else - if [ "$uname" = "Linux" ]; then + elif [ "$uname" = "Linux" ]; then + local distro_specific_osname + distro_specific_osname=$(get_distro_specific_os_name) || return 1 + + if [ "$distro_specific_osname" = "rhel.6" ]; then + echo $distro_specific_osname + return 0 + else echo "linux" return 0 fi @@ -144,6 +154,12 @@ get_distro_specific_os_name() { echo "$os" return 0 fi + elif [ -e /etc/redhat-release ]; then + local redhatRelease=$(