Checklist
What You Are Seeing?
I am not sure of what should be done to debug efficiently packages that have dependencies, and there were possibly confusing behaviors.
Sorry if it has been already discussed somewhere that I missed.
What is Expected?
Simplify/Clarify the debug method for packages with dependencies.
How Did You Get This To Happen?
In https://docs.chocolatey.org/en-us/create/create-packages-quick-start/#test-the-package , it is suggested to run
choco install package-name --source .
in a virtual machine, which, I guess, should be ideally clean with only the latest version of choco installed.
However, this command appears to immediately fail if the package has dependencies.
PS C:\Users\1\Downloads> choco install codac --source .
Chocolatey v2.4.3
Installing the following packages:
codac
By installing, you accept licenses for the packages.
Unable to resolve dependency 'chocolatey-core.extension'. Source(s) used: 'C:\Users\1\Downloads'.
Chocolatey installed 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures
- codac - Unable to resolve dependency 'chocolatey-core.extension'. Source(s) used: 'C:\Users\1\Downloads'.
A first idea could be to first install a previous online version of the package but this would not help fully testing the behavior of the package version we want to debug (since often just uninstalling the previous version does not fully set back to the situation where the package itself was not yet installed while its dependencies were just installed), also previous online version of the package might not exist yet for a new package id.
A second idea could be to use
choco source add -n=current-directory -s .
and just
choco install package-name
in the folder with the package version we want to debug.
Everything appears to install as expected, however it turned out it was not the package in my folder that was installed but instead the online version currently in moderation, which could be confusing (both have the same version, but are theoretically different in this edge case). At first sight, I would have expected either the latest approved version would be installed, or, ideally, the one in my folder (it seems it was correctly doing that with choco v1.4.0), but never the one currently in moderation (I confirm I did not use the --version parameter). Therefore I end up with similar drawbacks as the first idea.
Then, I realized that there was a concept of priorities for sources:
PS C:\Users\1\Downloads> choco source list
Chocolatey v2.4.3
chocolatey - https://community.chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
current-directory - . | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
and tried
choco source add -n=current-directory -s . --priority=1
together with
choco install package-name
which appeared to correctly install the package from the folder, with all the dependencies from online.
A third idea could be to manually install all dependencies of the package we want to debug, before running choco install package-name --source .. Maybe it is the most reliable, although it can be tedious in case a package has many dependencies with exact versions to specify for each.
Am I doing it wrong?
System Details
- Operating System: Windows 11 Pro v24H2
- Windows PowerShell version: Default
- Chocolatey CLI Version: v2.4.3
- Chocolatey Licensed Extension version: N/A
- Chocolatey License type: N/A
- Terminal/Emulator: Default
Installed Packages
Output Log
Additional Context
No response
Checklist
What You Are Seeing?
I am not sure of what should be done to debug efficiently packages that have dependencies, and there were possibly confusing behaviors.
Sorry if it has been already discussed somewhere that I missed.
What is Expected?
Simplify/Clarify the debug method for packages with dependencies.
How Did You Get This To Happen?
In https://docs.chocolatey.org/en-us/create/create-packages-quick-start/#test-the-package , it is suggested to run
in a virtual machine, which, I guess, should be ideally clean with only the latest version of choco installed.
However, this command appears to immediately fail if the package has dependencies.
A first idea could be to first install a previous online version of the package but this would not help fully testing the behavior of the package version we want to debug (since often just uninstalling the previous version does not fully set back to the situation where the package itself was not yet installed while its dependencies were just installed), also previous online version of the package might not exist yet for a new package id.
A second idea could be to use
and just
choco install package-namein the folder with the package version we want to debug.
Everything appears to install as expected, however it turned out it was not the package in my folder that was installed but instead the online version currently in moderation, which could be confusing (both have the same version, but are theoretically different in this edge case). At first sight, I would have expected either the latest approved version would be installed, or, ideally, the one in my folder (it seems it was correctly doing that with choco v1.4.0), but never the one currently in moderation (I confirm I did not use the
--versionparameter). Therefore I end up with similar drawbacks as the first idea.Then, I realized that there was a concept of priorities for sources:
and tried
together with
choco install package-namewhich appeared to correctly install the package from the folder, with all the dependencies from online.
A third idea could be to manually install all dependencies of the package we want to debug, before running
choco install package-name --source .. Maybe it is the most reliable, although it can be tedious in case a package has many dependencies with exact versions to specify for each.Am I doing it wrong?
System Details
Installed Packages
Output Log
Additional Context
No response