Merge pull request #2472 from MichaelSimons/debianbuild

Add support for Debian CLI builds
This commit is contained in:
Piotr Puszkiewicz 2016-04-15 16:02:23 -07:00
commit 859a2220f1
16 changed files with 192 additions and 5 deletions

View file

@ -21,7 +21,7 @@
"ubuntu.14.04-x64": {}, "ubuntu.14.04-x64": {},
"centos.7-x64": {}, "centos.7-x64": {},
"rhel.7.2-x64": {}, "rhel.7.2-x64": {},
"debian.8.2-x64": {} "debian.8-x64": {}
}, },
"runtimeOptions": { "runtimeOptions": {

View file

@ -21,7 +21,7 @@
"ubuntu.14.04-x64": {}, "ubuntu.14.04-x64": {},
"centos.7-x64": {}, "centos.7-x64": {},
"rhel.7.2-x64": {}, "rhel.7.2-x64": {},
"debian.8.2-x64": {} "debian.8-x64": {}
}, },
"runtimeOptions": { "runtimeOptions": {
"somethingString": "anything", "somethingString": "anything",

View file

@ -9,7 +9,7 @@ def project = GithubProject
def branch = GithubBranchName def branch = GithubBranchName
def isPR = true def isPR = true
def platformList = ['Ubuntu:x64:Debug', 'Ubuntu:x64:Release', 'OSX:x64:Release', 'Windows_NT:x64:Release', 'Windows_NT:x86:Debug', 'RHEL7.2:x64:Release', 'CentOS7.1:x64:Debug'] def platformList = ['Debian8.2:x64:Debug', 'Ubuntu:x64:Release', 'OSX:x64:Release', 'Windows_NT:x64:Release', 'Windows_NT:x86:Debug', 'RHEL7.2:x64:Release', 'CentOS7.1:x64:Debug']
def static getBuildJobName(def configuration, def os, def architecture) { def static getBuildJobName(def configuration, def os, def architecture) {
return configuration.toLowerCase() + '_' + os.toLowerCase() + '_' + architecture.toLowerCase() return configuration.toLowerCase() + '_' + os.toLowerCase() + '_' + architecture.toLowerCase()

View file

@ -27,6 +27,10 @@
<OSGroup>Linux</OSGroup> <OSGroup>Linux</OSGroup>
<Platform>amd64</Platform> <Platform>amd64</Platform>
</Project> </Project>
<Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroName)' == 'debian'" Include="debian/Microsoft.NETCore.DotNetHost.pkgproj">
<OSGroup>Linux</OSGroup>
<Platform>amd64</Platform>
</Project>
<Project Condition="'$(TargetsOSX)' == 'true'" Include="osx/Microsoft.NETCore.DotNetHost.pkgproj"> <Project Condition="'$(TargetsOSX)' == 'true'" Include="osx/Microsoft.NETCore.DotNetHost.pkgproj">
<OSGroup>OSX</OSGroup> <OSGroup>OSX</OSGroup>
<Platform>amd64</Platform> <Platform>amd64</Platform>

View file

@ -27,6 +27,9 @@
<ProjectReference Include="ubuntu\Microsoft.NETCore.DotNetHost.pkgproj"> <ProjectReference Include="ubuntu\Microsoft.NETCore.DotNetHost.pkgproj">
<Platform>amd64</Platform> <Platform>amd64</Platform>
</ProjectReference> </ProjectReference>
<ProjectReference Include="debian\Microsoft.NETCore.DotNetHost.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />

View file

@ -27,6 +27,10 @@
<OSGroup>Linux</OSGroup> <OSGroup>Linux</OSGroup>
<Platform>amd64</Platform> <Platform>amd64</Platform>
</Project> </Project>
<Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroName)' == 'debian'" Include="debian/Microsoft.NETCore.DotNetHostPolicy.pkgproj">
<OSGroup>Linux</OSGroup>
<Platform>amd64</Platform>
</Project>
<Project Condition="'$(TargetsOSX)' == 'true'" Include="osx/Microsoft.NETCore.DotNetHostPolicy.pkgproj"> <Project Condition="'$(TargetsOSX)' == 'true'" Include="osx/Microsoft.NETCore.DotNetHostPolicy.pkgproj">
<OSGroup>OSX</OSGroup> <OSGroup>OSX</OSGroup>
<Platform>amd64</Platform> <Platform>amd64</Platform>

View file

@ -30,6 +30,9 @@
<ProjectReference Include="ubuntu\Microsoft.NETCore.DotNetHostPolicy.pkgproj"> <ProjectReference Include="ubuntu\Microsoft.NETCore.DotNetHostPolicy.pkgproj">
<Platform>amd64</Platform> <Platform>amd64</Platform>
</ProjectReference> </ProjectReference>
<ProjectReference Include="debian\Microsoft.NETCore.DotNetHostPolicy.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />

View file

@ -27,6 +27,10 @@
<OSGroup>Linux</OSGroup> <OSGroup>Linux</OSGroup>
<Platform>amd64</Platform> <Platform>amd64</Platform>
</Project> </Project>
<Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroName)' == 'debian'" Include="debian/Microsoft.NETCore.DotNetHostResolver.pkgproj">
<OSGroup>Linux</OSGroup>
<Platform>amd64</Platform>
</Project>
<Project Condition="'$(TargetsOSX)' == 'true'" Include="osx/Microsoft.NETCore.DotNetHostResolver.pkgproj"> <Project Condition="'$(TargetsOSX)' == 'true'" Include="osx/Microsoft.NETCore.DotNetHostResolver.pkgproj">
<OSGroup>OSX</OSGroup> <OSGroup>OSX</OSGroup>
<Platform>amd64</Platform> <Platform>amd64</Platform>

View file

@ -30,6 +30,9 @@
<ProjectReference Include="ubuntu\Microsoft.NETCore.DotNetHostResolver.pkgproj"> <ProjectReference Include="ubuntu\Microsoft.NETCore.DotNetHostResolver.pkgproj">
<Platform>amd64</Platform> <Platform>amd64</Platform>
</ProjectReference> </ProjectReference>
<ProjectReference Include="debian\Microsoft.NETCore.DotNetHostResolver.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<Version>$(HostVersion)</Version>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<MinOSForArch>debian.8</MinOSForArch>
<PackageTargetRuntime>$(MinOSForArch)-$(PackagePlatform)</PackageTargetRuntime>
</PropertyGroup>
<ItemGroup>
<ArchitectureSpecificNativeFile Include="$(DotNetHostBinDir)/dotnet" />
<File Include="@(ArchitectureSpecificNativeFile)">
<TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
</File>
<File Include="$(ProjectDir)/version.txt" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<Version>$(HostPolicyVersion)</Version>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<MinOSForArch>debian.8</MinOSForArch>
<PackageTargetRuntime>$(MinOSForArch)-$(PackagePlatform)</PackageTargetRuntime>
</PropertyGroup>
<ItemGroup>
<Dependency Include="Microsoft.NETCore.DotNetHostResolver">
<Version>$(HostResolverFullVersion)</Version>
</Dependency>
<ArchitectureSpecificNativeFile Include="$(DotNetHostBinDir)/libhostpolicy.so"/>
<File Include="@(ArchitectureSpecificNativeFile)">
<TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
</File>
<File Include="$(ProjectDir)/version.txt" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<Version>$(HostResolverVersion)</Version>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<MinOSForArch>debian.8</MinOSForArch>
<PackageTargetRuntime>$(MinOSForArch)-$(PackagePlatform)</PackageTargetRuntime>
</PropertyGroup>
<ItemGroup>
<Dependency Include="Microsoft.NETCore.DotNetHost">
<Version>$(HostFullVersion)</Version>
</Dependency>
<ArchitectureSpecificNativeFile Include="$(DotNetHostBinDir)/libhostfxr.so"/>
<File Include="@(ArchitectureSpecificNativeFile)">
<TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
</File>
<File Include="$(ProjectDir)/version.txt" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View file

@ -0,0 +1,89 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
# Dockerfile that creates a container suitable to build dotnet-cli
FROM debian:jessie
# Misc Dependencies for build
RUN apt-get update && apt-get -qqy install curl unzip gettext sudo
# This could become a "microsoft/coreclr" image, since it just installs the dependencies for CoreCLR (and stdlib)
RUN echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.6 main" | tee /etc/apt/sources.list.d/llvm.list && \
curl http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - && \
apt-get update && apt-get -qqy install\
libc6 \
libedit2 \
libffi6 \
libgcc1 \
libicu52 \
liblldb-3.6 \
libllvm3.6 \
liblttng-ust0 \
liblzma5 \
libncurses5 \
libpython2.7 \
libstdc++6 \
libtinfo5 \
libunwind8 \
libuuid1 \
zlib1g \
libasn1-8-heimdal \
libcomerr2 \
libcurl3 \
libgpg-error0 \
libgssapi3-heimdal \
libgssapi-krb5-2 \
libhcrypto4-heimdal \
libheimbase1-heimdal \
libheimntlm0-heimdal \
libhx509-5-heimdal \
libidn11 \
libk5crypto3 \
libkeyutils1 \
libkrb5-26-heimdal \
libkrb5-3 \
libkrb5support0 \
libldap-2.4-2 \
libp11-kit0 \
libroken18-heimdal \
libsasl2-2 \
libsqlite3-0 \
libssl1.0.0 \
libssl-dev \
libtasn1-6 \
libwind0-heimdal
# Install Dotnet CLI dependencies.
# clang is required for dotnet-compile-native
RUN apt-get -qqy install clang-3.5
# Install Build Prereqs
RUN apt-get -qq install -y debhelper build-essential devscripts git cmake
# Use clang as c++ compiler
RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-3.5 100
RUN update-alternatives --set c++ /usr/bin/clang++-3.5
# Setup User to match Host User, and give superuser permissions
ARG USER_ID=0
RUN useradd -m code_executor -u ${USER_ID} -g sudo
RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# With the User Change, we need to change permissions on these directories
RUN chmod -R a+rwx /usr/local
RUN chmod -R a+rwx /home
RUN chmod -R 755 /usr/lib/sudo
# Set user to the one we just created
USER ${USER_ID}
# Set working directory
WORKDIR /opt/code
# Work around https://github.com/dotnet/cli/issues/1582 until Docker releases a
# fix (https://github.com/docker/docker/issues/20818). This workaround allows
# the container to be run with the default seccomp Docker settings by avoiding
# the restart_syscall made by LTTng which causes a failed assertion.
ENV LTTNG_UST_REGISTER_TIMEOUT 0

View file

@ -61,6 +61,9 @@ if [ -z "$DOCKERFILE" ]; then
elif [ "$(cat /etc/*-release | grep -cim1 centos)" -eq 1 ]; then elif [ "$(cat /etc/*-release | grep -cim1 centos)" -eq 1 ]; then
echo "Detected current OS as CentOS, using 'centos' image" echo "Detected current OS as CentOS, using 'centos' image"
export DOCKERFILE=scripts/docker/centos export DOCKERFILE=scripts/docker/centos
elif [ "$(cat /etc/*-release | grep -cim1 debian)" -eq 1 ]; then
echo "Detected current OS as Debian, using 'debian' image"
export DOCKERFILE=scripts/docker/debian
else else
echo "Unknown Linux Distro. Using 'ubuntu' image" echo "Unknown Linux Distro. Using 'ubuntu' image"
export DOCKERFILE=scripts/docker/ubuntu export DOCKERFILE=scripts/docker/ubuntu

View file

@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Cli.Build
} }
else if (CurrentPlatform.IsDebian) else if (CurrentPlatform.IsDebian)
{ {
packageId = "runtime.debian.8.2-x64.Microsoft.NETCore.Runtime.CoreCLR"; packageId = "runtime.debian.8-x64.Microsoft.NETCore.Runtime.CoreCLR";
} }
else else
{ {

View file

@ -18,7 +18,7 @@ init_distro_name_and_rid()
export __rid_plat=rhel.7 export __rid_plat=rhel.7
elif [ "$(cat /etc/*-release | grep -cim1 debian)" -eq 1 ]; then elif [ "$(cat /etc/*-release | grep -cim1 debian)" -eq 1 ]; then
export __distro_name=debian export __distro_name=debian
export __rid_plat= export __rid_plat=debian.8
else else
export __distro_name="" export __distro_name=""
export __rid_plat= export __rid_plat=