Produce deb packages

This commit is contained in:
Daniel Plaisted 2018-11-01 23:15:59 -07:00
parent 8d026b422e
commit 143bee75ff
16 changed files with 116 additions and 45 deletions

39
eng/restore-toolset.sh Normal file
View file

@ -0,0 +1,39 @@
function InitializeCustomSDKToolset {
if [[ "$restore" != true ]]; then
return
fi
# The following frameworks and tools are used only for testing.
# Do not attempt to install them in source build.
if [[ "${DotNetBuildFromSource:-}" == "true" ]]; then
return
fi
#InstallDotNetSharedFramework "1.0.5"
#InstallDotNetSharedFramework "1.1.2"
# Install 2.1 framework for dotnet-deb-tool
InstallDotNetSharedFramework "2.1.0"
}
# Installs additional shared frameworks for testing purposes
function InstallDotNetSharedFramework {
local version=$1
local dotnet_root=$DOTNET_INSTALL_DIR
local fx_dir="$dotnet_root/shared/Microsoft.NETCore.App/$version"
if [[ ! -d "$fx_dir" ]]; then
GetDotNetInstallScript "$dotnet_root"
local install_script=$_GetDotNetInstallScript
bash "$install_script" --version $version --install-dir "$dotnet_root" --runtime "dotnet"
local lastexitcode=$?
if [[ $lastexitcode != 0 ]]; then
echo "Failed to install Shared Framework $version to '$dotnet_root' (exit code '$lastexitcode')."
ExitWithExitCode $lastexitcode
fi
fi
}
InitializeCustomSDKToolset

View file

@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFrameworks>$(CoreSdkTargetFramework);net472</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">$(CoreSdkTargetFramework)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View file

@ -15,6 +15,7 @@
<Import Project="targets\GenerateArchives.targets" />
<Import Project="targets\GenerateMSIs.targets" />
<Import Project="targets\LinuxNativeInstallerDependencyVersions.targets" />
<Import Project="targets\GenerateDebs.targets" />
</Project>

View file

@ -27,4 +27,7 @@
<UsingTask TaskName="TarGzFileCreateFromDirectory" AssemblyFile="$(CoreSdkTaskDll)" />
<UsingTask TaskName="GenerateMsiVersion" AssemblyFile="$(CoreSdkTaskDll)" />
<UsingTask TaskName="GenerateGuidFromName" AssemblyFile="$(CoreSdkTaskDll)" />
<UsingTask TaskName="ReplaceFileContents" AssemblyFile="$(CoreSdkTaskDll)" />
<UsingTask TaskName="Chmod" AssemblyFile="$(CoreSdkTaskDll)" />
<UsingTask TaskName="DotNetDebTool" AssemblyFile="$(CoreSdkTaskDll)" />
</Project>

View file

