diff --git a/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1 b/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1 index 9c65b94262..88bb42c5b6 100644 --- a/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1 +++ b/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1 @@ -48,6 +48,7 @@ function Remove-ShimWithAuthenticodeSignature { $possibleSignatures = @( 'RealDimensions Software, LLC' 'Chocolatey Software, Inc\.' + 'Chocolatey Software, Inc' ) $possibleSignatures | ForEach-Object { @@ -808,10 +809,10 @@ function Invoke-Chocolatey-Initial { Export-ModuleMember -function Initialize-Chocolatey; # SIG # Begin signature block -# MIInKwYJKoZIhvcNAQcCoIInHDCCJxgCAQExDzANBglghkgBZQMEAgEFADB5Bgor +# MIInJQYJKoZIhvcNAQcCoIInFjCCJxICAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCARYr0+7ioZ+5FY -# RbbVcsh0ztuNywfkE3NArn5Cg/ThqaCCIK4wggWNMIIEdaADAgECAhAOmxiO+dAt +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCC4NJHRAbm1O5Sz +# PHmfw+WqRms4eWssOEn2uHg9GTx8H6CCIKgwggWNMIIEdaADAgECAhAOmxiO+dAt # 5+/bUOIIQBhaMA0GCSqGSIb3DQEBDAUAMGUxCzAJBgNVBAYTAlVTMRUwEwYDVQQK # EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xJDAiBgNV # BAMTG0RpZ2lDZXJ0IEFzc3VyZWQgSUQgUm9vdCBDQTAeFw0yMjA4MDEwMDAwMDBa @@ -912,109 +913,109 @@ Export-ModuleMember -function Initialize-Chocolatey; # Oj9FpsToF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wvYkOOo1kUtSZ1TWtw1o7XQV7gX1JcLHl9AhUOIZ6tyVq3cZaQ +# Y2sYQZHc4LhM+myUU6fVoQMPNKmqnRFMEfx+KLOivIq+EQIWkiIxDQ0= # SIG # End signature block diff --git a/recipe.cake b/recipe.cake index 080cc389b4..4f0d317331 100644 --- a/recipe.cake +++ b/recipe.cake @@ -1,355 +1,358 @@ -#load nuget:?package=Chocolatey.Cake.Recipe&version=0.28.4 - -/////////////////////////////////////////////////////////////////////////////// -// TOOLS -/////////////////////////////////////////////////////////////////////////////// - -// This is needed in order to allow NUnit v2 tested to be executed by the NUnit -// v3 Test Runner -#tool nuget:?package=NUnit.Extension.NUnitV2Driver&version=3.9.0 - -/////////////////////////////////////////////////////////////////////////////// -// SCRIPT -/////////////////////////////////////////////////////////////////////////////// - -Func> getILMergeConfigs = () => -{ - var mergeConfigs = new List(); - - var targetPlatform = "v4,C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0"; - var assembliesToILMerge = GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/*.{exe|dll}") - - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/choco.exe") - - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/System.Management.Automation.dll"); - - Information("The following assemblies have been selected to be ILMerged for choco.exe..."); - foreach (var assemblyToILMerge in assembliesToILMerge) - { - Information(assemblyToILMerge.FullPath); - } - - mergeConfigs.Add(new ILMergeConfig() { - KeyFile = BuildParameters.StrongNameKeyPath, - LogFile = BuildParameters.Paths.Directories.Build + "/ilmerge-chocoexe.log", - TargetPlatform = targetPlatform, - Target = "exe", - Internalize = BuildParameters.RootDirectoryPath + "/src/chocolatey.console/ilmerge.internalize.ignore.txt", - Output = BuildParameters.Paths.Directories.PublishedApplications + "/choco_merged/choco.exe", - PrimaryAssemblyName = BuildParameters.Paths.Directories.PublishedApplications + "/choco/choco.exe", - AssemblyPaths = assembliesToILMerge }); - - assembliesToILMerge = GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/*.{exe|dll}") - - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/choco.exe") - - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/chocolatey.dll") - - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/log4net.dll") - - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/System.Management.Automation.dll"); - - Information("The following assemblies have been selected to be ILMerged for chocolatey.dll..."); - foreach (var assemblyToILMerge in assembliesToILMerge) - { - Information(assemblyToILMerge.FullPath); - } - - mergeConfigs.Add(new ILMergeConfig() { - KeyFile = BuildParameters.StrongNameKeyPath, - LogFile = BuildParameters.Paths.Directories.Build + "/ilmerge-chocolateydll.log", - TargetPlatform = targetPlatform, - Target = "dll", - Internalize = BuildParameters.RootDirectoryPath + "/src/chocolatey/ilmerge.internalize.ignore.dll.txt", - Output = BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey_merged/chocolatey.dll", - PrimaryAssemblyName = BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/chocolatey.dll", - AssemblyPaths = assembliesToILMerge }); - - if (DirectoryExists(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/")) - { - var no7zAssembliesToILMerge = GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/*.{exe|dll}") - - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/choco.exe") - - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/System.Management.Automation.dll") - - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/chocolatey.tests*.dll") - - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/{Moq|nunit.framework|Should}.dll"); - - Information("The following assemblies have been selected to be ILMerged for choco.exe No7zip Version..."); - foreach (var assemblyToILMerge in no7zAssembliesToILMerge) - { - Information(assemblyToILMerge.FullPath); - } - - mergeConfigs.Add(new ILMergeConfig() { - KeyFile = BuildParameters.StrongNameKeyPath, - LogFile = BuildParameters.Paths.Directories.Build + "/ilmerge-chocono7zipexe.log", - TargetPlatform = targetPlatform, - Target = "exe", - Internalize = BuildParameters.RootDirectoryPath + "/src/chocolatey.console/ilmerge.internalize.ignore.txt", - Output = BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip_merged/choco.exe", - PrimaryAssemblyName = BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/choco.exe", - AssemblyPaths = no7zAssembliesToILMerge }); - } - - return mergeConfigs; -}; - -Func getScriptsToVerify = () => -{ - var scriptsToVerify = GetFiles("./src/chocolatey.resources/**/*.{ps1|psm1|psd1}") + - GetFiles(BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/**/*.{ps1|psm1|psd1}") + - GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/**/*.{ps1|psm1|psd1}"); - - if (DirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip")) - { - scriptsToVerify += GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/**/*.{ps1|psm1|psd1}"); - } - - Information("The following PowerShell scripts have been selected to be verified..."); - foreach (var scriptToVerify in scriptsToVerify) - { - Information(scriptToVerify.FullPath); - } - - return scriptsToVerify; -}; - -Func getScriptsToSign = () => -{ - var scriptsToSign = GetFiles("./nuspec/**/*.{ps1|psm1|psd1}") + - GetFiles("./src/chocolatey.resources/**/*.{ps1|psm1|psd1}"); - - Information("The following PowerShell scripts have been selected to be signed..."); - foreach (var scriptToSign in scriptsToSign) - { - Information(scriptToSign.FullPath); - } - - return scriptsToSign; -}; - -Func getFilesToSign = () => -{ - var filesToSign = GetFiles(BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib/chocolatey.dll") - + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe") - + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/tools/{checksum|shimgen}.exe") - + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/redirects/*.exe"); - - if (DirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip")) - { - filesToSign += GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/choco.exe") - + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/tools/{checksum|shimgen}.exe") - + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/redirects/*.exe"); - } - - Information("The following assemblies have been selected to be signed..."); - foreach (var fileToSign in filesToSign) - { - Information(fileToSign.FullPath); - } - - return filesToSign; -}; - -/////////////////////////////////////////////////////////////////////////////// -// CUSTOM TASKS -/////////////////////////////////////////////////////////////////////////////// - -Task("Prepare-Chocolatey-Packages") - .IsDependeeOf("Create-Chocolatey-Packages") - .IsDependeeOf("Verify-PowerShellScripts") - .IsDependeeOf("Sign-Assemblies") - .WithCriteria(() => BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows, "Skipping because not running on Windows") - .WithCriteria(() => BuildParameters.ShouldRunChocolatey, "Skipping because execution of Chocolatey has been disabled") - .Does(() => -{ - // Copy legal documents - CopyFile(BuildParameters.RootDirectoryPath + "/docs/legal/CREDITS.md", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/CREDITS.txt"); - - // Run Chocolatey Unpackself - CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco_merged/choco.exe", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe"); - - StartProcess(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe", new ProcessSettings{ Arguments = "unpackself -f -y --allow-unofficial-build" }); - - // Tidy up logs and config folder which are not required - var logsDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/logs"; - var configDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/config"; - - if (DirectoryExists(logsDirectory)) - { - DeleteDirectory(logsDirectory, new DeleteDirectorySettings { - Recursive = true, - Force = true - }); - } - - if (DirectoryExists(configDirectory)) - { - DeleteDirectory(configDirectory, new DeleteDirectorySettings { - Recursive = true, - Force = true - }); - } -}); - -Task("Build-ChocolateyNo7zip") - .WithCriteria(() => BuildParameters.Configuration == "ReleaseOfficial", "Skipping No7zip because this isn't an official release") - .IsDependentOn("Build") - .IsDependentOn("Test") - .IsDependeeOf("Run-ILMerge") - .Does(data => RequireTool(ToolSettings.MSBuildExtensionPackTool, () => -{ - Information("Building {0} with No7zip", BuildParameters.SolutionFilePath); - - CleanDirectory(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/"); - - var no7zLogPath = BuildParameters.Paths.Files.BuildLogFilePath.ToString().Replace("\\.(\\S+)$", "-no7zip.${1}"); - - if (BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows) - { - var msbuildSettings = new MSBuildSettings - { - ToolPath = ToolSettings.MSBuildToolPath - } - .SetPlatformTarget(ToolSettings.BuildPlatformTarget) - .UseToolVersion(ToolSettings.BuildMSBuildToolVersion) - .WithProperty("OutputPath", MakeAbsolute(new DirectoryPath(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/")).FullPath) - .WithProperty("TreatWarningsAsErrors", BuildParameters.TreatWarningsAsErrors.ToString()) - .WithTarget("Build") - .SetMaxCpuCount(ToolSettings.MaxCpuCount) - .SetConfiguration("ReleaseOfficialNo7zip") - .WithLogger( - Context.Tools.Resolve("MSBuild.ExtensionPack.Loggers.dll").FullPath, - "XmlFileLogger", - string.Format( - "logfile=\"{0}\";invalidCharReplacement=_;verbosity=Detailed;encoding=UTF-8", - no7zLogPath - ) - ); - - MSBuild(BuildParameters.SolutionFilePath, msbuildSettings); - } - - if (FileExists(no7zLogPath)) - { - BuildParameters.BuildProvider.UploadArtifact(no7zLogPath); - } -})); - -Task("Prepare-ChocolateyNo7zip-Package") - .WithCriteria(() => BuildParameters.Configuration == "ReleaseOfficial", "Skipping No7zip because this isn't an official release") - .WithCriteria(() => BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows, "Skipping because not running on Windows") - .WithCriteria(() => BuildParameters.ShouldRunChocolatey, "Skipping because execution of Chocolatey has been disabled") - .IsDependentOn("Build-ChocolateyNo7zip") - .IsDependeeOf("Sign-Assemblies") - .IsDependeeOf("Verify-PowerShellScripts") - .IsDependeeOf("Create-ChocolateyNo7zip-Package") - .Does(() => -{ - var nuspecDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip"; - // Copy the Nuget/Chocolatey directory from Root Folder to temp/nuspec/chocolatey-no7zip - EnsureDirectoryExists(nuspecDirectory); - CopyFiles(GetFiles("./nuspec/chocolatey/**/*"), nuspecDirectory, true); - - // Copy legal documents - CopyFile(BuildParameters.RootDirectoryPath + "/docs/legal/CREDITS.md", nuspecDirectory + "/tools/chocolateyInstall/CREDITS.txt"); - - // Run Chocolatey Unpackself - CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip_merged/choco.exe", nuspecDirectory + "/tools/chocolateyInstall/choco.exe"); - - StartProcess(nuspecDirectory + "/tools/chocolateyInstall/choco.exe", new ProcessSettings{ Arguments = "unpackself -f -y --allow-unofficial-build" }); - - // Tidy up logs and config folder which are not required - var logsDirectory = nuspecDirectory + "/tools/chocolateyInstall/logs"; - var configDirectory = nuspecDirectory + "/tools/chocolateyInstall/config"; - - if (DirectoryExists(logsDirectory)) - { - DeleteDirectory(logsDirectory, new DeleteDirectorySettings { - Recursive = true, - Force = true - }); - } - - if (DirectoryExists(configDirectory)) - { - DeleteDirectory(configDirectory, new DeleteDirectorySettings { - Recursive = true, - Force = true - }); - } -}); - -Task("Create-ChocolateyNo7zip-Package") - .WithCriteria(() => BuildParameters.Configuration == "ReleaseOfficial", "Skipping No7zip because this isn't an official release") - .WithCriteria(() => BuildParameters.ShouldRunChocolatey, "Skipping because execution of Chocolatey has been disabled") - .WithCriteria(() => BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows, "Skipping because not running on Windows") - .IsDependentOn("Prepare-ChocolateyNo7zip-Package") - .IsDependeeOf("Package") - .Does(() => -{ - var nuspecDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/"; - var nuspecFile = nuspecDirectory + "chocolatey.nuspec"; - - ChocolateyPack(nuspecFile, new ChocolateyPackSettings { - AllowUnofficial = true, - Version = BuildParameters.Version.PackageVersion, - OutputDirectory = nuspecDirectory, - WorkingDirectory = BuildParameters.Paths.Directories.PublishedApplications - }); - - MoveFile( - nuspecDirectory + "chocolatey." + BuildParameters.Version.PackageVersion + ".nupkg", - BuildParameters.Paths.Directories.ChocolateyPackages + "/chocolatey-no7zip." + BuildParameters.Version.PackageVersion + ".nupkg" - ); - - // Due to the fact that we have chosen to ignore the no7zip package via the chocolateyNupkgGlobbingPattern, it will - // no longer be automatically uploaded via Chocolatey.Cake.Recipe, so we need to handle that work here. - BuildParameters.BuildProvider.UploadArtifact(BuildParameters.Paths.Directories.ChocolateyPackages + "/chocolatey-no7zip." + BuildParameters.Version.PackageVersion + ".nupkg"); -}); - -Task("Prepare-NuGet-Packages") - .WithCriteria(() => BuildParameters.ShouldRunNuGet, "Skipping because execution of NuGet has been disabled") - .IsDependeeOf("Create-NuGet-Packages") - .IsDependeeOf("Verify-PowerShellScripts") - .IsDependeeOf("Sign-Assemblies") - .Does(() => -{ - // Copy legal documents - CleanDirectory(BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib"); - CopyFile(BuildParameters.RootDirectoryPath + "/docs/legal/CREDITS.md", BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib/CREDITS.txt"); - - CopyFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey_merged/*", BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib"); - CopyFile(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/chocolatey.xml", BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib/chocolatey.xml"); -}); - -/////////////////////////////////////////////////////////////////////////////// -// RECIPE SCRIPT -/////////////////////////////////////////////////////////////////////////////// - -Environment.SetVariableNames(); - -BuildParameters.SetParameters(context: Context, - buildSystem: BuildSystem, - sourceDirectoryPath: "./src", - solutionFilePath: "./src/chocolatey.sln", - solutionDirectoryPath: "./src/chocolatey", - resharperSettingsFileName: "chocolatey.sln.DotSettings", - title: "Chocolatey", - repositoryOwner: "chocolatey", - repositoryName: "choco", - productName: "Chocolatey", - productDescription: "chocolatey is a product of Chocolatey Software, Inc. - All Rights Reserved.", - productCopyright: string.Format("Copyright © 2017 - {0} Chocolatey Software, Inc. Copyright © 2011 - 2017, RealDimensions Software, LLC - All Rights Reserved.", DateTime.Now.Year), - shouldStrongNameSignDependentAssemblies: false, - treatWarningsAsErrors: false, - getScriptsToVerify: getScriptsToVerify, - getScriptsToSign: getScriptsToSign, - getFilesToSign: getFilesToSign, - getILMergeConfigs: getILMergeConfigs, - preferDotNetGlobalToolUsage: !IsRunningOnWindows(), - shouldAuthenticodeSignMsis: true, - shouldRunNuGet: IsRunningOnWindows(), - shouldAuthenticodeSignPowerShellScripts: IsRunningOnWindows(), - shouldPublishAwsLambdas: false, - chocolateyNupkgGlobbingPattern: "/**/chocolatey[!-no7zip]*.nupkg"); - -ToolSettings.SetToolSettings(context: Context, - buildMSBuildToolVersion: MSBuildToolVersion.NET40); - -BuildParameters.PrintParameters(Context); - -Build.Run(); +#load nuget:?package=Chocolatey.Cake.Recipe&version=0.28.4 + +/////////////////////////////////////////////////////////////////////////////// +// TOOLS +/////////////////////////////////////////////////////////////////////////////// + +// This is needed in order to allow NUnit v2 tested to be executed by the NUnit +// v3 Test Runner +#tool nuget:?package=NUnit.Extension.NUnitV2Driver&version=3.9.0 + +/////////////////////////////////////////////////////////////////////////////// +// SCRIPT +/////////////////////////////////////////////////////////////////////////////// + +Func> getILMergeConfigs = () => +{ + var mergeConfigs = new List(); + + var targetPlatform = "v4,C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0"; + var assembliesToILMerge = GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/*.{exe|dll}") + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/choco.exe") + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/System.Management.Automation.dll"); + + Information("The following assemblies have been selected to be ILMerged for choco.exe..."); + foreach (var assemblyToILMerge in assembliesToILMerge) + { + Information(assemblyToILMerge.FullPath); + } + + mergeConfigs.Add(new ILMergeConfig() { + KeyFile = BuildParameters.StrongNameKeyPath, + LogFile = BuildParameters.Paths.Directories.Build + "/ilmerge-chocoexe.log", + TargetPlatform = targetPlatform, + Target = "exe", + Internalize = BuildParameters.RootDirectoryPath + "/src/chocolatey.console/ilmerge.internalize.ignore.txt", + Output = BuildParameters.Paths.Directories.PublishedApplications + "/choco_merged/choco.exe", + PrimaryAssemblyName = BuildParameters.Paths.Directories.PublishedApplications + "/choco/choco.exe", + AssemblyPaths = assembliesToILMerge }); + + assembliesToILMerge = GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/*.{exe|dll}") + - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/choco.exe") + - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/chocolatey.dll") + - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/log4net.dll") + - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/System.Management.Automation.dll"); + + Information("The following assemblies have been selected to be ILMerged for chocolatey.dll..."); + foreach (var assemblyToILMerge in assembliesToILMerge) + { + Information(assemblyToILMerge.FullPath); + } + + mergeConfigs.Add(new ILMergeConfig() { + KeyFile = BuildParameters.StrongNameKeyPath, + LogFile = BuildParameters.Paths.Directories.Build + "/ilmerge-chocolateydll.log", + TargetPlatform = targetPlatform, + Target = "dll", + Internalize = BuildParameters.RootDirectoryPath + "/src/chocolatey/ilmerge.internalize.ignore.dll.txt", + Output = BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey_merged/chocolatey.dll", + PrimaryAssemblyName = BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/chocolatey.dll", + AssemblyPaths = assembliesToILMerge }); + + if (DirectoryExists(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/")) + { + var no7zAssembliesToILMerge = GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/*.{exe|dll}") + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/choco.exe") + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/System.Management.Automation.dll") + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/chocolatey.tests*.dll") + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/{Moq|nunit.framework|Should}.dll"); + + Information("The following assemblies have been selected to be ILMerged for choco.exe No7zip Version..."); + foreach (var assemblyToILMerge in no7zAssembliesToILMerge) + { + Information(assemblyToILMerge.FullPath); + } + + mergeConfigs.Add(new ILMergeConfig() { + KeyFile = BuildParameters.StrongNameKeyPath, + LogFile = BuildParameters.Paths.Directories.Build + "/ilmerge-chocono7zipexe.log", + TargetPlatform = targetPlatform, + Target = "exe", + Internalize = BuildParameters.RootDirectoryPath + "/src/chocolatey.console/ilmerge.internalize.ignore.txt", + Output = BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip_merged/choco.exe", + PrimaryAssemblyName = BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/choco.exe", + AssemblyPaths = no7zAssembliesToILMerge }); + } + + return mergeConfigs; +}; + +Func getScriptsToVerify = () => +{ + var scriptsToVerify = GetFiles("./src/chocolatey.resources/**/*.{ps1|psm1|psd1}") + + GetFiles(BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/**/*.{ps1|psm1|psd1}") + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/**/*.{ps1|psm1|psd1}"); + + if (DirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip")) + { + scriptsToVerify += GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/**/*.{ps1|psm1|psd1}"); + } + + Information("The following PowerShell scripts have been selected to be verified..."); + foreach (var scriptToVerify in scriptsToVerify) + { + Information(scriptToVerify.FullPath); + } + + return scriptsToVerify; +}; + +Func getScriptsToSign = () => +{ + var scriptsToSign = GetFiles("./nuspec/**/*.{ps1|psm1|psd1}") + + GetFiles("./src/chocolatey.resources/**/*.{ps1|psm1|psd1}"); + + Information("The following PowerShell scripts have been selected to be signed..."); + foreach (var scriptToSign in scriptsToSign) + { + Information(scriptToSign.FullPath); + } + + return scriptsToSign; +}; + +Func getFilesToSign = () => +{ + var filesToSign = GetFiles(BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib/chocolatey.dll") + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe") + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/tools/{checksum|shimgen}.exe") + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/redirects/*.exe"); + + if (DirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip")) + { + filesToSign += GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/choco.exe") + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/tools/{checksum|shimgen}.exe") + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/redirects/*.exe"); + } + + Information("The following assemblies have been selected to be signed..."); + foreach (var fileToSign in filesToSign) + { + Information(fileToSign.FullPath); + } + + return filesToSign; +}; + +/////////////////////////////////////////////////////////////////////////////// +// CUSTOM TASKS +/////////////////////////////////////////////////////////////////////////////// + +Task("Prepare-Chocolatey-Packages") + .IsDependeeOf("Create-Chocolatey-Packages") + .IsDependeeOf("Verify-PowerShellScripts") + .IsDependeeOf("Sign-Assemblies") + .WithCriteria(() => BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows, "Skipping because not running on Windows") + .WithCriteria(() => BuildParameters.ShouldRunChocolatey, "Skipping because execution of Chocolatey has been disabled") + .Does(() => +{ + // Copy legal documents + CopyFile(BuildParameters.RootDirectoryPath + "/docs/legal/CREDITS.md", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/CREDITS.txt"); + + // Run Chocolatey Unpackself + CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco_merged/choco.exe", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe"); + + StartProcess(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe", new ProcessSettings{ Arguments = "unpackself -f -y --allow-unofficial-build" }); + + // Tidy up logs and config folder which are not required + var logsDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/logs"; + var configDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/config"; + + if (DirectoryExists(logsDirectory)) + { + DeleteDirectory(logsDirectory, new DeleteDirectorySettings { + Recursive = true, + Force = true + }); + } + + if (DirectoryExists(configDirectory)) + { + DeleteDirectory(configDirectory, new DeleteDirectorySettings { + Recursive = true, + Force = true + }); + } +}); + +Task("Build-ChocolateyNo7zip") + .WithCriteria(() => BuildParameters.Configuration == "ReleaseOfficial", "Skipping No7zip because this isn't an official release") + .IsDependentOn("Build") + .IsDependentOn("Test") + .IsDependeeOf("Run-ILMerge") + .Does(data => RequireTool(ToolSettings.MSBuildExtensionPackTool, () => +{ + Information("Building {0} with No7zip", BuildParameters.SolutionFilePath); + + CleanDirectory(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/"); + + var no7zLogPath = BuildParameters.Paths.Files.BuildLogFilePath.ToString().Replace("\\.(\\S+)$", "-no7zip.${1}"); + + if (BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows) + { + var msbuildSettings = new MSBuildSettings + { + ToolPath = ToolSettings.MSBuildToolPath + } + .SetPlatformTarget(ToolSettings.BuildPlatformTarget) + .UseToolVersion(ToolSettings.BuildMSBuildToolVersion) + .WithProperty("OutputPath", MakeAbsolute(new DirectoryPath(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/")).FullPath) + .WithProperty("TreatWarningsAsErrors", BuildParameters.TreatWarningsAsErrors.ToString()) + .WithTarget("Build") + .SetMaxCpuCount(ToolSettings.MaxCpuCount) + .SetConfiguration("ReleaseOfficialNo7zip") + .WithLogger( + Context.Tools.Resolve("MSBuild.ExtensionPack.Loggers.dll").FullPath, + "XmlFileLogger", + string.Format( + "logfile=\"{0}\";invalidCharReplacement=_;verbosity=Detailed;encoding=UTF-8", + no7zLogPath + ) + ); + + MSBuild(BuildParameters.SolutionFilePath, msbuildSettings); + } + + if (FileExists(no7zLogPath)) + { + BuildParameters.BuildProvider.UploadArtifact(no7zLogPath); + } +})); + +Task("Prepare-ChocolateyNo7zip-Package") + .WithCriteria(() => BuildParameters.Configuration == "ReleaseOfficial", "Skipping No7zip because this isn't an official release") + .WithCriteria(() => BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows, "Skipping because not running on Windows") + .WithCriteria(() => BuildParameters.ShouldRunChocolatey, "Skipping because execution of Chocolatey has been disabled") + .IsDependentOn("Build-ChocolateyNo7zip") + .IsDependeeOf("Sign-Assemblies") + .IsDependeeOf("Verify-PowerShellScripts") + .IsDependeeOf("Create-ChocolateyNo7zip-Package") + .Does(() => +{ + var nuspecDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip"; + // Copy the Nuget/Chocolatey directory from Root Folder to temp/nuspec/chocolatey-no7zip + EnsureDirectoryExists(nuspecDirectory); + CopyFiles(GetFiles("./nuspec/chocolatey/**/*"), nuspecDirectory, true); + + // Copy legal documents + CopyFile(BuildParameters.RootDirectoryPath + "/docs/legal/CREDITS.md", nuspecDirectory + "/tools/chocolateyInstall/CREDITS.txt"); + + // Run Chocolatey Unpackself + CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip_merged/choco.exe", nuspecDirectory + "/tools/chocolateyInstall/choco.exe"); + + StartProcess(nuspecDirectory + "/tools/chocolateyInstall/choco.exe", new ProcessSettings{ Arguments = "unpackself -f -y --allow-unofficial-build" }); + + // Tidy up logs and config folder which are not required + var logsDirectory = nuspecDirectory + "/tools/chocolateyInstall/logs"; + var configDirectory = nuspecDirectory + "/tools/chocolateyInstall/config"; + + if (DirectoryExists(logsDirectory)) + { + DeleteDirectory(logsDirectory, new DeleteDirectorySettings { + Recursive = true, + Force = true + }); + } + + if (DirectoryExists(configDirectory)) + { + DeleteDirectory(configDirectory, new DeleteDirectorySettings { + Recursive = true, + Force = true + }); + } +}); + +Task("Create-ChocolateyNo7zip-Package") + .WithCriteria(() => BuildParameters.Configuration == "ReleaseOfficial", "Skipping No7zip because this isn't an official release") + .WithCriteria(() => BuildParameters.ShouldRunChocolatey, "Skipping because execution of Chocolatey has been disabled") + .WithCriteria(() => BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows, "Skipping because not running on Windows") + .IsDependentOn("Prepare-ChocolateyNo7zip-Package") + .IsDependeeOf("Package") + .Does(() => +{ + var nuspecDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/"; + var nuspecFile = nuspecDirectory + "chocolatey.nuspec"; + + ChocolateyPack(nuspecFile, new ChocolateyPackSettings { + AllowUnofficial = true, + Version = BuildParameters.Version.PackageVersion, + OutputDirectory = nuspecDirectory, + WorkingDirectory = BuildParameters.Paths.Directories.PublishedApplications + }); + + MoveFile( + nuspecDirectory + "chocolatey." + BuildParameters.Version.PackageVersion + ".nupkg", + BuildParameters.Paths.Directories.ChocolateyPackages + "/chocolatey-no7zip." + BuildParameters.Version.PackageVersion + ".nupkg" + ); + + // Due to the fact that we have chosen to ignore the no7zip package via the chocolateyNupkgGlobbingPattern, it will + // no longer be automatically uploaded via Chocolatey.Cake.Recipe, so we need to handle that work here. + BuildParameters.BuildProvider.UploadArtifact(BuildParameters.Paths.Directories.ChocolateyPackages + "/chocolatey-no7zip." + BuildParameters.Version.PackageVersion + ".nupkg"); +}); + +Task("Prepare-NuGet-Packages") + .WithCriteria(() => BuildParameters.ShouldRunNuGet, "Skipping because execution of NuGet has been disabled") + .IsDependeeOf("Create-NuGet-Packages") + .IsDependeeOf("Verify-PowerShellScripts") + .IsDependeeOf("Sign-Assemblies") + .Does(() => +{ + // Copy legal documents + CleanDirectory(BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib"); + CopyFile(BuildParameters.RootDirectoryPath + "/docs/legal/CREDITS.md", BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib/CREDITS.txt"); + + CopyFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey_merged/*", BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib"); + CopyFile(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/chocolatey.xml", BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib/chocolatey.xml"); +}); + +BuildParameters.Tasks.BuildMsiTask + .WithCriteria(false, "Skipping MSI because this version does not have an MSI"); + +/////////////////////////////////////////////////////////////////////////////// +// RECIPE SCRIPT +/////////////////////////////////////////////////////////////////////////////// + +Environment.SetVariableNames(); + +BuildParameters.SetParameters(context: Context, + buildSystem: BuildSystem, + sourceDirectoryPath: "./src", + solutionFilePath: "./src/chocolatey.sln", + solutionDirectoryPath: "./src/chocolatey", + resharperSettingsFileName: "chocolatey.sln.DotSettings", + title: "Chocolatey", + repositoryOwner: "chocolatey", + repositoryName: "choco", + productName: "Chocolatey", + productDescription: "chocolatey is a product of Chocolatey Software, Inc. - All Rights Reserved.", + productCopyright: string.Format("Copyright © 2017 - {0} Chocolatey Software, Inc. Copyright © 2011 - 2017, RealDimensions Software, LLC - All Rights Reserved.", DateTime.Now.Year), + shouldStrongNameSignDependentAssemblies: false, + treatWarningsAsErrors: false, + getScriptsToVerify: getScriptsToVerify, + getScriptsToSign: getScriptsToSign, + getFilesToSign: getFilesToSign, + getILMergeConfigs: getILMergeConfigs, + preferDotNetGlobalToolUsage: !IsRunningOnWindows(), + shouldAuthenticodeSignMsis: true, + shouldRunNuGet: IsRunningOnWindows(), + shouldAuthenticodeSignPowerShellScripts: IsRunningOnWindows(), + shouldPublishAwsLambdas: false, + chocolateyNupkgGlobbingPattern: "/**/chocolatey[!-no7zip]*.nupkg"); + +ToolSettings.SetToolSettings(context: Context, + buildMSBuildToolVersion: MSBuildToolVersion.NET40); + +BuildParameters.PrintParameters(Context); + +Build.Run(); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs index de65dc3c0b..4f23df159f 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs @@ -37,7 +37,7 @@ public override void configure_argument_parser(OptionSet optionSet, ChocolateyCo .Add( "s=|source=", "Source - Source location for install. Can use special 'webpi' or 'windowsfeatures' sources. Defaults to sources.", - option => configuration.Sources = option.remove_surrounding_quotes()) + option => configuration.Sources = configuration.ExplicitSources = option.remove_surrounding_quotes()) .Add( "l|lo|localonly|local-only", "LocalOnly - Only search against local machine items.", diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs index b411b0affe..bafdd60203 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs @@ -41,7 +41,7 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon optionSet .Add("s=|source=", "Source - The source to find the package(s) to install. Special sources include: ruby, webpi, cygwin, windowsfeatures, and python. To specify more than one source, pass it with a semi-colon separating the values (e.g. \"'source1;source2'\"). Defaults to default feeds.", - option => configuration.Sources = option.remove_surrounding_quotes()) + option => configuration.Sources = configuration.ExplicitSources = option.remove_surrounding_quotes()) .Add("version=", "Version - A specific version to install. Defaults to unspecified.", option => configuration.Version = option.remove_surrounding_quotes()) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs index f477b4932e..45f9a8f713 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs @@ -51,7 +51,7 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon optionSet .Add("s=|source=", "Source - Source location for install. Can use special 'webpi' or 'windowsfeatures' sources. Defaults to sources." + deprecationNotice, - option => configuration.Sources = option.remove_surrounding_quotes()) + option => configuration.Sources = configuration.ExplicitSources = option.remove_surrounding_quotes()) .Add("l|lo|local|localonly|local-only", localOnlyDescription, option => configuration.ListCommand.LocalOnly = option != null) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs index 750fef4185..ee000f4459 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs @@ -39,7 +39,7 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon optionSet .Add("s=|source=", "Source - The source to find the package(s) to install. Special sources include: ruby, webpi, cygwin, windowsfeatures, and python. To specify more than one source, pass it with a semi-colon separating the values (e.g. \"'source1;source2'\"). Defaults to default feeds.", - option => configuration.Sources = option.remove_surrounding_quotes()) + option => configuration.Sources = configuration.ExplicitSources = option.remove_surrounding_quotes()) .Add("u=|user=", "User - used with authenticated feeds. Defaults to empty.", option => configuration.SourceCommand.Username = option.remove_surrounding_quotes()) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs index a3e0b817a0..b4c7b3f19b 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs @@ -49,7 +49,7 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon option => configuration.SourceCommand.Name = option.remove_surrounding_quotes()) .Add("s=|source=", "Source - The source. This can be a folder/file share or an http location. If it is a url, it will be a location you can go to in a browser and it returns OData with something that says Packages in the browser, similar to what you see when you go to https://community.chocolatey.org/api/v2/. Required with add action. Defaults to empty.", - option => configuration.Sources = option.remove_surrounding_quotes()) + option => configuration.Sources = configuration.ExplicitSources = option.remove_surrounding_quotes()) .Add("u=|user=", "User - used with authenticated feeds. Defaults to empty.", option => configuration.SourceCommand.Username = option.remove_surrounding_quotes()) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs index 6accfe2334..6907eba968 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs @@ -41,7 +41,7 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon optionSet .Add("s=|source=", "Source - The source to find the package(s) to install. Special sources include: ruby, webpi, cygwin, windowsfeatures, and python. To specify more than one source, pass it with a semi-colon separating the values (e.g. \"'source1;source2'\"). Defaults to default feeds.", - option => configuration.Sources = option.remove_surrounding_quotes()) + option => configuration.Sources = configuration.ExplicitSources = option.remove_surrounding_quotes()) .Add("version=", "Version - A specific version to install. Defaults to unspecified.", option => configuration.Version = option.remove_surrounding_quotes()) diff --git a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs index 6bb87039a8..166becafd3 100644 --- a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs +++ b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs @@ -252,6 +252,12 @@ private void append_output(StringBuilder propertyValues, string append) /// public string Sources { get; set; } + /// + /// One or more source locations set by comamnd line only. Semi-colon delimited. + /// Do not set this anywhere other than parsing CLI arguments for commands. + /// + public string ExplicitSources { get; set; } + public string SourceType { get; set; } // top level commands diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs index 610f680223..4a246db552 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs @@ -79,59 +79,60 @@ public ICredentials GetCredentials(Uri uri, IWebProxy proxy, CredentialType cred } // credentials were not explicit - // discover based on closest match in sources - var candidateSources = _config.MachineSources.Where( - s => - { - var sourceUrl = s.Key.TrimEnd('/'); - - try - { - var sourceUri = new Uri(sourceUrl); - return sourceUri.Host.is_equal_to(uri.Host) - && !string.IsNullOrWhiteSpace(s.Username) - && !string.IsNullOrWhiteSpace(s.EncryptedPassword); - } - catch (Exception) - { - this.Log().Error("Source '{0}' is not a valid Uri".format_with(sourceUrl)); - } - - return false; - }).ToList(); - + // find matching source(s) in sources list + var trimmedTargetUri = new Uri(uri.AbsoluteUri.TrimEnd('/')); MachineSourceConfiguration source = null; + // If the user has specified --source with a *named* source and not a URL, try to find the matching one + // with the correct URL for this credential request. + // Lower case all of the explicitly named sources so that we can use .Contains to compare them. + var namedExplicitSources = _config.ExplicitSources?.ToLower().Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries) + .Where(s => !Uri.IsWellFormedUriString(s, UriKind.Absolute)) + .ToList(); - if (candidateSources.Count == 1) + if (namedExplicitSources?.Count > 0) { - // only one match, use it - source = candidateSources.FirstOrDefault(); + // Instead of using Uri.Equals(), we're using Uri.Compare() on the HttpRequestUrl components as this allows + // us to ignore the case of everything. + source = _config.MachineSources + .Where(s => namedExplicitSources.Contains(s.Name.ToLower()) + && Uri.TryCreate(s.Key.TrimEnd('/'), UriKind.Absolute, out var trimmedSourceUri) + && Uri.Compare(trimmedSourceUri, trimmedTargetUri, UriComponents.HttpRequestUrl, UriFormat.Unescaped, StringComparison.OrdinalIgnoreCase) == 0) + .FirstOrDefault(); } - else if (candidateSources.Count > 1) + + if (source is null) { - // find the source that is the closest match - foreach (var candidateSource in candidateSources.or_empty_list_if_null()) + // Could not find a valid source by name, or the source(s) specified were all URLs. + // Try to look up the target URL in the saved machine sources to attempt to match credentials. + // + // Note: This behaviour remains as removing it would be a breaking change. + var candidateSources = _config.MachineSources + .Where(s => !string.IsNullOrWhiteSpace(s.Username) + && !string.IsNullOrWhiteSpace(s.EncryptedPassword) + && Uri.TryCreate(s.Key.TrimEnd('/'), UriKind.Absolute, out var trimmedSourceUri) + && (Uri.Compare(trimmedSourceUri, trimmedTargetUri, UriComponents.HttpRequestUrl, UriFormat.Unescaped, StringComparison.OrdinalIgnoreCase) == 0 + // If the target starts with a machine source, we're in a scenario where NuGet is now trying to download the package. + // For whatever reason NuGet sometimes forgets the credentials between discovering the package and downloading the package. + || trimmedTargetUri.ToString().StartsWith(trimmedSourceUri.ToString(), StringComparison.OrdinalIgnoreCase))) + .ToList(); + + if (candidateSources.Count == 1) { - var candidateRegEx = new Regex(Regex.Escape(candidateSource.Key.TrimEnd('/')),RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (candidateRegEx.IsMatch(uri.OriginalString.TrimEnd('/'))) - { - this.Log().Debug("Source selected will be '{0}'".format_with(candidateSource.Key.TrimEnd('/'))); - source = candidateSource; - break; - } + // only one match, use it + source = candidateSources.First(); } - - if (source == null && !retrying) + else if (candidateSources.Count > 1 && !retrying) { - // use the first source. If it fails, fall back to grabbing credentials from the user + // Use the credentials from the first found source, unless it's a retry (creds already tried and failed) + // use the first source. If it fails, fall back to grabbing credentials from the user. var candidateSource = candidateSources.First(); this.Log().Debug("Evaluated {0} candidate sources but was unable to find a match, using {1}".format_with(candidateSources.Count, candidateSource.Key.TrimEnd('/'))); source = candidateSource; } } - if (source == null) + if (source is null) { this.Log().Debug("Asking user for credentials for '{0}'".format_with(uri.OriginalString)); return get_credentials_from_user(uri, proxy, credentialType); diff --git a/tests/helpers/common/Chocolatey/Disable-ChocolateySource.ps1 b/tests/helpers/common/Chocolatey/Disable-ChocolateySource.ps1 index 523839f5c9..58cb264f53 100644 --- a/tests/helpers/common/Chocolatey/Disable-ChocolateySource.ps1 +++ b/tests/helpers/common/Chocolatey/Disable-ChocolateySource.ps1 @@ -8,10 +8,8 @@ function Disable-ChocolateySource { [Parameter()] [switch]$All ) - # Significantly weird behaviour with piping this source list by property name. - $CurrentSources = (Invoke-Choco source list -r).Lines | ConvertFrom-ChocolateyOutput -Command SourceList | Where-Object { - $_.Name -like $Name - } + + $CurrentSources = Get-ChocolateySource -Name $Name foreach ($Source in $CurrentSources) { $null = Invoke-Choco source disable --name $Source.Name } diff --git a/tests/helpers/common/Chocolatey/Enable-ChocolateySource.ps1 b/tests/helpers/common/Chocolatey/Enable-ChocolateySource.ps1 index 6a44cd184e..6f6a2f1abd 100644 --- a/tests/helpers/common/Chocolatey/Enable-ChocolateySource.ps1 +++ b/tests/helpers/common/Chocolatey/Enable-ChocolateySource.ps1 @@ -9,9 +9,7 @@ function Enable-ChocolateySource { [switch]$All ) # Significantly weird behaviour with piping this source list by property name. - $CurrentSources = (Invoke-Choco source list -r).Lines | ConvertFrom-ChocolateyOutput -Command SourceList | Where-Object { - $_.Name -like $Name - } + $CurrentSources = Get-ChocolateySource -Name $Name foreach ($Source in $CurrentSources) { $null = Invoke-Choco source enable --name $Source.Name } diff --git a/tests/helpers/common/Chocolatey/Get-ChocolateySource.ps1 b/tests/helpers/common/Chocolatey/Get-ChocolateySource.ps1 new file mode 100644 index 0000000000..7b097500a9 --- /dev/null +++ b/tests/helpers/common/Chocolatey/Get-ChocolateySource.ps1 @@ -0,0 +1,11 @@ +function Get-ChocolateySource { + [CmdletBinding()] + param( + [Parameter()] + [string]$Name = "*" + ) + # Significantly weird behaviour with piping this source list by property name. + (Invoke-Choco source list -r).Lines | ConvertFrom-ChocolateyOutput -Command SourceList | Where-Object { + $_.Name -like $Name + } +} diff --git a/tests/pester-tests/BundledApplications.Tests.ps1 b/tests/pester-tests/BundledApplications.Tests.ps1 index bb41c55a55..bab34ee571 100644 --- a/tests/pester-tests/BundledApplications.Tests.ps1 +++ b/tests/pester-tests/BundledApplications.Tests.ps1 @@ -8,8 +8,6 @@ Describe 'Ensuring correct version of is installed' -Tag BundledApplicati BeforeAll { # Because we're not modifying the install in any way, there is no need to Initialize-ChocolateyTestInstall $ToolPath = "$env:ChocolateyInstall/tools/$Name.exe" - # TODO: Encapsulate in an environment variable once kitchen-pester has new version - https://github.com/chocolatey/choco/issues/2692 - $Thumbprint = '83AC7D88C66CB8680BCE802E0F0F5C179722764B' } It 'Should be in Chocolatey tools directory' { @@ -18,8 +16,17 @@ Describe 'Ensuring correct version of is installed' -Tag BundledApplicati It 'Should be appropriately signed' -Skip:(-not $IsSigned) { $signature = Get-AuthenticodeSignature -FilePath $ToolPath - $signature.Status | Should -Be 'Valid' - $signature.SignerCertificate.Thumbprint | Should -Be $Thumbprint + + # For non production builds, the official signing certificate is not in play, so need to + # alter the assestion slightly, to account for the fact that UnknownError, is making the + # underlying problem, i.e. "A certificate chain processed, but terminated in a root + # certificate which is not trusted by the trust provider" + if ($signature.SignerCertificate.Issuer -match 'Chocolatey Software, Inc') { + $signature.Status | Should -Be 'UnknownError' + } + elseif ($signature.SignerCertificate.Issuer -match 'DigiCert') { + $signature.Status | Should -Be 'Valid' + } } It 'Should be version ' { diff --git a/tests/pester-tests/chocolatey.Tests.ps1 b/tests/pester-tests/chocolatey.Tests.ps1 index 926e6760fe..bdbecd7208 100644 --- a/tests/pester-tests/chocolatey.Tests.ps1 +++ b/tests/pester-tests/chocolatey.Tests.ps1 @@ -1,4 +1,4 @@ -Import-Module helpers/common-helpers +Import-Module helpers/common-helpers Describe "Ensuring Chocolatey is correctly installed" -Tag Environment, Chocolatey { BeforeDiscovery { @@ -23,8 +23,7 @@ Describe "Ensuring Chocolatey is correctly installed" -Tag Environment, Chocolat } BeforeAll { - # TODO: Both this thumbprint and strong name key should be in an environment variable. Update when new kitchen-pester is available. - https://github.com/chocolatey/choco/issues/2692 - $ChocolateyThumbprint = '83AC7D88C66CB8680BCE802E0F0F5C179722764B' + # TODO: This strong name key should be in an environment variable. Update when new kitchen-pester is available. - https://github.com/chocolatey/choco/issues/2692 $ChocolateyStrongNameKey = '79d02ea9cad655eb' # These lines are part of testing the issue # https://github.com/chocolatey/choco/issues/2233 @@ -112,14 +111,20 @@ Describe "Ensuring Chocolatey is correctly installed" -Tag Environment, Chocolat # This is skipped when not run in CI because it requires signed executables. Context "File signing (<_.FullName>)" -Foreach @($PowerShellFiles; $ExecutableFiles; $StrongNamingKeyFiles) -Skip:((-not $env:TEST_KITCHEN) -or (-not (Test-ChocolateyVersionEqualOrHigherThan "1.0.0"))) { BeforeAll { + # Due to changes in the signing setup, the certificate used to sign PS1 files and the Chocolatey CLI executable MIGHT be different. This ensures that the both certificates are trusted. $FileUnderTest = $_ - $SignerCert = (Get-AuthenticodeSignature (Get-ChocoPath)).SignerCertificate + $Ps1Cert = (Get-AuthenticodeSignature (Join-Path (Split-Path (Split-Path (Get-ChocoPath))) 'helpers/chocolateyScriptRunner.ps1')).SignerCertificate + $ExeCert = (Get-AuthenticodeSignature (Get-ChocoPath)).SignerCertificate $Cert = "$PWD\cert.cer" - # Write out the certificate - [IO.File]::WriteAllBytes($Cert, $SignerCert.export([security.cryptography.x509certificates.x509contenttype]::cert)) + # Write out the exe certificate + [IO.File]::WriteAllBytes($Cert, $ExeCert.export([security.cryptography.x509certificates.x509contenttype]::cert)) # Trust the certificate Import-Certificate -FilePath $Cert -CertStoreLocation 'Cert:\CurrentUser\TrustedPublisher\' Remove-Item -Path $Cert -Force -ErrorAction Ignore + # Write out the ps1 certificate + [IO.File]::WriteAllBytes($Cert, $Ps1Cert.export([security.cryptography.x509certificates.x509contenttype]::cert)) + # Trust the certificate + Import-Certificate -FilePath $Cert -CertStoreLocation 'Cert:\CurrentUser\TrustedPublisher\' } AfterAll { @@ -128,8 +133,17 @@ Describe "Ensuring Chocolatey is correctly installed" -Tag Environment, Chocolat It "Should be signed with our certificate" -Skip:($_.Name -like 'package*.exe') { $authenticodeSignature = Get-AuthenticodeSignature $FileUnderTest - $authenticodeSignature.Status | Should -Be 'Valid' - $authenticodeSignature.SignerCertificate.Thumbprint | Should -Be $ChocolateyThumbprint + + # For non production builds, the official signing certificate is not in play, so need to + # alter the assestion slightly, to account for the fact that UnknownError, is making the + # underlying problem, i.e. "A certificate chain processed, but terminated in a root + # certificate which is not trusted by the trust provider" + if ($authenticodeSignature.SignerCertificate.Issuer -match 'Chocolatey Software, Inc') { + $authenticodeSignature.Status | Should -Be 'UnknownError' + } + elseif ($authenticodeSignature.SignerCertificate.Issuer -match 'DigiCert') { + $authenticodeSignature.Status | Should -Be 'Valid' + } } It "Should be strongly named with our strong name key" -Skip:($_ -notin $StrongNamingKeyFilesToCheck) { diff --git a/tests/pester-tests/commands/choco-push.Tests.ps1 b/tests/pester-tests/commands/choco-push.Tests.ps1 index 2f79fc87df..0d5c3ebdf1 100644 --- a/tests/pester-tests/commands/choco-push.Tests.ps1 +++ b/tests/pester-tests/commands/choco-push.Tests.ps1 @@ -56,10 +56,11 @@ Describe "choco push" -Tag Chocolatey, PushCommand, ProxySkip -Skip:($null -eq $ } It "Should Report the actual cause of the error" { - $Output.Lines | Should -Contain "Attempting to push $PackageUnderTest.$VersionUnderTest.nupkg to $RepositoryToUse" - $Output.Lines | Should -Contain "An error has occurred. It's possible the package version already exists on the repository or a nuspec element is invalid. See error below..." - $Output.String | Should -Match "Failed to process request. '" - $Output.Lines | Should -Contain "The remote server returned an error: (409) Conflict.." + $Output.Lines | Should -Contain "Attempting to push $PackageUnderTest.$VersionUnderTest.nupkg to $RepositoryToUse" -Because $Output.String + # The output seen in Team City differs from when run locally. The following strings are + # consistent between both output messages, and should be sufficient to identify issues. + $Output.String | Should -Match "An error has occurred. " + $Output.String | Should -Match "package version already exists on the repository" } } diff --git a/tests/pester-tests/features/CredentialProvider.Tests.ps1 b/tests/pester-tests/features/CredentialProvider.Tests.ps1 new file mode 100644 index 0000000000..2457e38c7f --- /dev/null +++ b/tests/pester-tests/features/CredentialProvider.Tests.ps1 @@ -0,0 +1,73 @@ +# These tests are to ensure that credentials from one configured and enabled source are not +# picked up and used when a URL is matching based on the hostname. These tests use an authenticated +# source without explicitly providing a username/password. It is expected that Chocolatey will prompt for +# the username and password. +Describe 'Ensuring credentials do not bleed from configured sources' -Tag CredentialProvider -ForEach @( + # Info and outdated are returning 0 in all test cases we've thrown at them. + # Suspect the only way either of these commands actually return non-zero is in a scenario where + # something goes catastrophically wrong outside of the actual command calls. + @{ + Command = 'info' + ExitCode = 0 + } + @{ + Command = 'outdated' + ExitCode = 0 + } + @{ + Command = 'install' + ExitCode = 1 + } + @{ + Command = 'search' + ExitCode = 0 + } + @{ + Command = 'upgrade' + ExitCode = 1 + } + @{ + Command = 'download' + ExitCode = 1 + } +) { + BeforeDiscovery { + $HasLicensedExtension = Test-PackageIsEqualOrHigher -PackageName 'chocolatey.extension' -Version '5.0.0' + } + + BeforeAll { + Initialize-ChocolateyTestInstall + Disable-ChocolateySource -All + Enable-ChocolateySource -Name 'hermes' + $SetupSource = Get-ChocolateySource -Name 'hermes-setup' + Remove-Item download -force -recurse + } + + # Skip the download command if chocolatey.extension is not installed. + Context 'Command ()' -Skip:($Command -eq 'download' -and -not $HasLicensedExtension) { + BeforeAll { + # Picked a package that is on `hermes-setup` but not on `hermes`. + $PackageUnderTest = 'chocolatey-compatibility.extension' + Restore-ChocolateyInstallSnapshot + # Chocolatey will prompt for credentials, we need to force something in there, and this will do that. + $Output = 'n' | Invoke-Choco $Command $PackageUnderTest --confirm --source="'$($SetupSource.Url)'" + } + + AfterAll { + Remove-ChocolateyInstallSnapshot + } + + It 'Exits Correctly ()' { + $Output.ExitCode | Should -Be $ExitCode -Because $Output.String + } + + It 'Outputs error message' { + if ($Command -eq 'search') { + $Output.Lines | Should -Contain "[NuGet] Not able to contact source '$($SetupSource.Url)'. Error was The remote server returned an error: (401) Unauthorized." -Because $Output.String + } else { + $Output.Lines | Should -Contain "Error retrieving packages from source '$($SetupSource.Url)':" -Because $Output.String + $Output.Lines | Should -Contain "The remote server returned an error: (401) Unauthorized." -Because $Output.String + } + } + } +}