Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (version) 0.9.10.2
  (doc) update CHANGELOG/nuspec
  (GH-758) Ensure log path exists
  (GH-813) Fix double chocolatey logging folder
  (GH-813) Shorten Template default log path
  (doc) update default options help messages
  (maint) Don't log creation of folder
  (maint) formatting / add message consistency
  (GH-814) Ensure any version of choco
  (GH-811) Skip resource / licensed assemblies
  (version) 0.9.10.1
  (doc) update CHANGELOG/nuspec
  (GH-810) Install of choco sets exit code
  (GH-812) Upgrade 7zip to 16.02 to address CVEs
  (doc) Note functions Calling Set-PowerShellExitCode
  (GH-810) Fix - Cannot bind parameter exitCode
  • Loading branch information
ferventcoder committed Jun 19, 2016
2 parents 6c25980 + 071c4e1 commit fc1c895
Show file tree
Hide file tree
Showing 17 changed files with 180 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .uppercut
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<property name="version.major" value="0" overwrite="false" />
<property name="version.minor" value="9" overwrite="false" />
<property name="version.patch" value="10" overwrite="false" />
<property name="version.fix" value="0" overwrite="false" />
<property name="version.fix" value="2" overwrite="false" />
<property name="version.nuget.prerelease" value="" overwrite="false" />
<property name="version.use.build_date" value="false" overwrite="false" />
<property name="assembly.description" value="${project.name} is a product of ${company.name} - All Rights Reserved." overwrite="false" />
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## [0.9.10.2](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.10.2+is%3Aclosed) (June 19, 2016)

### BUG FIXES

