chocolatey / chocolatey/choco

Upgrade: When using `--pin`, include a message that the package was actually pinned

Open
#3,321 0 comments 0 reactions 0 assignees View on GitHub
0 - Triaging Enhancement
Dominant language
C#
Stars
11.5k
Forks
961
PR merge metrics
No merged PRs in 30d

Description

### Checklist

- [X] I have verified this is the correct repository for opening this issue.
- [X] I have verified no other issues exist related to my request.

### Is Your Feature Request Related To A Problem? Please describe.

When I upgrade a previously-pinned package and want it to be pinned again afterwards, there's no confirmation in the output of `choco upgrade --pin` to say it was actually pinned successfully, or that pinning was attempted at all.

Console session

```
PS C:\WINDOWS\system32> choco upgrade --pin androidstudio
Chocolatey v2.2.2
Upgrading the following packages:
androidstudio
By upgrading, you accept licenses for the packages.

You have androidstudio v2022.2.1.18 installed. Version 2022.3.1.19 is available based on your source(s).
androidstudio is pinned. Skipping pinned package.

Chocolatey upgraded 0/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Warnings:
- AndroidStudio - androidstudio is pinned. Skipping pinned package.
PS C:\WINDOWS\system32> choco pin remove --name androidstudio
Chocolatey v2.2.2
Trying to Remove a pin for androidstudio
Successfully removed a pin for androidstudio v2022.2.1.18.
PS C:\WINDOWS\system32> choco upgrade --pin androidstudio
Chocolatey v2.2.2
Upgrading the following packages:
androidstudio
By upgrading, you accept licenses for the packages.

You have androidstudio v2022.2.1.18 installed. Version 2022.3.1.19 is available based on your source(s).
Progress: Downloading AndroidStudio 2022.3.1.19... 100%

androidstudio v2022.3.1.19 [Approved]
androidstudio package files upgrade completed. Performing other installation steps.
Downloading AndroidStudio 64 bit
from 'https://redirector.gvt1.com/edgedl/android/studio/install/2022.3.1.19/android-studio-2022.3.1.19-windows.exe'
Progress: 100% - Completed download of C:\Users\User\AppData\Local\Temp\chocolatey\AndroidStudio\2022.3.1.19\android-studio-2022.3.1.19-windows.exe (1.05 GB).
Download of android-studio-2022.3.1.19-windows.exe (1.05 GB) completed.
Hashes match.
Installing AndroidStudio...
WARNING: Exit code '1223' was considered valid by script, but not as a Chocolatey success code. Returning '0'.
AndroidStudio has been installed.
Added C:\ProgramData\chocolatey\bin\studio64.exe shim pointed to 'c:\program files\android\android studio\bin\studio64.exe'.
androidstudio may be able to be automatically uninstalled.
The upgrade of androidstudio was successful.
Software installed as 'exe', install location is likely default.

Chocolatey upgraded 1/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\WINDOWS\system32> choco pin list
Chocolatey v2.2.2
...
androidstudio|2022.3.1.19
...
```

### Describe The Solution. Why is it needed?

Ideally, there'd be another line around `Chocolatey upgraded 1/1 packages.` to confirm it was also pinned, similar to the output from `pin` and `unpin`. Without it, I end up having to consult `choco pin list` to double-check.

### Additional Context

[chocolatey.log](https://github.com/chocolatey/choco/files/12566296/chocolatey.log) also doesn't show any explicit pinning of the package, only that `PinPackage='True'` appears in the initial config (though I'm not going to go digging into here each time to check it was actually pinned).

### Related Issues

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `choco upgrade --pin` with a package that is upgraded and then listed by `choco pin list`, and trace the upgrade path that handles the `--pin` option. Done means the command output explicitly confirms the package was pinned, with coverage for the successful upgrade case.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.