choco icon indicating copy to clipboard operation
choco copied to clipboard

(#2603) Export pin status

Open TheCakeIsNaOH opened this issue 3 years ago • 6 comments

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

  1. Run .\choco.exe install iperf2 wget --allow-unofficial
  2. Run .\choco.exe pin add -n iperf2 --allow-unofficial
  3. Run .\choco.exe export --include-arguments --allow-unofficial
  4. Check that the exported packages.config includes <package id="iperf2" pinPackage="true" />
  5. Run .\choco.exe export --include-argument --exclude-pins --allow-unofficial
  6. Check that the export packages.config does not include pinPackage for iperf2

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.

TheCakeIsNaOH avatar Mar 06 '22 20:03 TheCakeIsNaOH

Coverage Status

Coverage increased (+0.4%) to 27.945% when pulling 290ac653cea1fe4adda6d0f9495b806891c36520 on TheCakeIsNaOH:export-pin into d08d1f63cc74f3e18e2e653a0a95f4c39d1b7077 on chocolatey:develop.

coveralls avatar Jun 27 '22 18:06 coveralls

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 packages
  • choco install $(cat choco.list): to reinstall all packages with a single choco call

So choco export is incomplete without install arguments and pins and anything else needed to replicate an environment

aetonsi avatar Aug 08 '23 09:08 aetonsi

@aetonsi This PR is in draft and no milestone has been targetted for its release.

pauby avatar Aug 08 '23 11:08 pauby

Rebased on top of #3003

TheCakeIsNaOH avatar Jan 10 '24 00:01 TheCakeIsNaOH