Enable building debian installer for Dotnet Runtime Dependencies package (dotnet...
authorRakesh Singh <raksingh@microsoft.com>
Mon, 23 Oct 2017 23:56:32 +0000 (16:56 -0700)
committerGitHub <noreply@github.com>
Mon, 23 Oct 2017 23:56:32 +0000 (16:56 -0700)
* Enable building debian installers for Dotnet Runtime Meta packages ( Pre-requisite system packages )

* Updated per PR feedbacks

* Refactor LibIcuPackage compute step

Commit migrated from https://github.com/dotnet/core-setup/commit/1f1349b53016f26a98fc8b4a275e7b73fc44a707

src/installer/pkg/packaging/deb/dotnet-runtime-deps-debian_config.json [new file with mode: 0644]
src/installer/pkg/packaging/deb/package.targets

diff --git a/src/installer/pkg/packaging/deb/dotnet-runtime-deps-debian_config.json b/src/installer/pkg/packaging/deb/dotnet-runtime-deps-debian_config.json
new file mode 100644 (file)
index 0000000..7d9c461
--- /dev/null
@@ -0,0 +1,49 @@
+{
+    "maintainer_name":"Microsoft",
+    "maintainer_email": "dotnetcore@microsoft.com",
+
+    "package_name": "%RUNTIME_DEPS_DEBIAN_PACKAGE_NAME%",
+    "install_root": "/usr/share/dotnet",
+
+    "short_description": "%RUNTIME_DEPS_DEBIAN_PACKAGE_NAME% %RUNTIME_DEPS_VERSION%",
+    "long_description": ".NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. This package installs all the system dependencies for Dotnet Core Runtime.",
+    "homepage": "https://dot.net/core",
+
+    "release":{
+        "package_version":"1.0.0.0",
+        "package_revision":"1",
+        "urgency" : "low",
+        "changelog_message" : "Dotnet Runtime dependencies package"
+    },
+
+    "control": {
+        "priority":"standard",
+        "section":"libs",
+        "architecture":"amd64"
+    },
+
+    "copyright": "2017 Microsoft",
+    "license": {
+        "type": "MIT",
+        "full_text": "Copyright (c) 2017 Microsoft\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
+    },
+
+    "debian_dependencies":{
+    "libc6":{},
+    "libcurl3":{},
+    "libgcc1":{},
+    "libgssapi-krb5-2":{},
+    "liblttng-ust0":{},
+    "libstdc++6":{},
+    "libunwind8":{},
+    "libuuid1":{},
+    "zlib1g":{},
+    "%LIBSSL_PACKAGE_NAME%" : {},
+    "%LIBICU_PACKAGE_NAME%": {} 
+    },
+
+    "debian_ignored_dependencies" : [
+        "liblldb-3.5",
+        "liblldb-3.6"
+    ]
+}
index 3bb3358..a959b46 100644 (file)
@@ -49,7 +49,7 @@
           Condition="'$(BuildDebPackage)'=='true'" />
 
   <Target Name="BuildDebs"
-          DependsOnTargets="InitializeDotnetDebTool;GenerateSharedHostDeb;GenerateHostFxrDeb;GenerateSharedFrameworkDeb"
+          DependsOnTargets="InitializeDotnetDebTool;GenerateSharedHostDeb;GenerateHostFxrDeb;GenerateSharedFrameworkDeb;GenerateRuntimeDependenciesDeb"
           Condition="'$(BuildDebPackage)'=='true' and '$(DebuildPresent)' == 'true'" />
 
   <Target Name="GenerateSharedHostDeb">
 
   </Target>
 
-  <Target Name="GenerateSharedFrameworkDeb">
+  <Target Name="GenerateSharedFrameworkDeb" DependsOnTargets="GetLibIcuPackageName">
+  
     <PropertyGroup>
       <DebPackageName>$(SharedFxDebPkgName)</DebPackageName>
       <DebPackageVersion>$(SharedFrameworkNugetVersion)</DebPackageVersion>
     <RemoveDir Condition="Exists('$(debIntermediatesDir)')" Directories="$(debIntermediatesDir)" />
     <MakeDir Directories="$(debIntermediatesDir)" />
 
-    <!-- Compute ICU Version -->
-    <Exec Command="apt-cache search --names-only '^libicu[0-9]+$' | cut -d' ' -f1"
-          ConsoleToMSBuild="true">
-        <Output TaskParameter="ConsoleOutput" PropertyName="LibIcuPackageName" />
-    </Exec>
-
     <!-- Create empty debian layout -->
     <RemoveDir Condition="Exists('$(debLayoutDirectory)')" Directories="$(debLayoutDirectory)" />
     <MakeDir Directories="$(debLayoutDirectory)" />
           UseHardlinksIfPossible="False" />
 
   </Target>
+  
+  <Target Name="GenerateRuntimeDependenciesDeb" DependsOnTargets="GetLibIcuPackageName">
+    <PropertyGroup>
+      <DebPackageName>$(RuntimeDependenciesDebPkgName)</DebPackageName>
+      <DebPackageVersion>$(SharedFrameworkNugetVersion)</DebPackageVersion>
+      <DebFile>$(DotnetRuntimeDependenciesPackageInstallerFile)</DebFile>
+      <ConfigJsonName>dotnet-runtime-deps-debian_config.json</ConfigJsonName>
+      <ConfigJsonFile>$(debPackaginfConfigPath)$(ConfigJsonName)</ConfigJsonFile>
+      <debIntermediatesDir>$(PackagesIntermediateDir)$(DebPackageName)/$(DebPackageVersion)</debIntermediatesDir>
+    </PropertyGroup>
+
+    <PropertyGroup>
+      <debLayoutDirectory>$(debIntermediatesDir)/debianLayoutDirectory/</debLayoutDirectory>
+      <debLayoutAbsolute>$(debLayoutDirectory)$</debLayoutAbsolute>
+      <debLayoutPackageRoot>$(debLayoutDirectory)package_root</debLayoutPackageRoot>
+      <debLayoutSamples>$(debLayoutDirectory)samples</debLayoutSamples>
+      <debLayoutDocs>$(debLayoutDirectory)docs</debLayoutDocs>
+    </PropertyGroup>
+
+    <RemoveDir Condition="Exists('$(debIntermediatesDir)')" Directories="$(debIntermediatesDir)" />
+    <MakeDir Directories="$(debIntermediatesDir)" />
+
+    <!-- Compute LIBSSL Version -->
+    <Exec Command="apt-cache search --names-only '^libssl[.0-9]+$' | cut -d' ' -f1" 
+          ConsoleToMSBuild="true"> 
+       <Output TaskParameter="ConsoleOutput" PropertyName="LibSSLPackageName" /> 
+    </Exec> 
+
+    <!-- Create empty debian layout -->
+    <RemoveDir Condition="Exists('$(debLayoutDirectory)')" Directories="$(debLayoutDirectory)" />
+    <MakeDir Directories="$(debLayoutDirectory)" />
+    <MakeDir Directories="$(debLayoutAbsolute)" />
+    <MakeDir Directories="$(debLayoutPackageRoot)" />
+    <MakeDir Directories="$(debLayoutSamples)" />
+    <MakeDir Directories="$(debLayoutDocs)" />
+
+    <!-- Replace config json variables -->
+    <ItemGroup>
+      <SharedFrameworkTokenValue Include="%RUNTIME_DEPS_DEBIAN_PACKAGE_NAME%">
+        <ReplacementString>$(RuntimeDependenciesDebPkgName)</ReplacementString>
+      </SharedFrameworkTokenValue>
+      <SharedFrameworkTokenValue Include="%RUNTIME_DEPS_VERSION%">
+        <ReplacementString>$(SharedFrameworkNugetVersion)</ReplacementString>
+      </SharedFrameworkTokenValue>
+      <SharedFrameworkTokenValue Include="%LIBSSL_PACKAGE_NAME%">
+        <ReplacementString>$(LibSSLPackageName)</ReplacementString>
+      </SharedFrameworkTokenValue>
+      <SharedFrameworkTokenValue Include="%LIBICU_PACKAGE_NAME%"> 
+        <ReplacementString>$(LibIcuPackageName)</ReplacementString> 
+      </SharedFrameworkTokenValue> 
+
+    </ItemGroup>
+
+    <ReplaceFileContents InputFile="$(ConfigJsonFile)"
+                         DestinationFile="$(debLayoutDirectory)$(DebianConfigJsonName)"
+                         ReplacementItems="@(SharedFrameworkTokenValue)" />
+
+    <Exec Command="$(DotnetToolCommand) deb-tool -i $(debLayoutDirectory) -o $(debIntermediatesDir) -n $(DebPackageName) -v $(DebPackageVersion)"
+          WorkingDirectory="$(consumingProjectDirectory)" />
+
+    <!-- Copy package to output -->
+    <ItemGroup>
+      <GeneratedDebFiles Remove="@(GeneratedDebFiles)" />
+      <GeneratedDebFiles Include="$(debIntermediatesDir)/*.deb" />
+    </ItemGroup>
+
+    <Error Text="@(GeneratedDebFiles->Count()) .deb files generated." Condition="'@(GeneratedDebFiles->Count())' != 1" />
+
+    <Copy SourceFiles="@(GeneratedDebFiles)"
+          DestinationFiles="$(DebFile)"
+          OverwriteReadOnlyFiles="True"
+          SkipUnchangedFiles="False"
+          UseHardlinksIfPossible="False" />
+
+  </Target>
 
   <Target Name="TestDebuild">
 
              Text="Debuild Not found, Debian packages will not be built."
              Importance="High" />
   </Target>
+
+  <!-- Compute LibIcu Package Name -->
+  <Target Name="GetLibIcuPackageName">
+    <Exec Command="apt-cache search --names-only '^libicu[0-9]+$' | cut -d' ' -f1" 
+          ConsoleToMSBuild="true"> 
+       <Output TaskParameter="ConsoleOutput" PropertyName="LibIcuPackageName" /> 
+    </Exec>
+  </Target>
 </Project>
\ No newline at end of file