(#2603) Export pin status
Description Of Changes
This adds the ability for the export command to include pins in the exported file. They will be exported if --include-arguments is specified, but can be excluded with --exclude-pins.
Motivation and Context
See #2603
Testing
- Run
.\choco.exe install iperf2 wget --allow-unofficial - Run
.\choco.exe pin add -n iperf2 --allow-unofficial - Run
.\choco.exe export --include-arguments --allow-unofficial - Check that the exported
packages.configincludes<package id="iperf2" pinPackage="true" /> - Run
.\choco.exe export --include-argument --exclude-pins --allow-unofficial - Check that the export
packages.configdoes not includepinPackageforiperf2
Change Types Made
- [ ] Bug fix (non-breaking change)
- [x] Feature / Enhancement (non-breaking change)
- [ ] Breaking change (fix or feature that could cause existing functionality to change)
Related Issue
Fixes #2603 Depends on #2506 (and thus #3003 as well)
Change Checklist
- [x] Requires a change to the documentation
- [x] Documentation has been updated
- [x] Tests to cover my changes, have been added
- [x] All new and existing tests passed.
- N/A PowerShell v2 compatibility checked.
Coverage increased (+0.4%) to 27.945% when pulling 290ac653cea1fe4adda6d0f9495b806891c36520 on TheCakeIsNaOH:export-pin into d08d1f63cc74f3e18e2e653a0a95f4c39d1b7077 on chocolatey:develop.
Is there any news on this? It is essential.. An export command that exports something that cannot be used to recreate the exact environment, is not very useful.. One could simply do:
( choco list | select -skip 1 | select -skiplast 1 | % { ($_ -split ' ')[0] } ) -join ' ' >choco.list: to get a space-separated list of packageschoco install $(cat choco.list): to reinstall all packages with a singlechococall
So choco export is incomplete without install arguments and pins and anything else needed to replicate an environment
@aetonsi This PR is in draft and no milestone has been targetted for its release.
Rebased on top of #3003