@ -1,15 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="DotNetDebTool" AssemblyFile="$(CLIBuildDll)" />
<!-- dotnet deb-tool -->
<ItemGroup>
<DotNetCliToolReference Include="dotnet-deb-tool" Version="$(DotnetDebToolVersion)" />
</ItemGroup>
<Target Name="SetupDebProps"
DependsOnTargets="Init;
CalculateLinuxNativeInstallerDependencyVersions">
<!-- dotnet deb-tool -->
DependsOnTargets="SetSdkVersionInfo;
GetCurrentRuntimeInformation;
SetupFileExtensions;
CalculateLinuxNativeInstallerDependencyVersions;
SetSdkBrandingInfo">
<PropertyGroup>
<DotnetDebToolDir>$(MSBuildThisFileDirectory)/dotnet-deb-tool-consumer</DotnetDebToolDir>
<PackageTool>$(NuGetPackagesDir)/dotnet-deb-tool/$(DotnetDebToolVersion)/lib/netcoreapp2.0/tool/package_tool</PackageTool>
<DotnetDebToolDir>$(MSBuildProjectDirectory)</DotnetDebToolDir>
<!--<DotnetDebToolDir>$(MSBuildThisFileDirectory)/dotnet-deb-tool-consumer</DotnetDebToolDir>-->
<!--<PackageTool>$(NuGetPackagesDir)/dotnet-deb-tool/$(DotnetDebToolVersion)/lib/netcoreapp2.0/tool/package_tool</PackageTool>-->
</PropertyGroup>
<!-- constants -->
@ -48,9 +54,11 @@
<!-- Inputs -->
<PropertyGroup>
<ManpagesDirectory>$(RepoRoot)/Documentation/manpages</ManpagesDirectory>
<EndToEndTestProject>$(RepoRoot)/test/EndToEnd/EndToEnd.csproj</EndToEndTestProject>
<CLISdkRoot>$(OutputDirectory)/sdk</CLISdkRoot>
<!-- Need to acquire manpage files from CLI repo: https://github.com/dotnet/cli/issues/10266 -->
<ManpagesDirectory>$(RepoRoot)Documentation/manpages</ManpagesDirectory>
<EndToEndTestProject>$(RepoRoot)test/EndToEnd/EndToEnd.Tests.csproj</EndToEndTestProject>
<CLISdkRoot>$(RedistLayoutPath)sdk/</CLISdkRoot>
</PropertyGroup>
<ItemGroup>
@ -60,32 +68,32 @@
<!-- Output Directories -->
<PropertyGroup>
<InstallerOutputDirectory>$(PackagesDirectory)</InstallerOutputDirectory>
<SdkInstallerFile>$(InstallerOutputDirectory)/$(DistroSpecificArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(InstallerExtension)</SdkInstallerFile>
<SdkDebianIntermediateDirectory>$(IntermediateDirectory)/debian/sdk</SdkDebianIntermediateDirectory>
<DotNetDebToolOutputDirectory>$(SdkDebianIntermediateDirectory)/deb-tool-output</DotNetDebToolOutputDirectory>
<DebianTestResultsXmlFile>$(SdkDebianIntermediateDirectory)/debian-testResults.xml</DebianTestResultsXmlFile>
<InstallerOutputDirectory>$(ArtifactsShippingPackagesDir)</InstallerOutputDirectory>
<SdkInstallerFile>$(InstallerOutputDirectory)$(DistroSpecificArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(InstallerExtension)</SdkInstallerFile>
<SdkDebianIntermediateDirectory>$(IntermediateOutputPath)debian/sdk/</SdkDebianIntermediateDirectory>
<DotNetDebToolOutputDirectory>$(SdkDebianIntermediateDirectory)deb-tool-output</DotNetDebToolOutputDirectory>
<DebianTestResultsXmlFile>$(SdkDebianIntermediateDirectory)debian-testResults.xml</DebianTestResultsXmlFile>
</PropertyGroup>
<!-- Layout Directories -->
<PropertyGroup>
<LayoutDirectory>$(SdkDebianIntermediateDirectory)/debianLayoutDirectory</LayoutDirectory>
<LayoutPackageRootDir>$(LayoutDirectory)/$(LayoutPackageRootDirName)</LayoutPackageRootDir>
<LayoutAbsolutePlacementDir>$(LayoutDirectory)/$(LayoutAbsolutePlacementDirName)</LayoutAbsolutePlacementDir>
<LayoutSamplesDir>$(LayoutDirectory)/$(LayoutSamplesDirName)</LayoutSamplesDir>
<LayoutDocsDir>$(LayoutDirectory)/$(LayoutDocsDirName)</LayoutDocsDir>
<LayoutDebianFilesDir>$(LayoutDirectory)/$(LayoutDebianFilesDirName)</LayoutDebianFilesDir>
<LayoutDirectory>$(SdkDebianIntermediateDirectory)debianLayoutDirectory/</LayoutDirectory>
<LayoutPackageRootDir>$(LayoutDirectory)$(LayoutPackageRootDirName)</LayoutPackageRootDir>
<LayoutAbsolutePlacementDir>$(LayoutDirectory)$(LayoutAbsolutePlacementDirName)</LayoutAbsolutePlacementDir>
<LayoutSamplesDir>$(LayoutDirectory)$(LayoutSamplesDirName)</LayoutSamplesDir>
<LayoutDocsDir>$(LayoutDirectory)$(LayoutDocsDirName)</LayoutDocsDir>
<LayoutDebianFilesDir>$(LayoutDirectory)$(LayoutDebianFilesDirName)</LayoutDebianFilesDir>
</PropertyGroup>
<!-- debian_config.json -->
<PropertyGroup>
<DebianConfigTemplateFile>$(RepoRoot)/packaging/deb/dotnet-debian_config.json</DebianConfigTemplateFile>
<DebianConfigJsonFile>$(LayoutDirectory)/debian_config.json</DebianConfigJsonFile>
<DebianConfigTemplateFile>$(MSBuildThisFileDirectory)packaging/deb/dotnet-debian_config.json</DebianConfigTemplateFile>
<DebianConfigJsonFile>$(LayoutDirectory)debian_config.json</DebianConfigJsonFile>
</PropertyGroup>
<PropertyGroup>
<DebianPostinstTemplateFile>$(RepoRoot)/packaging/deb/postinst</DebianPostinstTemplateFile>
<DebianPostinstFile>$(LayoutDirectory)/debian/postinst</DebianPostinstFile>
<DebianPostinstTemplateFile>$(MSBuildThisFileDirectory)packaging/deb/postinst</DebianPostinstTemplateFile>
<DebianPostinstFile>$(LayoutDirectory)debian/postinst</DebianPostinstFile>
</PropertyGroup>
<ItemGroup>
@ -125,16 +133,22 @@
</ItemGroup>
<ItemGroup>
<TestSdkDebTaskEnvironmentVariables Include="PATH=$(DebianInstalledDirectory)$(PathListSeparator)$(PATH)" />
<!--<TestSdkDebTaskEnvironmentVariables Include="PATH=$(DebianInstalledDirectory)$(PathListSeparator)$(PATH)" />
<TestSdkDebTaskEnvironmentVariables Include="TEST_ARTIFACTS=$(TestArtifactsDir)" />
<TestSdkDebTaskEnvironmentVariables Include="TEST_PACKAGES=$(TestPackagesDir)" />
<TestSdkDebTaskEnvironmentVariables Include="PreviousStageProps=$(NextStagePropsPath)" />
<TestSdkDebTaskEnvironmentVariables Include="PreviousStageProps=$(NextStagePropsPath)" />-->
<!-- Consumed By Publish -->
<GeneratedInstallers Include="$(SdkInstallerFile)" />
</ItemGroup>
</Target>
<!-- Outer GenerateDebs target so that GetCurrentRuntimeInformation will set IsDebianBasedDistro before target
condition is evaluated -->
<Target Name="GenerateDebsOuter"
DependsOnTargets="GetCurrentRuntimeInformation;
GenerateDebs"/>
<!-- Re-enable "TestSdkDeb" when the following issue is resolved: https://github.com/dotnet/cli/issues/9672 -->
<Target Name="GenerateDebs"
DependsOnTargets="SetupDebProps;
@ -143,7 +157,19 @@
Condition=" '$(IsDebianBaseDistro)' == 'True' "
Outputs="@(GeneratedInstallers)"/>
<Target Name="GetAspNetSharedFxInstallArgs" DependsOnTargets="EvaluateRuntimeCoherence">
<Target Name="ReadAspNetCoreSharedRuntimeVersionFile"
DependsOnTargets="DownloadBundledComponents">
<ItemGroup>
<File Include="$(DownloadsFolder)$(AspNetCoreSharedFxBaseRuntimeVersionFileName)" />
</ItemGroup>
<ReadLinesFromFile File="@(File)">
<Output
TaskParameter="Lines"
PropertyName="AspNetCoreSharedFxBaseRuntimeVersion"/>
</ReadLinesFromFile>
</Target>
<Target Name="GetAspNetSharedFxInstallArgs" DependsOnTargets="SetupDebProps;ReadAspNetCoreSharedRuntimeVersionFile">
<PropertyGroup>
<AspNetVersionPrereleaseSeparator>$(AspNetCoreSharedFxBaseRuntimeVersion.IndexOf('-'))</AspNetVersionPrereleaseSeparator>
<AspNetSimpleVersion>$(AspNetCoreSharedFxBaseRuntimeVersion)</AspNetSimpleVersion>
@ -166,11 +192,11 @@
Outputs="$(SdkInstallerFile)" >
<!-- Install Shared Framework Packages -->
<Exec Command="sudo dpkg -i $(DownloadedRuntimeDepsInstallerFile)" />
<Exec Command="sudo dpkg -i $(DownloadedSharedHostInstallerFile)" />
<Exec Command="sudo dpkg -i $(DownloadedHostFxrInstallerFile)" />
<Exec Command="sudo dpkg -i $(DownloadedSharedFrameworkInstallerFile)" />
<Exec Command="sudo dpkg $(InstallAspNetCoreSharedFxArgs) -i $(DownloadedAspNetCoreSharedFxInstallerFile)" />
<Exec Command="sudo dpkg -i $(DownloadsFolder)$(DownloadedRuntimeDepsInstallerFileName)" />
<Exec Command="sudo dpkg -i $(DownloadsFolder)$(DownloadedSharedHostInstallerFileName)" />
<Exec Command="sudo dpkg -i $(DownloadsFolder)$(DownloadedHostFxrInstallerFileName)" />
<Exec Command="sudo dpkg -i $(DownloadsFolder)$(DownloadedSharedFrameworkInstallerFileName)" />
<Exec Command="sudo dpkg $(InstallAspNetCoreSharedFxArgs) -i $(DownloadsFolder)$(DownloadedAspNetCoreSharedFxInstallerFileName)" />
<!-- Create layout: Binaries -->
<Copy
@ -204,12 +230,12 @@
DestinationFiles="$(DebianConfigJsonFile)"
ReplacementItems="@(DebianConfigTokenValues)" />
<Chmod
<!--<Chmod
Glob="$(PackageTool)"
Mode="u+x" />
Mode="u+x" />-->
<!-- Build SDK Deb package -->
<DotNetDebTool ToolPath="$(PreviousStageDirectory)"
<DotNetDebTool ToolPath="$(RepoRoot).dotnet"
InputDirectory="$(LayoutDirectory)"
OutputDirectory="$(DotNetDebToolOutputDirectory)"
PackageName="$(SdkDebianPackageName)"
@ -289,7 +315,7 @@
<Exec Command="!(dpkg-query -W %(TestSdkDebPackageToRemove.Identity)) || sudo dpkg -r %(TestSdkDebPackageToRemove.Identity)" />
</Target>
<Target Name="PrepareDotnetDebDirectories">
<Target Name="PrepareDotnetDebDirectories" DependsOnTargets="SetupDebProps">
<!-- Clean the workspace -->
<ItemGroup>
@ -319,8 +345,8 @@
<Target Name="PrepareDotnetDebTool">
<DotNetRestore ToolPath="$(PreviousStageDirectory)"
WorkingDirectory="$(DotnetDebToolDir)" />
<!--<DotNetRestore ToolPath="$(PreviousStageDirectory)"
WorkingDirectory="$(DotnetDebToolDir)" />-->
</Target>
<Target Name="TestDebuild">

View file

@ -2,6 +2,7 @@
<PropertyGroup>
<RedistLayoutPath>$(BaseOutputPath)$(Configuration)\dotnet\</RedistLayoutPath>
<SdkInternalLayoutPath>$(BaseOutputPath)$(Configuration)\dotnet-internal\</SdkInternalLayoutPath>
<DownloadsFolder>$(IntermediateOutputPath)downloads\</DownloadsFolder>
</PropertyGroup>
<Target Name="SetupBundledComponents" DependsOnTargets="GetCurrentRuntimeInformation;SetupFileExtensions;SetSdkVersionInfo;SetBuildDefaults">
@ -168,10 +169,10 @@
<Target Name="DownloadBundledComponents" DependsOnTargets="SetupBundledComponents">
<ItemGroup>
<BundledLayoutComponent>
<DownloadDestination>$(IntermediateOutputPath)downloads\%(DownloadFileName)</DownloadDestination>
<DownloadDestination>$(DownloadsFolder)%(DownloadFileName)</DownloadDestination>
</BundledLayoutComponent>
<BundledInstallerComponent>
<DownloadDestination>$(IntermediateOutputPath)downloads\%(DownloadFileName)</DownloadDestination>
<DownloadDestination>$(DownloadsFolder)%(DownloadFileName)</DownloadDestination>
</BundledInstallerComponent>
<ComponentToDownload Include="@(BundledLayoutComponent);@(BundledInstallerComponent)">
<ShouldDownload Condition="!Exists('%(DownloadDestination)')">true</ShouldDownload>

View file

@ -31,11 +31,11 @@
<SdkInstallerFile>$(ArtifactsShippingPackagesDir)$(ArtifactNameWithVersionSdk)$(InstallerExtension)</SdkInstallerFile>
<CombinedFrameworkSdkHostInstallerFile>$(ArtifactsShippingPackagesDir)$(ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(BundleExtension)</CombinedFrameworkSdkHostInstallerFile>
<SdkDebianIntermediateDirectory>$(IntermediateOutputPath)debian/sdk/</SdkDebianIntermediateDirectory>
<!--<SdkDebianIntermediateDirectory>$(IntermediateOutputPath)debian/sdk/</SdkDebianIntermediateDirectory>
<LayoutDirectory Condition=" '$(OSName)' == 'ubuntu' OR '$(OSName)' == 'debian' ">$(SdkDebianIntermediateDirectory)debianLayoutDirectory</LayoutDirectory>
<LayoutDirectory Condition=" '$(OSName)' != 'ubuntu' AND '$(OSName)' != 'debian' ">$(IntermediateOutputPath)layouts</LayoutDirectory>
<SdkLayoutOutputDirectory>$(LayoutDirectory)$(ArtifactNameSdk)</SdkLayoutOutputDirectory>
<MSBuildExtensionsOutputDirectory>$(LayoutDirectory)MSBuildExtensions</MSBuildExtensionsOutputDirectory>
<MSBuildExtensionsOutputDirectory>$(LayoutDirectory)MSBuildExtensions</MSBuildExtensionsOutputDirectory>-->
</PropertyGroup>
</Target>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Layout" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project>
<Target Name="CalculateLinuxNativeInstallerDependencyVersions">
<PropertyGroup>
<MicrosoftNETCoreAppPatchSeparatorIndex>$([MSBuild]::Add($(MicrosoftNETCoreAppPackageVersion.IndexOf('.')), 1))</MicrosoftNETCoreAppPatchSeparatorIndex>