Update CoreCLR & Corefx dependencies based on ldd method.
Use a hardcoded list for ubuntu and slight refactoring for cleaner targets code.
This commit is contained in:
parent
6d8b622451
commit
ade5479196
5 changed files with 209 additions and 66 deletions
|
@ -6,39 +6,80 @@
|
|||
# Dockerfile that creates a container suitable to build dotnet-cli
|
||||
FROM ubuntu:14.04
|
||||
|
||||
# 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)
|
||||
# Install CoreCLR and CoreFx dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get -qqy install unzip curl libicu-dev libunwind8 gettext libssl-dev libcurl4-openssl-dev zlib1g liblttng-ust-dev lldb-3.6-dev lldb-3.6
|
||||
RUN echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-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 \
|
||||
liburcu1 \
|
||||
libuuid1 \
|
||||
zlib1g \
|
||||
libasn1-8-heimdal \
|
||||
libcomerr2 \
|
||||
libcurl3 \
|
||||
libgcrypt11 \
|
||||
libgnutls26 \
|
||||
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 \
|
||||
librtmp0 \
|
||||
libsasl2-2 \
|
||||
libsqlite3-0 \
|
||||
libssl1.0.0 \
|
||||
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 echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-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 install -y debhelper build-essential devscripts git cmake
|
||||
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
|
||||
|
||||
# Install azure cli. We need this to publish artifacts.
|
||||
RUN apt-get -y install nodejs-legacy && \
|
||||
apt-get -y install npm && \
|
||||
RUN apt-get -qqy install nodejs-legacy && \
|
||||
apt-get -qqy install npm && \
|
||||
npm install -g azure-cli
|
||||
|
||||
|
||||
RUN apt-get install -qqy sudo
|
||||
|
||||
# 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 permssions on these directories
|
||||
# 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
|
||||
|
|
96
scripts/dotnet-cli-build/PackageDependencies.cs
Normal file
96
scripts/dotnet-cli-build/PackageDependencies.cs
Normal file
|
@ -0,0 +1,96 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class PackageDependencies
|
||||
{
|
||||
internal static string[] DebianPackageBuildDependencies
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"devscripts",
|
||||
"debhelper",
|
||||
"build-essential"
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
internal static string[] UbuntuCoreclrAndCoreFxDependencies
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"libc6",
|
||||
"libedit2",
|
||||
"libffi6",
|
||||
"libgcc1",
|
||||
"libicu52",
|
||||
"liblldb-3.6",
|
||||
"libllvm3.6",
|
||||
"liblttng-ust0",
|
||||
"liblzma5",
|
||||
"libncurses5",
|
||||
"libpython2.7",
|
||||
"libstdc++6",
|
||||
"libtinfo5",
|
||||
"libunwind8",
|
||||
"liburcu1",
|
||||
"libuuid1",
|
||||
"zlib1g",
|
||||
"libasn1-8-heimdal",
|
||||
"libcomerr2",
|
||||
"libcurl3",
|
||||
"libgcrypt11",
|
||||
"libgnutls26",
|
||||
"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",
|
||||
"librtmp0",
|
||||
"libsasl2-2",
|
||||
"libsqlite3-0",
|
||||
"libssl1.0.0",
|
||||
"libtasn1-6",
|
||||
"libwind0-heimdal"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal static string[] CentosCoreclrAndCoreFxDependencies
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"unzip",
|
||||
"libunwind",
|
||||
"gettext",
|
||||
"libcurl-devel",
|
||||
"openssl-devel",
|
||||
"zlib",
|
||||
"libicu-devel"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
[Target(nameof(CheckCoreclrPlatformDependencies), nameof(CheckInstallerBuildPlatformDependencies))]
|
||||
public static BuildTargetResult CheckPlatformDependencies(BuildTargetContext c) => c.Success();
|
||||
|
||||
[Target(nameof(CheckUbuntuCoreclrDependencies), nameof(CheckCentOSCoreclrDependencies))]
|
||||
[Target(nameof(CheckUbuntuCoreclrAndCoreFxDependencies), nameof(CheckCentOSCoreclrAndCoreFxDependencies))]
|
||||
public static BuildTargetResult CheckCoreclrPlatformDependencies(BuildTargetContext c) => c.Success();
|
||||
|
||||
[Target(nameof(CheckUbuntuDebianPackageBuildDependencies))]
|
||||
|
@ -185,18 +185,14 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||
public static BuildTargetResult CheckUbuntuDebianPackageBuildDependencies(BuildTargetContext c)
|
||||
{
|
||||
var debianPackageBuildDependencies = new string[]
|
||||
{
|
||||
"devscripts",
|
||||
"debhelper",
|
||||
"build-essential"
|
||||
};
|
||||
|
||||
var messageBuilder = new StringBuilder();
|
||||
var aptDependencyUtility = new AptDependencyUtility();
|
||||
|
||||
foreach (var package in debianPackageBuildDependencies)
|
||||
|
||||
foreach (var package in PackageDependencies.DebianPackageBuildDependencies)
|
||||
{
|
||||
if (!AptPackageIsInstalled(package))
|
||||
if (!AptDependencyUtility.PackageIsInstalled(package))
|
||||
{
|
||||
messageBuilder.Append($"Error: Debian package build dependency {package} missing.");
|
||||
messageBuilder.Append(Environment.NewLine);
|
||||
|
@ -217,28 +213,14 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||
public static BuildTargetResult CheckUbuntuCoreclrDependencies(BuildTargetContext c)
|
||||
public static BuildTargetResult CheckUbuntuCoreclrAndCoreFxDependencies(BuildTargetContext c)
|
||||
{
|
||||
var errorMessageBuilder = new StringBuilder();
|
||||
var stage0 = DotNetCli.Stage0.BinPath;
|
||||
|
||||
var ubuntuCoreclrDependencies = new string[]
|
||||
foreach (var package in PackageDependencies.UbuntuCoreclrAndCoreFxDependencies)
|
||||
{
|
||||
"unzip",
|
||||
"curl",
|
||||
"libicu-dev",
|
||||
"libunwind8",
|
||||
"gettext",
|
||||
"libssl-dev",
|
||||
"libcurl4-openssl-dev",
|
||||
"zlib1g",
|
||||
"liblttng-ust-dev",
|
||||
"lldb-3.6-dev",
|
||||
"lldb-3.6"
|
||||
};
|
||||
|
||||
foreach (var package in ubuntuCoreclrDependencies)
|
||||
{
|
||||
if (!AptPackageIsInstalled(package))
|
||||
if (!AptDependencyUtility.PackageIsInstalled(package))
|
||||
{
|
||||
errorMessageBuilder.Append($"Error: Coreclr package dependency {package} missing.");
|
||||
errorMessageBuilder.Append(Environment.NewLine);
|
||||
|
@ -259,24 +241,13 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.CentOS)]
|
||||
public static BuildTargetResult CheckCentOSCoreclrDependencies(BuildTargetContext c)
|
||||
public static BuildTargetResult CheckCentOSCoreclrAndCoreFxDependencies(BuildTargetContext c)
|
||||
{
|
||||
var errorMessageBuilder = new StringBuilder();
|
||||
|
||||
var centOSCoreclrDependencies = new string[]
|
||||
|
||||
foreach (var package in PackageDependencies.CentosCoreclrAndCoreFxDependencies)
|
||||
{
|
||||
"unzip",
|
||||
"libunwind",
|
||||
"gettext",
|
||||
"libcurl-devel",
|
||||
"openssl-devel",
|
||||
"zlib",
|
||||
"libicu-devel"
|
||||
};
|
||||
|
||||
foreach (var package in centOSCoreclrDependencies)
|
||||
{
|
||||
if (!YumPackageIsInstalled(package))
|
||||
if (!YumDependencyUtility.PackageIsInstalled(package))
|
||||
{
|
||||
errorMessageBuilder.Append($"Error: Coreclr package dependency {package} missing.");
|
||||
errorMessageBuilder.Append(Environment.NewLine);
|
||||
|
@ -338,17 +309,6 @@ cmake is required to build the native host 'corehost'";
|
|||
return result.ExitCode == 0;
|
||||
}
|
||||
|
||||
private static bool YumPackageIsInstalled(string packageName)
|
||||
{
|
||||
var result = Command.Create("yum", "list", "installed", packageName)
|
||||
.CaptureStdOut()
|
||||
.CaptureStdErr()
|
||||
.QuietBuildReporter()
|
||||
.Execute();
|
||||
|
||||
return result.ExitCode == 0;
|
||||
}
|
||||
|
||||
private static IDictionary<string, string> ReadBranchInfo(BuildTargetContext c, string path)
|
||||
{
|
||||
var lines = File.ReadAllLines(path);
|
||||
|
|
24
scripts/dotnet-cli-build/Utils/AptDependencyUtility.cs
Normal file
24
scripts/dotnet-cli-build/Utils/AptDependencyUtility.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class AptDependencyUtility
|
||||
{
|
||||
internal static bool PackageIsInstalled(string packageName)
|
||||
{
|
||||
var result = Command.Create("dpkg", "-s", packageName)
|
||||
.CaptureStdOut()
|
||||
.CaptureStdErr()
|
||||
.QuietBuildReporter()
|
||||
.Execute();
|
||||
|
||||
return result.ExitCode == 0;
|
||||
}
|
||||
}
|
||||
}
|
22
scripts/dotnet-cli-build/Utils/YumDependencyUtility.cs
Normal file
22
scripts/dotnet-cli-build/Utils/YumDependencyUtility.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class YumDependencyUtility
|
||||
{
|
||||
internal static bool PackageIsInstalled(string packageName)
|
||||
{
|
||||
var result = Command.Create("yum", "list", "installed", packageName)
|
||||
.CaptureStdOut()
|
||||
.CaptureStdErr()
|
||||
.QuietBuildReporter()
|
||||
.Execute();
|
||||
|
||||
return result.ExitCode == 0;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue