Fixing Ubuntu packaging issue, part 99 of hopefully 99.

This commit is contained in:
Livar Cunha 2016-07-06 16:45:41 -07:00
parent 8eb05a4deb
commit 5d40e8b734
4 changed files with 25 additions and 12 deletions

View file

@ -3,12 +3,7 @@
<UsingTask TaskName="DebTargets" AssemblyFile="$(CLIBuildDll)" />
<PropertyGroup>
<CLISDKRoot>$(LayoutDirectory)/$(ArtifactNameSdk)/sdk</CLISDKRoot>
</PropertyGroup>
<Target Name="GenerateDebs" >
<DebTargets />
<DebTargets CLISDKRoot="$(LayoutDirectory)/$(ArtifactNameSdk)/sdk" />
</Target>
</Project>

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Runtime.InteropServices;
using Microsoft.Build.Framework;
using Microsoft.DotNet.Cli.Build.Framework;
using Microsoft.DotNet.InternalAbstractions;
@ -13,6 +14,9 @@ namespace Microsoft.DotNet.Cli.Build
{
public class DebTargets : Task
{
[Required]
public string CLISDKRoot { get; set; }
public override bool Execute()
{
BuildContext context = new BuildSetup("MSBuild").UseAllTargetsFromAssembly<DebTargets>().CreateBuildContext();
@ -21,7 +25,7 @@ namespace Microsoft.DotNet.Cli.Build
return GenerateDebs(c).Success;
}
public static BuildTargetResult GenerateDebs(BuildTargetContext c)
public BuildTargetResult GenerateDebs(BuildTargetContext c)
{
if (CurrentPlatform.IsPlatform(BuildPlatform.Ubuntu))
{
@ -32,7 +36,7 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
public static BuildTargetResult GenerateSdkDeb(BuildTargetContext c)
public BuildTargetResult GenerateSdkDeb(BuildTargetContext c)
{
if (CurrentPlatform.IsPlatform(BuildPlatform.Ubuntu))
{
@ -53,7 +57,6 @@ namespace Microsoft.DotNet.Cli.Build
var debFile = c.BuildContext.Get<string>("SdkInstallerFile");
var manPagesDir = Path.Combine(Dirs.RepoRoot, "Documentation", "manpages");
var previousVersionURL = $"https://dotnetcli.blob.core.windows.net/dotnet/{channel}/Installers/Latest/dotnet-ubuntu-x64.latest.deb";
var sdkPublishRoot = c.BuildContext.Get<string>("CLISDKRoot");
var sharedFxDebianPackageName = Monikers.GetDebianSharedFrameworkPackageName(CliDependencyVersions.SharedFrameworkVersion);
var objRoot = Path.Combine(Dirs.Output, "obj", "debian", "sdk");
@ -67,7 +70,7 @@ namespace Microsoft.DotNet.Cli.Build
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-debian.sh"),
"-v", version,
"-i", sdkPublishRoot,
"-i", CLISDKRoot,
"-o", debFile,
"-p", packageName,
"-b", Monikers.CLISdkBrandName,

View file

@ -6,9 +6,14 @@ namespace Microsoft.DotNet.Cli.Build
{
public static BuildTargetResult GenerateInstaller(BuildTargetContext c)
{
var debTargets = new DebTargets
{
CLISDKRoot = c.BuildContext.Get<string>("CLISDKRoot")
};
MsiTargets.GenerateMsisAndBundles(c);
PkgTargets.GeneratePkgs(c);
DebTargets.GenerateDebs(c);
debTargets.GenerateDebs(c);
return c.Success();
}

View file

@ -22,19 +22,24 @@ source "$REPOROOT/scripts/common/_prettyprint.sh"
# Set nuget package cache under the repo
export NUGET_PACKAGES="$REPOROOT/.nuget/packages"
args=( "$0" )
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}" )
;;
--help)
echo "Usage: $0 [--configuration <CONFIGURATION>] [--targets <TARGETS...>] [--skip-prereqs] [--nopackage] [--docker <IMAGENAME>] [--help]"
@ -55,6 +60,11 @@ while [[ $# > 0 ]]; do
shift
done
# $args array may have empty elements in it.
# The easiest way to remove them is to cast to string and back to array.
temp="${args[@]}"
args=($temp)
# Load Branch Info
while read line; do
if [[ $line != \#* ]]; then
@ -83,4 +93,4 @@ fi
# Disable first run since we want to control all package sources
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
dotnet build3 build.proj /p:Architecture=$ARCHITECTURE
dotnet build3 build.proj /p:Architecture=$ARCHITECTURE "${args[@]}"