DEB start
This commit is contained in:
parent
2db1997bc0
commit
5ffdcd5797
3 changed files with 147 additions and 119 deletions
15
build/package/Microsoft.DotNet.Cli.Installer.DEB.props
Normal file
15
build/package/Microsoft.DotNet.Cli.Installer.DEB.props
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<DotnetDebToolPackageId>dotnet-deb-tool</DotnetDebToolPackageId>
|
||||
<DotnetDebToolVersion>1.0.0-*</DotnetDebToolVersion>
|
||||
<DotnetDebToolConsumerProjectName>dotnet-deb-tool-consumer</DotnetDebToolConsumerProjectName>
|
||||
<DotnetDebToolConfigJsonFileName>debian_config.json</DotnetDebToolConfigJsonFileName>
|
||||
|
||||
<DebLayoutPackageRootDirName>package_root</DebLayoutPackageRoot>
|
||||
<DebLayoutAbsolutePlacementDirName>$</DebLayoutAbsolutePlacement>
|
||||
<DebLayoutSamplesDirName>samples</DebLayoutSamplesDirName>
|
||||
<DebLayoutDocsDirName>docs</DebLayoutDocsDirName>
|
||||
<DebLayoutDebianFilesDirName>debian</DebLayoutDebianFilesDirName>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="Microsoft.DotNet.Cli.Installer.DEB.props" />
|
||||
<Target Name="SetupGenerateDebInputsOutputs">
|
||||
<Exec Command="/usr/bin/env debuild -h" ContinueOnError="true">
|
||||
<Output TaskParameter="ExitCode" PropertyName="DebuildExitCode" />
|
||||
|
@ -14,6 +15,9 @@
|
|||
<DebuildPresent>false</DebuildPresent>
|
||||
<DebuildPresent Condition=" '$(DebuildExitCode)' == '0' ">true</DebuildPresent>
|
||||
|
||||
<DotnetDebToolVersion></DotnetDebToolVersion>
|
||||
<DotnetDebToolPackageSource></DotnetDebToolPackageSource>
|
||||
|
||||
<DebianPackagingScript>$(RepoRoot)/scripts/package/package-debian.sh</DebianPackagingScript>
|
||||
<ManpagesDirectory>$(RepoRoot)/Documentation/manpages</ManpagesDirectory>
|
||||
|
||||
|
@ -53,11 +57,28 @@
|
|||
Inputs="@(SdkDebInputFiles);"
|
||||
Outputs="$(SdkInstallerFile)" >
|
||||
|
||||
<!-- Clean the workspace -->
|
||||
<ItemGroup>
|
||||
<SdkDebianFilesToClean Remove="*" />
|
||||
<SdkDebianFilesToClean Include="$(SdkInstallerFile)" />
|
||||
|
||||
<SdkDebianDirectoriesToClean Remove="*" />
|
||||
<SdkDebianDirectoriesToClean Include="$(SdkDebianIntermediateDirectory)" />
|
||||
<SdkDebianDirectoriesToClean Include="$(SdkDebianLayoutOutputDirectory)" />
|
||||
</ItemGroup>
|
||||
|
||||
<Delete Condition=" 'Exists(%(SdkDebianFilesToClean))' " Files="%(SdkDebianFilesToClean)" />
|
||||
<RemoveDir Condition=" 'Exists(%(SdkDebianDirectoriesToClean))' " Directories="%(SdkDebianDirectoriesToClean)" />
|
||||
<MakeDir Directories="@(SdkDebianDirectoriesToClean)" />
|
||||
|
||||
<!-- Install Packages -->
|
||||
<Exec Command="sudo dpkg -i $(DownloadedSharedHostInstallerFile)" />
|
||||
<Exec Command="sudo dpkg -i $(DownloadedHostFxrInstallerFile)" />
|
||||
<Exec Command="sudo dpkg -i $(DownloadedSharedFrameworkInstallerFile)" />
|
||||
|
||||
<!-- Create layout -->
|
||||
|
||||
|
||||
<Exec Command="'$(DebianPackagingScript)'
|
||||
-v '$(SdkVersion)'
|
||||
-i '$(SdkLayoutOutputDirectory)'
|
||||
|
@ -111,4 +132,20 @@
|
|||
GenerateSdkDeb;
|
||||
TestSdkDeb;"
|
||||
Condition=" '$(OSName)' == 'ubuntu' " />
|
||||
|
||||
<Target Name="PrepareDotnetDebTool"
|
||||
DependsOnTargets="WriteDotnetDebToolProjectJson;">
|
||||
|
||||
</Target>
|
||||
|
||||
<Target Name="WriteDotnetDebToolProjectJson" >
|
||||
<ItemGroup>
|
||||
<AssemblyInfoLines Include="{" />
|
||||
<AssemblyInfoLines Include="%20%20%20%20"version": "1.0.0-*"," />
|
||||
<AssemblyInfoLines Include="%20%20%20%20"name": "$(DotnetDebToolConsumerProjectName)"," />
|
||||
<AssemblyInfoLines Include="%20%20%20%20"frameworks": { "netcoreapp1.0": {} }," />
|
||||
<AssemblyInfoLines Include="%20%20%20%20"tools": {{"$(DotnetDebToolPackageId)": "$(DotnetDebToolVersion)" }}" />
|
||||
<AssemblyInfoLines Include="}" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -9,35 +9,22 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class DebPackageCreator
|
||||
{
|
||||
private static readonly string s_dotnetDebToolPackageId = "dotnet-deb-tool";
|
||||
private static readonly string s_toolConsumerProjectName = "dotnet-deb-tool-consumer";
|
||||
private static readonly string s_debianConfigJsonFileName = "debian_config.json";
|
||||
|
||||
private DotNetCli _dotnet;
|
||||
private string _dotnet;
|
||||
private string _intermediateDirectory;
|
||||
private string _dotnetDebToolVersion;
|
||||
private string _dotnetDebToolPackageSource;
|
||||
private string _consumingProjectDirectory;
|
||||
|
||||
public DebPackageCreator(
|
||||
DotNetCli dotnet,
|
||||
string dotnet,
|
||||
string intermediateDirectory,
|
||||
string dotnetDebToolVersion = "1.0.0-*",
|
||||
string dotnetDebToolVersion,
|
||||
string dotnetDebToolPackageSource = null)
|
||||
{
|
||||
_dotnet = dotnet;
|
||||
_intermediateDirectory = intermediateDirectory;
|
||||
_dotnetDebToolVersion = dotnetDebToolVersion;
|
||||
_dotnetDebToolPackageSource = dotnetDebToolPackageSource;
|
||||
|
||||
_consumingProjectDirectory = Path.Combine(_intermediateDirectory, s_toolConsumerProjectName);
|
||||
|
||||
InitializeDotnetDebTool();
|
||||
}
|
||||
|
||||
|
@ -53,11 +40,6 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
IEnumerable<string> debianFiles = null)
|
||||
{
|
||||
string debIntermediatesDirectory = Path.Combine(_intermediateDirectory, packageName, packageVersion);
|
||||
if (Directory.Exists(debIntermediatesDirectory))
|
||||
{
|
||||
FS.Rmdir(debIntermediatesDirectory);
|
||||
}
|
||||
FS.Mkdirp(debIntermediatesDirectory);
|
||||
|
||||
string layoutDirectory = Path.Combine(debIntermediatesDirectory, "debianLayoutDirectory");
|
||||
var debianLayoutDirectories = new DebianLayoutDirectories(layoutDirectory);
|
||||
|
@ -77,12 +59,6 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
private void CreateEmptyDebianLayout(DebianLayoutDirectories layoutDirectories)
|
||||
{
|
||||
if (Directory.Exists(layoutDirectories.LayoutDirectory))
|
||||
{
|
||||
FS.Rmdir(layoutDirectories.LayoutDirectory);
|
||||
}
|
||||
Directory.CreateDirectory(layoutDirectories.LayoutDirectory);
|
||||
|
||||
Directory.CreateDirectory(layoutDirectories.AbsolutePlacement);
|
||||
Directory.CreateDirectory(layoutDirectories.PackageRoot);
|
||||
Directory.CreateDirectory(layoutDirectories.Samples);
|
||||
|
|
Loading…
Reference in a new issue