From 2d008aa4f74dabb7ab8b9e85aaa17d93dc1fc78f Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 18 Apr 2018 21:35:57 -0700 Subject: [PATCH 1/2] Add tests that assert the dependencies of the dotnet-sdk rpm and deb files --- build/package/Installer.DEB.targets | 1 + build/package/Installer.RPM.targets | 3 +- test/EndToEnd/GivenDotNetLinuxInstallers.cs | 83 +++++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 test/EndToEnd/GivenDotNetLinuxInstallers.cs diff --git a/build/package/Installer.DEB.targets b/build/package/Installer.DEB.targets index 57b5a603d..3724823f6 100644 --- a/build/package/Installer.DEB.targets +++ b/build/package/Installer.DEB.targets @@ -109,6 +109,7 @@ + diff --git a/build/package/Installer.RPM.targets b/build/package/Installer.RPM.targets index cb06d9823..093d820b4 100644 --- a/build/package/Installer.RPM.targets +++ b/build/package/Installer.RPM.targets @@ -137,6 +137,7 @@ + @@ -238,7 +239,7 @@ ToolPath="$(RpmInstalledDirectory)" /> diff --git a/test/EndToEnd/GivenDotNetLinuxInstallers.cs b/test/EndToEnd/GivenDotNetLinuxInstallers.cs new file mode 100644 index 000000000..4968f0221 --- /dev/null +++ b/test/EndToEnd/GivenDotNetLinuxInstallers.cs @@ -0,0 +1,83 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.IO; +using Microsoft.DotNet.Tools.Test.Utilities; +using Xunit; + +namespace Microsoft.DotNet.Tests.EndToEnd +{ + public class GivenDotNetLinuxInstallers + { + [Fact] + public void ItHasExpectedDependencies() + { + var installerFile = Environment.GetEnvironmentVariable("SDK_INSTALLER_FILE"); + if (string.IsNullOrEmpty(installerFile)) + { + return; + } + + var ext = Path.GetExtension(installerFile); + switch (ext) + { + case ".deb": + DebianPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(installerFile); + return; + case ".rpm": + RpmPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(installerFile); + return; + } + } + + private void DebianPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string installerFile) + { + // Example output: + + // $ dpkg --info dotnet-sdk-2.1.105-ubuntu-x64.deb + + // new debian package, version 2.0. + // size 75660448 bytes: control archive=29107 bytes. + // 717 bytes, 11 lines control + // 123707 bytes, 1004 lines md5sums + // 1710 bytes, 28 lines * postinst #!/usr/bin/env + // Package: dotnet-sdk-2.1.104 + // Version: 2.1.104-1 + // Architecture: amd64 + // Maintainer: Microsoft + // Installed-Size: 201119 + // Depends: dotnet-runtime-2.0.6, aspnetcore-store-2.0.6 + // Section: devel + // Priority: standard + // Homepage: https://dotnet.github.io/core + // Description: Microsoft .NET Core SDK - 2.1.104 + + new TestCommand("dpkg") + .ExecuteWithCapturedOutput($"--info {installerFile}") + .Should().Pass() + .And.HaveStdOutMatching(@"Depends:.*\s?dotnet-runtime-\d+(\.\d+){2}") + .And.HaveStdOutMatching(@"Depends:.*\s?aspnetcore-store-\d+(\.\d+){2}"); + } + + private void RpmPackageHasDependencyOnAspNetCoreStoreAndDotnetRuntime(string installerFile) + { + // Example output: + + // $ rpm -qpR dotnet-sdk-2.1.105-rhel-x64.rpm + + // dotnet-runtime-2.0.7 >= 2.0.7 + // aspnetcore-store-2.0.7 >= 2.0.7 + // /bin/sh + // /bin/sh + // rpmlib(PayloadFilesHavePrefix) <= 4.0-1 + // rpmlib(CompressedFileNames) <= 3.0.4-1 + + new TestCommand("rpm") + .ExecuteWithCapturedOutput($"-qpR {installerFile}") + .Should().Pass() + .And.HaveStdOutMatching(@"dotnet-runtime-\d+(\.\d+){2} >= \d+(\.\d+){2}") + .And.HaveStdOutMatching(@"aspnetcore-store-\d+(\.\d+){2} >= \d+(\.\d+){2}"); + } + } +} From f729fad2930f988718815c91d6c3bea426091555 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 18 Apr 2018 21:41:06 -0700 Subject: [PATCH 2/2] Fix the aspnetcore dependency on .rpm and .deb installers --- build/DependencyVersions.props | 1 - build/package/Installer.DEB.targets | 3 ++- build/package/Installer.RPM.targets | 10 ++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index f485d871e..2356895c6 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -73,7 +73,6 @@ $(AspNetCoreVersion)-$(AspNetCoreRelease)-$(AspNetCoreRuntimePackageTimestamp) aspnetcore-store - $(AspNetCoreVersion)-$(AspNetCoreRelease) $(AspNetCoreBranchName)-$(AspNetCoreRuntimePackageTimestamp) diff --git a/build/package/Installer.DEB.targets b/build/package/Installer.DEB.targets index 3724823f6..3d3cc7bad 100644 --- a/build/package/Installer.DEB.targets +++ b/build/package/Installer.DEB.targets @@ -35,6 +35,7 @@ dotnet-hostfxr-$(HostFxrDebianPackageVersion) $(HostFxrDebianPackageName.ToLower()) dotnet-host + $(AspNetCoreRuntimePackageBrandName)-$(CurrentAspNetCoreRuntimeVersion) @@ -84,7 +85,7 @@ $(SharedFxDebianPackageName) - $(AspNetCoreRuntimePackageName) + $(AspNetCoreRuntimeDebPackageName) diff --git a/build/package/Installer.RPM.targets b/build/package/Installer.RPM.targets index 093d820b4..fd9d4b117 100644 --- a/build/package/Installer.RPM.targets +++ b/build/package/Installer.RPM.targets @@ -50,10 +50,8 @@ dotnet-hostfxr-$(HostFxrRpmPackageVersion) $(HostFxrRpmPackageName.ToLower()) dotnet-host - $(AspNetCoreRuntimePackageBrandName)-$(AspNetCoreVersionAndRelease)-$(AspNetCoreRuntimePackageTimestamp) - $(AspNetCoreRuntimePackageBrandName)-$(AspNetCoreVersion) - $(AspNetCoreRuntimePackageBrandName)-2.0.0 - $(AspNetCoreRuntimePackageBrandName)-2.0.3 + $(AspNetCoreRuntimePackageBrandName)-$(CurrentAspNetCoreRuntimeVersion) + $(CurrentAspNetCoreRuntimeVersion) $(ScriptsDir)/$(AfterInstallHostScriptName) $(RpmLayoutScripts)/$(AfterInstallHostScriptName) @@ -112,10 +110,10 @@ $(SharedFrameworkVersion) - $(AspNetCoreRuntimePackageName) + $(AspNetCoreRuntimeRpmPackageName) - $(AspNetCoreRuntimePackageVersion) + $(AspNetCoreRuntimeRpmPackageVersion) $(SharedFxRpmPackageName)