* Fix - Chocolatey Licensed is unable to find 0.9.10.x (only 0.9.10.0) - see [#814](https://github.com/chocolatey/choco/issues/814)
* Fix - Logging is broken in some packages due to new TEMP directory - see [#813](https://github.com/chocolatey/choco/issues/813)
* [API] Fix - When performing an Install/Uninstall/Upgrade operation through the API, an error is throw for "chocolatey.resources" - see [#811](https://github.com/chocolatey/choco/issues/811)

### IMPROVEMENTS

* Ensure log file path exists - and fix the log file arguments if necessary - see [#758](https://github.com/chocolatey/choco/issues/758)


## [0.9.10.1](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.10.1+is%3Aclosed) (June 18, 2016)

### BUG FIXES

* Fix - Cannot bind argument to parameter 'exitCode' because it is null - see [#810](https://github.com/chocolatey/choco/issues/810)

### IMPROVEMENTS

* [Security] Upgrade to 7zip 16.02 to overcome CVE-2016-2334/CVE-2016-2335 - see [#812](https://github.com/chocolatey/choco/issues/812)


## [0.9.10](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.10+is%3Aclosed) (June 17, 2016)

![Chocolatey Logo](https://cdn.rawgit.com/chocolatey/choco/14a627932c78c8baaba6bef5f749ebfa1957d28d/docs/logo/chocolateyicon.gif "Chocolatey")
Expand Down
24 changes: 24 additions & 0 deletions nuget/chocolatey/chocolatey.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,30 @@ In that mess there is a link to the [PowerShell Chocolatey module reference](htt
<releaseNotes>
See all - https://github.com/chocolatey/choco/blob/stable/CHANGELOG.md

## 0.9.10.2

### BUG FIXES

* Fix - Chocolatey Licensed is unable to find 0.9.10.x (only 0.9.10.0) - see [#814](https://github.com/chocolatey/choco/issues/814)
* Fix - Logging is broken in some packages due to new TEMP directory - see [#813](https://github.com/chocolatey/choco/issues/813)
* [API] Fix - When performing an Install/Uninstall/Upgrade operation through the API, an error is throw for "chocolatey.resources" - see [#811](https://github.com/chocolatey/choco/issues/811)

### IMPROVEMENTS

* Ensure log file path exists - and fix the log file arguments if necessary - see [#758](https://github.com/chocolatey/choco/issues/758)


## 0.9.10.1

### BUG FIXES

* Fix - Cannot bind argument to parameter 'exitCode' because it is null - see [#810](https://github.com/chocolatey/choco/issues/810)

### IMPROVEMENTS

* [Security] Upgrade to 7zip 16.02 to overcome CVE-2016-2334/CVE-2016-2335 - see [#812](https://github.com/chocolatey/choco/issues/812)


## 0.9.10

The "I got 99 problems, but a package manager ain't one" release. With the release of 0.9.10 (or if you prefer 0.9.10.0), we're about to make everything 100% better in your Windows package management world. We've addressed over 100 features and bugs in this release. We looked at how we could improve PowerShell and we've come out with a [competely internal host](https://github.com/chocolatey/choco/issues/8) that can Prompt and Read-Host in a way that times out and selects default values after a period of time. Speaking of PowerShell, how about some tab completion `choco &lt;tab&gt;` to `choco install node&lt;tab&gt;`? How about never having to [close and reopen your shell again](https://github.com/chocolatey/choco/issues/664)?
Expand Down
3 changes: 3 additions & 0 deletions nuget/chocolatey/tools/chocolateysetup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ Creating Chocolatey folders if they do not already exist.

Add-ChocolateyProfile
Install-DotNet4IfMissing
if ($env:ChocolateyExitCode -eq $null -or $env:ChocolateyExitCode -eq '') {
$env:ChocolateyExitCode = 0
}

@"
Chocolatey (choco.exe) is now ready.
Expand Down
25 changes: 24 additions & 1 deletion src/chocolatey.console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace chocolatey.console
using System.Collections.Generic;
using System.IO;
using System.Linq;
using infrastructure.adapters;
using System.Reflection;
using infrastructure.app;
using infrastructure.app.builders;
using infrastructure.app.configuration;
Expand All @@ -31,6 +31,7 @@ namespace chocolatey.console
using infrastructure.logging;
using infrastructure.registration;
using resources;
using Assembly = infrastructure.adapters.Assembly;
using Console = System.Console;
using Environment = System.Environment;
using IFileSystem = infrastructure.filesystem.IFileSystem;
Expand All @@ -43,6 +44,8 @@ private static void Main(string[] args)
{
try
{
add_assembly_resolver();

string loggingLocation = ApplicationParameters.LoggingLocation;
//no file system at this point
if (!Directory.Exists(loggingLocation)) Directory.CreateDirectory(loggingLocation);
Expand Down Expand Up @@ -161,6 +164,26 @@ private static void Main(string[] args)
}
}

private static ResolveEventHandler _handler = null;

private static void add_assembly_resolver()
{
_handler = (sender, args) =>
{
var requestedAssembly = new AssemblyName(args.Name);
if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey)
&& !requestedAssembly.Name.is_equal_to("chocolatey.licensed")
&& !requestedAssembly.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase))
{
return typeof(ConsoleApplication).Assembly;
}

return null;
};

AppDomain.CurrentDomain.AssemblyResolve += _handler;
}

private static void report_version_and_exit_if_requested(string[] args, ChocolateyConfiguration config)
{
if (args == null || args.Length == 0) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if ($env:ChocolateyExitCode -ne $null -and $env:ChocolateyExitCode -ne '') {
$exitCode = $env:ChocolateyExitCode
}

if ($exitCode -ne 0) {
if ($exitCode -ne $null -and $exitCode -ne '' -and $exitCode -ne 0) {
Set-PowerShellExitCode $exitCode
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ publicly (like on the community feed). Otherwise, please use
Install-ChocolateyZipPackage to download those resources from their
official distribution points.
Starting in 0.9.10, will automatically call Set-PowerShellExitCode to
set the package exit code based on 7-zip's exit code.
.PARAMETER FileFullPath
This is the full path to the zip file. If embedding it in the package
next to the install script, the path will be like
Expand Down Expand Up @@ -93,7 +96,7 @@ param(
}

Write-Host "Extracting $fileFullPath to $destination..."
if (![System.IO.Directory]::Exists($destination)) {[System.IO.Directory]::CreateDirectory($destination)}
if (![System.IO.Directory]::Exists($destination)) { [System.IO.Directory]::CreateDirectory($destination) | Out-Null }

$7zip = Join-Path "$helpersPath" '..\tools\7za.exe'
if (!([System.IO.File]::Exists($7zip))) {
Expand Down
3 changes: 3 additions & 0 deletions src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ FileName location specified.
This is a low-level function and not recommended for use in package
scripts. It is recommended you call `Get-ChocolateyWebFile` instead.
Starting in 0.9.10, will automatically call Set-PowerShellExitCode to
set the package exit code to 404 if the resource is not found.
.INPUTS
None
Expand Down
3 changes: 3 additions & 0 deletions src/chocolatey.resources/helpers/functions/Get-WebFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ to the FileName location specified.
This is a low-level function and not recommended for use in package
scripts. It is recommended you call `Get-ChocolateyWebFile` instead.
Starting in 0.9.10, will automatically call Set-PowerShellExitCode to
set the package exit code to 404 if the resource is not found.
.INPUTS
None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,30 @@ Pro / Business supports a single, ubiquitous install directory option.
}
$overrideArguments = $env:chocolateyInstallOverride;

# remove \chocolatey\chocolatey\
$silentArgs = $silentArgs -replace '\\chocolatey\\chocolatey\\', '\chocolatey\'
$additionalInstallArgs = $additionalInstallArgs -replace '\\chocolatey\\chocolatey\\', '\chocolatey\'

try {
# make sure any logging folder exists
$pattern = "(?:['`"])([a-zA-Z]\:\\[^'`"]+)(?:[`"'])|([a-zA-Z]\:\\[\S]+)"
$silentArgs, $additionalInstallArgs | %{ Select-String $pattern -input $_ -AllMatches } |
% { $_.Matches } | % {
$argDirectory = $_.Groups[1]
if ($argDirectory -eq $null -or $argDirectory -eq '') { continue }
$argDirectory = [System.IO.Path]::GetFullPath([System.IO.Path]::GetDirectoryName($argDirectory))
Write-Debug "Ensuring '$argDirectory' exists"
if (![System.IO.Directory]::Exists($argDirectory)) { [System.IO.Directory]::CreateDirectory($argDirectory) | Out-Null }
}
} catch {
Write-Debug "Error ensuring directories exist - $($_.Exception.Message)"
}

if ($fileType -like 'msi') {
$msiArgs = "/i `"$file`""
if ($overrideArguments) {
$msiArgs = "$msiArgs $additionalInstallArgs";
Write-Host "Overriding package arguments with `'$additionalInstallArgs`'";
Write-Host "Overriding package arguments with '$additionalInstallArgs'";
} else {
$msiArgs = "$msiArgs $silentArgs $additionalInstallArgs";
}
Expand All @@ -212,7 +231,7 @@ Pro / Business supports a single, ubiquitous install directory option.
if ($fileType -like 'exe') {
if ($overrideArguments) {
$env:ChocolateyExitCode = Start-ChocolateyProcessAsAdmin "$additionalInstallArgs" $file -validExitCodes $validExitCodes
write-host "Overriding package arguments with `'$additionalInstallArgs`'";
Write-Host "Overriding package arguments with '$additionalInstallArgs'";
} else {
$env:ChocolateyExitCode = Start-ChocolateyProcessAsAdmin "$silentArgs $additionalInstallArgs" $file -validExitCodes $validExitCodes
}
Expand All @@ -222,11 +241,12 @@ Pro / Business supports a single, ubiquitous install directory option.

if ($overrideArguments) {
$msuArgs = "$file $additionalInstallArgs"
Write-Host "Overriding package arguments with '$additionalInstallArgs'";
} else {
$msuArgs = "$file $silentArgs $additionalInstallArgs"
}
$env:ChocolateyExitCode = Start-ChocolateyProcessAsAdmin "$msuArgs" "$($env:SystemRoot)\System32\wusa.exe" -validExitCodes $validExitCodes
}

write-host "$packageName has been installed."
Write-Host "$packageName has been installed."
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@ Allows splatting with arguments that do not apply. Do not use directly.
Set-PowerShellExitCode 3010
#>
param (
[parameter(Mandatory=$true, Position=0)][int] $exitCode,
[parameter(Mandatory=$false, Position=0)][int] $exitCode,
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)

if ($exitCode -eq $null -or $exitCode -eq '') {
Write-Debug '$exitCode was passed null'
return
}

try {
$host.SetShouldExit($exitCode);
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ specified, it is run with PowerShell.
.NOTES
This command will assert UAC/Admin privileges on the machine.
Starting in 0.9.10, will automatically call Set-PowerShellExitCode to
set the package exit code in the following ways:
- 4 if the binary turns out to be a text file.
- The same exit code returned from the process that is run. If a 3010 is returned, it will set 3010 for the package.
.INPUTS
None
Expand Down
Binary file modified src/chocolatey.resources/tools/7za.exe
Binary file not shown.
70 changes: 48 additions & 22 deletions src/chocolatey.resources/tools/7zip.license.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,56 @@
7-Zip Extra
~~~~~~~~~~~
License for use and distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7-Zip
~~~~~
License for use and distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copyright (C) 1999-2015 Igor Pavlov.
7-Zip Copyright (C) 1999-2016 Igor Pavlov.

7-Zip Extra files are under the GNU LGPL license.
Licenses for files are:


Notes:
You can use 7-Zip Extra on any computer, including a computer in a commercial
organization. You don't need to register or pay for 7-Zip.
1) 7z.dll: GNU LGPL + unRAR restriction
2) All other files: GNU LGPL

The GNU LGPL + unRAR restriction means that you must follow both
GNU LGPL rules and unRAR restriction rules.

GNU LGPL information
--------------------

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
Note:
You can use 7-Zip on any computer, including a computer in a commercial
organization. You don't need to register or pay for 7-Zip.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You can receive a copy of the GNU Lesser General Public License from
http://www.gnu.org/
GNU LGPL information
--------------------

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You can receive a copy of the GNU Lesser General Public License from
http://www.gnu.org/


unRAR restriction
-----------------

The decompression engine for RAR archives was developed using source
code of unRAR program.
All copyrights to original unRAR code are owned by Alexander Roshal.

The license for original unRAR code has the following restriction:

The unRAR sources cannot be used to re-create the RAR compression algorithm,
which is proprietary. Distribution of modified unRAR sources in separate form
or as a part of other software is permitted, provided that it is clearly
stated in the documentation and source comments that the code may
not be used to develop a RAR (WinRAR) compatible archiver.


--
Igor Pavlov
4 changes: 3 additions & 1 deletion src/chocolatey/GetChocolatey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ private static void add_assembly_resolver()
_handler = (sender, args) =>
{
var requestedAssembly = new AssemblyName(args.Name);
if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey))
if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey)
&& !requestedAssembly.Name.is_equal_to("chocolatey.licensed")
&& !requestedAssembly.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase))
{
return typeof(Lets).Assembly;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,13 @@ private static void set_global_options(IList<string> args, ChocolateyConfigurati
{
option_set
.Add("d|debug",
"Debug - Run in Debug Mode.",
"Debug - Show debug messaging.",
option => config.Debug = option != null)
.Add("v|verbose",
"Verbose - See verbose messaging.",
"Verbose - Show verbose messaging.",
option => config.Verbose = option != null)
.Add("acceptlicense|accept-license",
"AcceptLicense - Accept license dialogs automatically.",
"AcceptLicense - Accept license dialogs automatically. Reserved for future use.",
option => config.AcceptLicense = option != null)
.Add("y|yes|confirm",
"Confirm all prompts - Chooses affirmative answer instead of prompting. Implies --accept-license",
Expand All @@ -326,10 +326,10 @@ private static void set_global_options(IList<string> args, ChocolateyConfigurati
config.AcceptLicense = option != null;
})
.Add("f|force",
"Force - force the behavior",
"Force - force the behavior. Do not use force during normal operation - it subverts some of the smart behavior for commands.",
option => config.Force = option != null)
.Add("noop|whatif|what-if",
"NoOp - Don't actually do anything.",
"NoOp / WhatIf - Don't actually do anything.",
option => config.Noop = option != null)
.Add("r|limitoutput|limit-output",
"LimitOutput - Limit the output to essential information",
Expand All @@ -355,7 +355,7 @@ private static void set_global_options(IList<string> args, ChocolateyConfigurati
"FailOnStandardError - Fail on standard error output (stderr), typically received when running external commands during install providers. This overrides the feature failOnStandardError.",
option => config.Features.FailOnStandardError = option != null)
.Add("use-system-powershell",
"UseSystemPowerShell - Execute PowerShell using an external process instead of the built-in PowerShell host. Available in 0.9.10+.",
"UseSystemPowerShell - Execute PowerShell using an external process instead of the built-in PowerShell host. Should only be used when internal host is failing. Available in 0.9.10+.",
option => config.Features.UsePowerShellHost = option == null)
;
},
Expand Down
Loading

0 comments on commit fc1c895

Please sign in to comment.