Skip to content
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

(#1332) Add switch to disable logging for archive extraction #2449

Merged
merged 1 commit into from
Jul 1, 2022

Conversation

TheCakeIsNaOH
Copy link
Member

Description Of Changes

Adds a switch "disableLogging" to Get-ChocolateyUnzip and
Install-ChocolateyZipPackage. This switch disable 7zip logging of
extracted filenames and does not write out the log of extracted
files. Install-ChocolateyZip passes the switch to Get-ChocolateyUnzip,
and the functionality is implemented into Get-ChocolateyUnzip.

Motivation and Context

This is useful for large archives with a very large number of files as
logging the extracted files can significantly slow down the extraction
process.

Testing

  • Imported chocolateyInstall.psm1 into a powershell.exe -version 2 window, the module loads fine.
  • Ran .\choco.exe install filespy --verbose --debug to validate that the files are still correctly logged into the debug output and to the file
  • Downloaded the filespy package, edited the chocolateyInstall.ps1 to add the DisableLogging parameter, and installed the edited package to validate that the switch is passed correctly from Install-ChocolateyZipPackage to Get-ChocolateyUnzip and to validate that the logging and output file are correctly disabled.

Change Types Made

  • Bug fix (non-breaking change)
  • Feature / Enhancement (non-breaking change)
  • Breaking change (fix or feature that could cause existing functionality to change)

Related Issue

Fixes #1332

Change Checklist

  • Requires a change to the documentation
  • Documentation has been updated
  • Tests to cover my changes, have been added
  • All new and existing tests passed.
  • PowerShell v2 compatibility checked.

@TheCakeIsNaOH
Copy link
Member Author

Maybe I missed it, but I didn't see any tests that installed packages with archives, so there is nowhere to add a test at the moment.

@gep13
Copy link
Member

gep13 commented Dec 23, 2021

Pulling this in would require an upstream change in the chocolatey.extension. Going to hold off on this one for now...

@TheCakeIsNaOH
Copy link
Member Author

upstream change

Kind of pedantic, but wouldn't it be a downstream change? Since chocolatey.extension needs chocolatey, but not the other way arround?

@TheCakeIsNaOH TheCakeIsNaOH force-pushed the unzip-nolog branch 3 times, most recently from b7f368b to eba8a30 Compare June 27, 2022 15:31
@coveralls
Copy link

coveralls commented Jun 27, 2022

Coverage Status

Coverage remained the same at 28.482% when pulling d9b7be2 on TheCakeIsNaOH:unzip-nolog into d8ca7ba on chocolatey:develop.

@gep13
Copy link
Member

gep13 commented Jun 30, 2022

@TheCakeIsNaOH I have rebased this PR on the head of develop, so you will need to reset it before making any additional changes. I made my comments after rebasing as I thought I was ready to merge, and then I noticed a couple of things. Normally I don't force push to a branch unless I am ready to merge, apologies!

Adds a switch "disableLogging" to Get-ChocolateyUnzip and
Install-ChocolateyZipPackage. This switch disable 7zip logging of
extracted filenames and does not write out the log of extracted
files. Install-ChocolateyZip passes the switch to Get-ChocolateyUnzip,
and the functionality is implemented into Get-ChocolateyUnzip.

This is useful for large archives with a very large number of files as
logging the extracted files can significantly slow down the extraction
process.
@TheCakeIsNaOH
Copy link
Member Author

@gep13 I've updated the PR with your suggested changes.

@TheCakeIsNaOH TheCakeIsNaOH requested review from gep13 and vexx32 June 30, 2022 20:29
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gep13 gep13 merged commit cce748a into chocolatey:develop Jul 1, 2022
@gep13
Copy link
Member

gep13 commented Jul 1, 2022

@TheCakeIsNaOH thanks for getting that fixed up!

@TheCakeIsNaOH TheCakeIsNaOH deleted the unzip-nolog branch August 11, 2022 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants