-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install-ChocolateyZipPackage - Unzip specific folder feature is broken after introducing 7zip #676
Comments
From original issue: I'm updating a package that downloads an archive with x64 and Win32 subdirectories. I used to extract the entire thing and manually remove the unneeded components. But, I figured I would try the as-yet undocumented $name = "bellavista"
$url = "http://.../bellavista.zip"
$tools = Split-Path $MyInvocation.MyCommand.Definition
$folder = if(Get-ProcessorBits 64) { "x64" } else { "Win32" }
Install-ChocolateyZipPackage -PackageName $name -Url $url -UnzipLocation $tools -SpecificFolder $folder But, it didn't work. The first thing I saw was a goofy log message. Look at the "full path" in bold. It contains a non-path
And, digging in the source, I saw a bad 7za command line being constructed 7za x -o"c:\Chocolatey\lib\bellavista.1.0\tools" -y "c:\users\foo\temp\chocolatey\bellavista\bellavistaInstall.zip\x64" From my reading of the command line reference, and hacking my helper function, the correct command line should be... 7za x "c:\users\foo\temp\chocolatey\bellavista\bellavistaInstall.zip -o"c:\Chocolatey\lib\bellavista.1.0\tools" "x64" -y And, actually, with this fix, you could supply any glob pattern to 7za, not just a specific folder. |
I've just hit this too. In my case I wanted to extract a single directory and its contents from a zip. Changing the command from the broken current form...
to
is maybe not quite right either. The files from |
This is open for hacktoberfest, if you want to give it an attempt we'd be open to the contribution! |
I can give this one a shot. @ferventcoder - I need clarification on the behavior of whether to preserve the path in the zip package. @alexjfisher expressed uncertainty about this. |
I can't tell under what circumstances this bit of code would be valid - tacking the specific folder directly onto the zip file name? What am I missing? |
PR: #1023 |
Previously, when attempting to unzip a subdirectory in a zipped archive, the Chocolatey unzip functions were ignoring the `SpecificFolder` parameter. This was caused by a change to use 7za.exe in August 2013 in commit chocolatey-archive/chocolatey@2e83d2e. That changed carried over into the newer codebase. More recently there was a switch back to 7z.exe (full 7zip), so it is possible to unzip a subdirectory in an archive again. Ensure that `SpecficFolder` is added to the 7zip options when it is specified.
* pr1023: (GH-676) Fix: Unzip specific folder feature is broken
Migrating issue # 406 from chocolatey-archive/chocolatey#406
In short, attempting to use the
specificFolder
parameter forInstall-ChocolateyZipPackage
(and ultimatelyGet-ChocolateyUnzip
doesn't work. Regression issue after switching to 7za.The text was updated successfully, but these errors were encountered: