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

(#798) Add parameter to install and upgrade commands to pin after install #2463

Merged
merged 5 commits into from
Aug 11, 2022

Conversation

TheCakeIsNaOH
Copy link
Member

@TheCakeIsNaOH TheCakeIsNaOH commented Nov 18, 2021

Description Of Changes

This adds a parameter to pin packages after install or upgrade.
It re-uses the code in save_package_information to create the pin file.

Motivation and Context

See #798

Testing

  • Installed wget with --pin, checked that it was pinned with choco pin list
  • Unpinned and uninstalled
  • Install wget without --pin, checked that it was not pinned with choco pin list
  • Unpinned and uninstalled
  • Upgraded wget with --pin, checked that it was pinned with choco pin list
  • Unpinned and uninstalled
  • Upgraded wget without --pin, checked that it was not pinned with choco pin list
  • Unpinned and uninstalled

Create this packages.config file:

<?xml version="1.0" encoding="utf-8"?>
<packages>
    <package id="wget" pinPackage="true" />
</packages>

Install via that file and then check that wget is pinned with choco pin list

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 #798

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.
  • N/A PowerShell v2 compatibility checked.

@TheCakeIsNaOH
Copy link
Member Author

I am aware that this is a duplicate PR to #1915, I just think that this is a cleaner implementation to add the pin file directly via save_package_information instead of calling _chocolateyPinCommand.set_pin()

@bergmeister feel free to use my code to update your PR if you want and I can close this PR. It was easier to throw this PR together rather than trying to describe what I am suggesting in writing.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 28.526% when pulling 78287ad on TheCakeIsNaOH:install-pin into 6f3fc15 on chocolatey:develop.

Make indenting consistent for parameters in install and upgrade commands.
This adds a parameter to pin packages after install or upgrade.
It re-uses the code in save_package_information to create the pin file.
Add specs for pin parameter for the install/upgrade commands
This adds the PinPackage element to the definition of the
packages.config format. This allows the pin-package argument
to be used via a config file.
gep13
gep13 previously approved these changes Aug 11, 2022
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
Copy link
Member

gep13 commented Aug 11, 2022

@TheCakeIsNaOH thanks for pulling all this together! I made a slight change in the PR to mark the new option as being available in 1.2.0 rather than 1.1.0.

I will get this merged in, assuming that the CI builds pass.

A mistake was made in previous commit, where property name was changed
to use a more consistent version, however, the wrong property name was
changed, and this wasn't tested before pushing up the commit.
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
Copy link
Member

gep13 commented Aug 11, 2022

The failing Ubuntu build here is a known issue, so going to move forward with getting this merged!

@gep13 gep13 merged commit 974a3bc into chocolatey:develop Aug 11, 2022
@TheCakeIsNaOH TheCakeIsNaOH deleted the install-pin branch August 11, 2022 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for the --pin option on the install and upgrade commands
3 participants